using Learun.DataBase.Repository; using Learun.Util; using System; using System.Collections.Generic; using System.Text; namespace Learun.Application.OA.Gantt { /// <summary> /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2017 /// 创建人:陈彬彬 /// 日 期:2018.06.20 /// 描 述:项目计划 /// </summary> public class JQueryGanttService : RepositoryFactory { #region 获取数据 /// <summary> /// 获取甘特图数据 /// </summary> /// <param name="queryJson">关键词</param> /// <returns></returns> public IEnumerable<JQueryGanttEntity> GetList(string queryJson) { try { var strSql = new StringBuilder(); strSql.Append("SELECT * FROM JQueryGantt t"); return this.BaseRepository().FindList<JQueryGanttEntity>(strSql.ToString()); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } } /// <summary> /// 获取甘特图实体 /// </summary> /// <param name="keyValue">主键</param> /// <returns></returns> public JQueryGanttEntity GetEntity(string keyValue) { try { return this.BaseRepository().FindEntity<JQueryGanttEntity>(keyValue); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } } #endregion #region 提交数据 /// <summary> /// 删除 /// </summary> /// <param name="keyValue">主键</param> public void DeleteEntity(string keyValue) { try { this.BaseRepository().Delete<JQueryGanttEntity>(t => t.id == keyValue); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } } /// <summary> /// 保存(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">邮件发送实体</param> /// <returns></returns> public void SaveEntity(string keyValue, JQueryGanttEntity entity) { try { if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); this.BaseRepository().Update(entity); } else { entity.Create(); this.BaseRepository().Insert(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } } #endregion } }