Beispiel #1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        public virtual void SaveImportData(IEnumerable <Flow_FormContentStepCheckStateModel> list)
        {
            try
            {
                using (DBContainer db = new DBContainer())
                {
                    foreach (var model in list)
                    {
                        Flow_FormContentStepCheckState entity = new Flow_FormContentStepCheckState();
                        entity.Id          = ResultHelper.NewId;
                        entity.StepCheckId = model.StepCheckId;
                        entity.UserId      = model.UserId;
                        entity.CheckFlag   = model.CheckFlag;
                        entity.Reamrk      = model.Reamrk;
                        entity.TheSeal     = model.TheSeal;
                        entity.CreateTime  = ResultHelper.NowTime;

                        db.Flow_FormContentStepCheckState.Add(entity);
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #2
0
        private void InsertChecker(Flow_FormContent model, int i, Flow_Step stepModel, Flow_FormContentStepCheck stepCheckModel)
        {
            //获得流转规则下的审核人员
            List <string> userIdList = new List <string>();

            if (stepModel.FlowRule == FlowRuleEnum.Customer.ToString())
            {
                string[] arrUserList = model.CustomMember.Split(',');
                foreach (string s in arrUserList)
                {
                    userIdList.Add(s);
                }
            }
            else
            {
                userIdList = GetStepCheckMemberList(stepModel.Id, model.Id);
            }

            foreach (string userId in userIdList)
            {
                //批量建立步骤审核人表
                Flow_FormContentStepCheckState stepCheckModelState = new Flow_FormContentStepCheckState();
                stepCheckModelState.StepCheckId = stepCheckModel.Id.ToString();
                stepCheckModelState.UserId      = userId;
                stepCheckModelState.CheckFlag   = "2";
                stepCheckModelState.Reamrk      = "";
                stepCheckModelState.TheSeal     = "";
                stepCheckModelState.CreateTime  = ResultHelper.NowTime.ToString("yyyy-MM-dd");
                stepCheckStateBLL.m_Rep.Create(stepCheckModelState);
            }
        }
Beispiel #3
0
 public bool Create(ref ValidationErrors errors, Flow_FormContentStepCheckStateModel model)
 {
     try
     {
         Flow_FormContentStepCheckState entity = m_Rep.GetById(model.Id);
         if (entity != null)
         {
             errors.Add(Suggestion.PrimaryRepeat);
             return(false);
         }
         entity             = new Flow_FormContentStepCheckState();
         entity.CheckFlag   = model.CheckFlag;
         entity.CreateTime  = model.CreateTime;
         entity.Id          = model.Id;
         entity.Reamrk      = model.Reamrk;
         entity.StepCheckId = model.StepCheckId;
         entity.TheSeal     = model.TheSeal;
         entity.UserId      = model.UserId;
         if (m_Rep.Create(entity) == 1)
         {
             return(true);
         }
         else
         {
             errors.Add(Suggestion.InsertFail);
             return(false);
         }
     }
     catch (Exception ex)
     {
         errors.Add(ex.Message);
         ExceptionHander.WriteException(ex);
         return(false);
     }
 }
Beispiel #4
0
 public int Create(Flow_FormContentStepCheckState entity)
 {
     using (AppsDBEntities db = new AppsDBEntities())
     {
         db.Flow_FormContentStepCheckState.Add(entity);
         return(db.SaveChanges());
     }
 }
Beispiel #5
0
 public int Edit(Flow_FormContentStepCheckState entity)
 {
     using (AppsDBEntities db = new AppsDBEntities())
     {
         db.Flow_FormContentStepCheckState.Attach(entity);
         db.Entry <Flow_FormContentStepCheckState>(entity).State = System.Data.Entity.EntityState.Modified;
         //db.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
         return(db.SaveChanges());
     }
 }
Beispiel #6
0
        //创建审核人
        private void CreateCheckState(string stepCheckId, string userId)
        {
            Flow_FormContentStepCheckState stepCheckModelState = new Flow_FormContentStepCheckState();

            stepCheckModelState.StepCheckId = stepCheckId;
            stepCheckModelState.UserId      = userId;
            stepCheckModelState.CheckFlag   = "2";
            stepCheckModelState.Reamrk      = "";
            stepCheckModelState.TheSeal     = "";
            stepCheckModelState.CreateTime  = ResultHelper.NowTime.ToString("yyyy-MM-dd");
            stepCheckStateBLL.m_Rep.Create(stepCheckModelState);
        }
Beispiel #7
0
 public bool IsExist(string id)
 {
     using (AppsDBEntities db = new AppsDBEntities())
     {
         Flow_FormContentStepCheckState entity = GetById(id);
         if (entity != null)
         {
             return(true);
         }
         return(false);
     }
 }
Beispiel #8
0
 public int Delete(string id)
 {
     using (AppsDBEntities db = new AppsDBEntities())
     {
         Flow_FormContentStepCheckState entity = db.Flow_FormContentStepCheckState.SingleOrDefault(a => a.Id == id);
         if (entity != null)
         {
             db.Flow_FormContentStepCheckState.Remove(entity);
         }
         return(db.SaveChanges());
     }
 }
Beispiel #9
0
        public void ResetCheckStateByFormCententId(string stepCheckId, string contentId, string checkState, string checkFlag)
        {
            //Context.P_Flow_ResetCheckStepState(stepCheckId, contentId, checkState, checkFlag);
            //重新设置当前表单步骤的状态
            //update Flow_FormContentStepCheck set State = @CheckState where ContentId = @ContentId and id!= @stepCheckId
            Flow_FormContentStepCheckStateRepository _Flow_FormContentStepCheckStateRepository = new Flow_FormContentStepCheckStateRepository();
            List <Flow_FormContentStepCheck>         upModelList = FindList(a => a.ContentId == contentId && a.Id.ToString() != stepCheckId).ToList();

            foreach (Flow_FormContentStepCheck upm in upModelList)
            {
                //根据表单步骤设置其子下步骤分解的状态
                Flow_FormContentStepCheckState upInfo = _Flow_FormContentStepCheckStateRepository.Find(Convert.ToInt32(upm.Id));
                upInfo.CheckFlag = checkFlag;
                _Flow_FormContentStepCheckStateRepository.Update(upInfo);
            }
        }
Beispiel #10
0
        public Flow_FormContentStepCheckStateModel GetByStepCheckId(string id)
        {
            Flow_FormContentStepCheckStateModel model  = new Flow_FormContentStepCheckStateModel();
            Flow_FormContentStepCheckState      entity = m_Rep.GetByStepCheckId(id);

            if (entity == null)
            {
                return(model);
            }

            model.Id          = entity.Id;
            model.StepCheckId = entity.StepCheckId;
            model.UserId      = entity.UserId;
            model.CheckFlag   = entity.CheckFlag;
            model.Reamrk      = entity.Reamrk;
            model.TheSeal     = entity.TheSeal;
            model.CreateTime  = entity.CreateTime;
            return(model);
        }
Beispiel #11
0
        public virtual Flow_FormContentStepCheckStateModel GetById(object id)
        {
            if (IsExists(id))
            {
                Flow_FormContentStepCheckState      entity = m_Rep.GetById(id);
                Flow_FormContentStepCheckStateModel model  = new Flow_FormContentStepCheckStateModel();
                model.Id          = entity.Id;
                model.StepCheckId = entity.StepCheckId;
                model.UserId      = entity.UserId;
                model.CheckFlag   = entity.CheckFlag;
                model.Reamrk      = entity.Reamrk;
                model.TheSeal     = entity.TheSeal;
                model.CreateTime  = entity.CreateTime;

                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #12
0
        public virtual async Task <Tuple <ValidationErrors, bool> > CreateAsync(Flow_FormContentStepCheckStateModel model)
        {
            ValidationErrors errors = new ValidationErrors();

            try
            {
                Flow_FormContentStepCheckState entity = await m_Rep.GetByIdAsync(model.Id);

                if (entity != null)
                {
                    errors.Add(Resource.PrimaryRepeat);
                    return(new Tuple <ValidationErrors, bool>(errors, false));
                }
                entity             = new Flow_FormContentStepCheckState();
                entity.Id          = model.Id;
                entity.StepCheckId = model.StepCheckId;
                entity.UserId      = model.UserId;
                entity.CheckFlag   = model.CheckFlag;
                entity.Reamrk      = model.Reamrk;
                entity.TheSeal     = model.TheSeal;
                entity.CreateTime  = model.CreateTime;


                if (await m_Rep.CreateAsync(entity))
                {
                    return(new Tuple <ValidationErrors, bool>(errors, true));
                }
                else
                {
                    errors.Add(Resource.InsertFail);
                    return(new Tuple <ValidationErrors, bool>(errors, false));
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return(new Tuple <ValidationErrors, bool>(errors, false));
            }
        }
Beispiel #13
0
        public virtual bool Edit(ref ValidationErrors errors, Flow_FormContentStepCheckStateModel model)
        {
            try
            {
                Flow_FormContentStepCheckState entity = m_Rep.GetById(model.Id);
                if (entity == null)
                {
                    errors.Add(Resource.Disable);
                    return(false);
                }
                entity.Id          = model.Id;
                entity.StepCheckId = model.StepCheckId;
                entity.UserId      = model.UserId;
                entity.CheckFlag   = model.CheckFlag;
                entity.Reamrk      = model.Reamrk;
                entity.TheSeal     = model.TheSeal;
                entity.CreateTime  = model.CreateTime;



                if (m_Rep.Edit(entity))
                {
                    return(true);
                }
                else
                {
                    errors.Add(Resource.NoDataChange);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return(false);
            }
        }
Beispiel #14
0
        //[SupportFilter]
        public JsonResult Edit(string Remark, string TheSeal, string FormId, int Flag, string ContentId, string UserList)
        {
            string stepCheckId = formContentBLL.GetCurrentStepCheckId(FormId, ContentId);

            if (stepCheckId == "")
            {
                return(Json(JsonHandler.CreateMessage(0, Resource.EditFail)));
            }
            Flow_FormContentStepCheckState stepCheckStateModel = stepCheckStateBLL.m_Rep.Find(a => a.StepCheckId == stepCheckId);

            if (stepCheckStateModel.UserId != GetUserId())
            {
                return(Json(JsonHandler.CreateMessage(0, "越权操作!")));
            }
            stepCheckStateModel.Reamrk    = Remark;
            stepCheckStateModel.TheSeal   = TheSeal;
            stepCheckStateModel.CheckFlag = Flag.ToString();
            if (stepCheckStateBLL.m_Rep.Update(stepCheckStateModel))
            {
                //获取当前步骤
                Flow_FormContentStepCheck stepCheckModel = stepCheckBLL.m_Rep.Find(Convert.ToInt32(stepCheckStateModel.StepCheckId));
                //获得当前的步骤模板
                Flow_Step currentStepModel = stepBLL.m_Rep.Find(Convert.ToInt32(stepCheckModel.StepId));
                //驳回直接终止审核
                if (Flag == (int)FlowStateEnum.Reject)
                {
                    stepCheckModel.State     = Flag.ToString();
                    stepCheckModel.StateFlag = "false";
                    stepCheckBLL.m_Rep.Update(stepCheckModel);
                    //重置所有步骤的状态
                    stepCheckBLL.ResetCheckStateByFormCententId(stepCheckModel.Id.ToString(), ContentId, (int)FlowStateEnum.Progress, (int)FlowStateEnum.Progress);
                    LogHandler.WriteServiceLog(GetUserId(), "Id" + stepCheckStateModel.Id + ",StepCheckId" + stepCheckStateModel.Reamrk, "成功", "修改", "Flow_FormContentStepCheckState");
                    return(Json(JsonHandler.CreateMessage(1, Resource.CheckSucceed)));
                }
                else if (currentStepModel.IsAllCheck == "true")
                {
                    //启用会签
                    //获得同步骤的同批审核人
                    List <Flow_FormContentStepCheckState> stepCheckStateList = stepCheckStateBLL.m_Rep.FindPageList(ref setNoPagerAscById, a => a.StepCheckId == stepCheckStateModel.StepCheckId).ToList();
                    //查看自己是否是最后一个审核人
                    bool complete = stepCheckStateList.Where(a => a.CheckFlag == FlowStateEnum.Progress.ToString()).Count() == 1;
                    if (complete)
                    {
                        stepCheckModel.State     = Flag.ToString();
                        stepCheckModel.StateFlag = "true";
                        stepCheckBLL.m_Rep.Update(stepCheckModel);
                    }
                    else
                    {
                        //让审核人继续执行这个步骤直到完成
                        LogHandler.WriteServiceLog(GetUserId(), "Id" + stepCheckStateModel.Id + ",StepCheckId" + stepCheckStateModel.Reamrk, "成功", "修改", "Flow_FormContentStepCheckState");
                        return(Json(JsonHandler.CreateMessage(1, Resource.CheckSucceed)));
                    }
                }
                else
                {
                    //不是会签,任何一个审批都通过
                    stepCheckModel.State     = Flag.ToString();
                    stepCheckModel.StateFlag = "true";
                    stepCheckBLL.m_Rep.Update(stepCheckModel);
                }
                //查看下一步是否为自创建
                if (stepCheckModel.IsEnd != "true" && !string.IsNullOrEmpty(UserList))
                {
                    List <Flow_FormContentStepCheck> stepCheckList = stepCheckBLL.GetListByFormId(FormId, ContentId).ToList();
                    int j = 0;
                    for (int i = stepCheckList.Count() - 1; i >= 0; i--)
                    {
                        if (stepCheckId == stepCheckList[i].Id.ToString())
                        {
                            j = i;
                        }
                    }
                    //查看是否还有下一步步骤
                    if (j - 1 <= stepCheckList.Count())
                    {
                        //查有第二步骤,查看是否是自选
                        Flow_Step stepModel = stepBLL.m_Rep.Find(Convert.ToInt32(stepCheckList[j + 1].StepId));
                        if (stepModel.FlowRule == FlowRuleEnum.Customer.ToString())
                        {
                            foreach (string userId in UserList.Split(','))
                            {
                                //批量建立步骤审核人表
                                CreateCheckState(stepCheckList[j + 1].Id.ToString(), userId);
                            }
                        }
                        else
                        {
                            //批量建立审核人员表
                            foreach (string userId in GetStepCheckMemberList(stepCheckList[j + 1].StepId))
                            {
                                //批量建立步骤审核人表
                                CreateCheckState(stepCheckList[j + 1].Id.ToString(), userId);
                            }
                        }
                    }
                }


                LogHandler.WriteServiceLog(GetUserId(), "Id" + stepCheckStateModel.Id + ",StepCheckId" + stepCheckStateModel.Reamrk, "成功", "修改", "Flow_FormContentStepCheckState");
                return(Json(JsonHandler.CreateMessage(1, Resource.CheckSucceed)));
            }
            else
            {
                string ErrorCol = errors.Error;
                LogHandler.WriteServiceLog(GetUserId(), "Id" + stepCheckStateModel.Id + ",StepCheckId" + stepCheckStateModel.Reamrk + "," + ErrorCol, "失败", "修改", "Flow_FormContentStepCheckState");
                return(Json(JsonHandler.CreateMessage(0, Resource.CheckFail + ErrorCol)));
            }
        }