Ejemplo n.º 1
0
        public ActionResult UploadForm()
        {
            var                user   = ERCHTMS.Code.OperatorProvider.Provider.Current();
            string             workId = Request["WorkId"];
            var                list   = nosaworkitembll.GetList(string.Format(" and workid='{0}' and dutyuserid='{1}'", workId, user.UserId)).ToList();
            NosaworkitemEntity entity = null;

            if (list.Count > 0)
            {
                entity = list[0];
            }
            if (entity != null)
            {
                entity.IsSubmitted = Request["IsSubmited"];
                entity.State       = entity.IsSubmitted == "是" ? "待审核" : "待上传";
                entity.UploadDate  = DateTime.Now;
                nosaworkitembll.SaveForm(entity.ID, entity);
                if (entity.IsSubmitted == "是")
                {
                    var wEntity = nosaworksbll.GetEntity(entity.WorkId);
                    if (wEntity != null)
                    {
                        wEntity.SubmitUserId   += entity.DutyUserId + ",";
                        wEntity.SubmitUserName += entity.DutyUserName + ",";
                        nosaworksbll.SaveForm(wEntity.ID, wEntity);
                    }
                }
            }

            return(Success("操作成功。"));
        }
Ejemplo n.º 2
0
 private void UpdateWorkEntity(NosaworksEntity wEntity, NosaworkitemEntity iEntity)
 {
     if (wEntity != null && iEntity != null)
     {
         //完成进度
         var total = wEntity.DutyUserId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Count();
         var num   = nosaworkitembll.GetList(string.Format(" and workid='{0}' and state='通过'", iEntity.WorkId)).Count();
         wEntity.Pct = (decimal)Math.Round((num * 1.0) / total * 100, 2);
         //责任人、责任部门标签
         string oldName       = iEntity.DutyUserName;
         string newName       = string.Format("<span style='color:#00CC99;' title='已完成本次任务'>{0},</span>", oldName);
         string oldDepartName = iEntity.DutyDepartName;
         string newDepartName = string.Format("<span style='color:#00CC99;' title='已完成本次任务'>{0},</span>", oldDepartName);
         var    list          = nosaworkitembll.GetList(string.Format(" and workid='{0}' and dutydepartid='{1}'", iEntity.WorkId, iEntity.DutyDepartId)).ToList();
         if (iEntity.State == "通过")
         {
             Regex regTrm  = new Regex(",</span>$");
             Regex regUser = new Regex(oldName + ",?");
             Regex regDept = new Regex(oldDepartName + ",?");
             wEntity.DutyUserHtml = regUser.Replace(wEntity.DutyUserHtml, newName);
             wEntity.DutyUserHtml = regTrm.Replace(wEntity.DutyUserHtml, "</span>");
             if (list.Count == list.Count(x => x.State == "通过"))
             {
                 wEntity.DutyDepartHtml = regDept.Replace(wEntity.DutyDepartHtml, newDepartName);
                 wEntity.DutyDepartHtml = regTrm.Replace(wEntity.DutyDepartHtml, "</span>");
             }
         }
     }
 }
Ejemplo n.º 3
0
        public ActionResult SaveForm(string keyValue, NosaworkitemEntity entity)
        {
            nosaworkitembll.SaveForm(keyValue, entity);
            if (entity.State == "通过")
            {
                var wEntity = nosaworksbll.GetEntity(entity.WorkId);
                if (wEntity != null)
                {
                    //更新完成进度、责任人、责任部门的显示标签
                    UpdateWorkEntity(wEntity, entity);
                    nosaworksbll.SaveForm(wEntity.ID, wEntity);
                }
            }
            else if (entity.State == "不通过")
            {
                var wEntity = nosaworksbll.GetEntity(entity.WorkId);
                if (wEntity != null && !string.IsNullOrWhiteSpace(wEntity.SubmitUserId) && !string.IsNullOrWhiteSpace(wEntity.SubmitUserName))
                {
                    wEntity.SubmitUserId   = wEntity.SubmitUserId.Replace(entity.DutyUserId + ",", "");
                    wEntity.SubmitUserName = wEntity.SubmitUserName.Replace(entity.DutyUserName + ",", "");
                    //更新完成进度、责任人、责任部门的显示标签
                    UpdateWorkEntity(wEntity, entity);
                    nosaworksbll.SaveForm(wEntity.ID, wEntity);
                }
            }

            return(Success("操作成功。"));
        }
Ejemplo n.º 4
0
        private void SaveWorkItem(NosaworksEntity entity)
        {
            nosaworkitembll.RemoveForm(entity.ID);
            UserBLL userbll    = new UserBLL();
            var     listUserId = entity.DutyUserId.Split(new char[] { ',' });

            foreach (var userId in listUserId)
            {
                var user    = userbll.GetUserInfoEntity(userId);
                var iEntity = new NosaworkitemEntity()
                {
                    ID             = Guid.NewGuid().ToString(),
                    DutyUserId     = userId,
                    DutyUserName   = user.RealName,
                    DutyDepartId   = user.DepartmentId,
                    DutyDepartName = user.DeptName,
                    WorkId         = entity.ID,
                    IsSubmitted    = "否",
                    State          = "待上传",
                    CheckUserId    = entity.EleDutyUserId,
                    CheckUserName  = entity.EleDutyUserName
                };
                nosaworkitembll.SaveForm("", iEntity);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, NosaworkitemEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }