Beispiel #1
0
 public void SubmitForm(TempleteCompostionEntity templeteCompostionEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         templeteCompostionEntity.Modify(keyValue);
         service.Update(templeteCompostionEntity);
     }
     else
     {
         templeteCompostionEntity.Create();
         service.Insert(templeteCompostionEntity);
     }
 }
Beispiel #2
0
        public ActionResult UpdateTemplete(string templete_id, string updateTempleteList)
        {
            List <TempleteAddModel> templeteList = new List <TempleteAddModel>();


            templeteList = KPI.Code.Json.ToList <TempleteAddModel>(updateTempleteList);
            using (var db = new RepositoryBase().BeginTrans())
            {
                #region 将原来考核方案的状态更改为 未审核
                TempleteEntity templeteEntity = templeteApp.GetForm(templete_id);
                templeteEntity.templete_name         = templeteList[0].templete_name;
                templeteEntity.templete_type         = templeteList[0].templete_type;
                templeteEntity.statue                = 0; //1:启用 0:禁用
                templeteEntity.templete_check_statue = 0; //模板的初始化状态是null
                templeteEntity.last_modify_time      = DateTime.Now;
                //templeteApp.SubmitForm(templeteEntity, templete_id);
                db.Update <TempleteEntity>(templeteEntity);
                #endregion

                #region  除原来考核方案的组成
                templeteCompostionApp.GetByTempleteId(templete_id).ForEach(t => { db.Delete <TempleteCompostionEntity>(t); });
                #endregion

                #region 插入考核方案详细表
                TempleteCompostionEntity templeteCompostionEntity = null;

                for (int i = 0; i < templeteList.Count; i++)
                {
                    templeteCompostionEntity                    = new TempleteCompostionEntity();
                    templeteCompostionEntity.id                 = Common.GuId();
                    templeteCompostionEntity.dimension_id       = templeteList[i].dimension_id;
                    templeteCompostionEntity.detail_id          = templeteList[i].detail_id;
                    templeteCompostionEntity.base_score         = templeteList[i].base_score;
                    templeteCompostionEntity.allow_beyond_limit = templeteList[i].allow_beyond_limit;
                    templeteCompostionEntity.templete_id        = templete_id;
                    templeteCompostionEntity.creator_user_id    = OperatorProvider.Provider.GetCurrent().UserId;
                    templeteCompostionEntity.create_time        = DateTime.Now;
                    //templeteCompostionApp.SubmitForm(templeteCompostionEntity, String.Empty);
                    db.Insert <TempleteCompostionEntity>(templeteCompostionEntity);
                }
                #endregion



                #region 修改待审核的模板  通过置为空
                //获取这个方案的所有审核  如果是通过将将审核结果置为空
                TempleteCheckEntity templeteCheckEntity = templeteCheckApp.GetTempleteCheckByTempleteId(templete_id);

                templeteCheckEntity.check_sponser    = templeteEntity.creator_user_id;
                templeteCheckEntity.checker          = templeteList[0].checker_id;//考虑审核方写谁?
                templeteCheckEntity.statue           = 0;
                templeteCheckEntity.last_modify_time = DateTime.Now;
                //templeteCheckApp.SubmitForm(templeteCheckEntity, templeteCheckEntity.id);
                db.Update <TempleteCheckEntity>(templeteCheckEntity);
                #endregion

                #region 添加审核人的任务  由于没有与审核人任务相关联的外键  所以进行添加  无法进行更新
                string templeteCheckId = templeteCheckEntity.id;
                //找到原来此任务  将任务改为待完成
                SelfTaskDetailEntity selfTaskDetailEntity = selfTaskDetailApp.GetPersonalTaskByTaskObj(templeteCheckId, templeteList[0].checker_id);
                if (selfTaskDetailEntity == null)
                {
                    return(Error("不存在对应的任务"));
                }
                selfTaskDetailEntity.task_statue      = 1;//0 未激活  1待完成  2已完成
                selfTaskDetailEntity.last_modify_time = DateTime.Now;
                db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity);
                #endregion



                db.Commit();
            }

            return(Success("操作成功。", null));
        }
Beispiel #3
0
        public ActionResult AddTemplete(string addTempleteList)
        {
            List <TempleteAddModel> templeteList = new List <TempleteAddModel>();

            FileLog.Debug("addTempleteList " + addTempleteList);
            templeteList = KPI.Code.Json.ToList <TempleteAddModel>(addTempleteList);
            if (templeteList == null || templeteList.Count == 0)
            {
                return(Error("考核方案不能为空。"));
            }
            //先对考核方案的名称进行去重判断
            if (templeteApp.IsExists(templeteList[0].templete_name))
            {
                return(Error("已存在相同名称的考核方案。"));
            }
            using (var db = new RepositoryBase().BeginTrans())
            {
                FileLog.Debug(addTempleteList);
                #region 新增考核方案
                TempleteEntity templeteEntity = new TempleteEntity();
                string         templeteId     = Common.GuId();
                templeteEntity.id                    = templeteId;
                templeteEntity.templete_name         = templeteList[0].templete_name;
                templeteEntity.templete_type         = templeteList[0].templete_type;
                templeteEntity.statue                = 0; //1:启用 0:禁用
                templeteEntity.templete_check_statue = 0; //模板的初始化状态是null
                templeteEntity.creator_user_id       = OperatorProvider.Provider.GetCurrent().UserId;
                templeteEntity.create_time           = DateTime.Now;
                //string templeteId = (templeteApp.SubmitFormEx(templeteEntity, string.Empty)).id;
                db.Insert <TempleteEntity>(templeteEntity);
                #endregion

                #region 新增待审核的模板
                TempleteCheckEntity templeteCheckEntity = new TempleteCheckEntity();
                string templeteCheckId = Common.GuId();
                templeteCheckEntity.id              = templeteCheckId;
                templeteCheckEntity.templete_id     = templeteId;
                templeteCheckEntity.check_sponser   = OperatorProvider.Provider.GetCurrent().UserId;
                templeteCheckEntity.checker         = templeteList[0].checker_id;//考虑审核方写谁?
                templeteCheckEntity.statue          = 0;
                templeteCheckEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                templeteCheckEntity.create_time     = DateTime.Now;
                //string templeteCheckId = (templeteCheckApp.SubmitFormEx(templeteCheckEntity, string.Empty)).id;
                db.Insert <TempleteCheckEntity>(templeteCheckEntity);
                #endregion

                #region 添加审核人的任务
                SelfTaskDetailEntity selfTaskDetailEntity = new SelfTaskDetailEntity();
                selfTaskDetailEntity.id              = Common.GuId();
                selfTaskDetailEntity.task_type       = Convert.ToInt32(Constant.TaskType.待审核);
                selfTaskDetailEntity.person          = templeteList[0].checker_id;
                selfTaskDetailEntity.task_statue     = 1; //0 未激活  1待完成  2已完成
                selfTaskDetailEntity.task_object     = templeteCheckId;
                selfTaskDetailEntity.statue          = 0; //0未删除  1已删除
                selfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                selfTaskDetailEntity.create_time     = DateTime.Now;
                //taskDetailApp.SubmitForm(selfTaskDetailEntity,String.Empty);
                db.Insert <SelfTaskDetailEntity>(selfTaskDetailEntity);
                #endregion

                #region 插入考核方案详细表
                TempleteCompostionEntity templeteCompostionEntity = null;

                for (int i = 0; i < templeteList.Count; i++)
                {
                    templeteCompostionEntity                    = new TempleteCompostionEntity();
                    templeteCompostionEntity.id                 = Common.GuId();
                    templeteCompostionEntity.dimension_id       = templeteList[i].dimension_id;
                    templeteCompostionEntity.detail_id          = templeteList[i].detail_id;
                    templeteCompostionEntity.base_score         = templeteList[i].base_score;
                    templeteCompostionEntity.allow_beyond_limit = templeteList[i].allow_beyond_limit;
                    templeteCompostionEntity.templete_id        = templeteId;
                    templeteCompostionEntity.creator_user_id    = OperatorProvider.Provider.GetCurrent().UserId;
                    templeteCompostionEntity.create_time        = DateTime.Now;
                    db.Insert <TempleteCompostionEntity>(templeteCompostionEntity);
                    //templeteCompostionApp.SubmitForm(templeteCompostionEntity, String.Empty);
                }

                db.Commit();
            }
            #endregion
            return(Success("操作成功。", null));
        }