/// <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);
         }
     }
 }
Example #2
0
        /// <summary>
        /// 保存项目甘特图数据
        /// </summary>
        /// <param name="prj"></param>
        public void AddProjectGantt(string prj)
        {
            IRepository db = this.BaseRepository().BeginTrans();

            try
            {
                JObject jobj     = prj.ToJObject();
                var     taskJson = jobj.GetValue("tasks").ToString().Replace("\r\n", "").Replace(" ", "").Replace("[]", "\"\"");
                List <JQueryGanttEntity> gantt_list = taskJson.ToList <JQueryGanttEntity>();
                string ProjectId = gantt_list[0].ProjectId;
                //先删除后添加
                db.Delete <JQueryGanttEntity>(u => u.ProjectId.Equals(ProjectId));
                foreach (var item in gantt_list)
                {
                    JQueryGanttEntity ganttEntity = new JQueryGanttEntity();
                    ganttEntity.id                = Guid.NewGuid().ToString();
                    ganttEntity.name              = item.name;
                    ganttEntity.ProjectId         = ProjectId;
                    ganttEntity.progress          = item.progress;
                    ganttEntity.progressByWorklog = item.progressByWorklog;
                    ganttEntity.relevance         = item.relevance;
                    ganttEntity.type              = item.type;
                    ganttEntity.typeId            = item.typeId;
                    ganttEntity.description       = item.description;
                    ganttEntity.code              = item.code;
                    ganttEntity.level             = item.level;
                    ganttEntity.status            = item.status;
                    ganttEntity.depends           = item.depends;
                    ganttEntity.canWrite          = item.canWrite;
                    ganttEntity.start             = item.start;
                    ganttEntity.duration          = item.duration;
                    ganttEntity.end               = item.end;
                    ganttEntity.startIsMilestone  = item.startIsMilestone;
                    ganttEntity.endIsMilestone    = item.endIsMilestone;
                    ganttEntity.collapsed         = item.collapsed;
                    ganttEntity.hasChild          = item.hasChild;
                    ganttEntity.assigs            = item.assigs;
                    //ganttEntity.createdate = DateTime.Now;
                    db.Insert <JQueryGanttEntity>(ganttEntity);
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Example #3
0
 /// <summary>
 /// 保存(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">邮件发送实体</param>
 /// <returns></returns>
 public void SaveEntity(string keyValue, JQueryGanttEntity entity)
 {
     try
     {
         jQueryGanttService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }