コード例 #1
0
ファイル: CheckController.cs プロジェクト: DuoDuoShaGou/XZOA
        public ActionResult SubmitForm(LeaveEntity leaveEntity, string keyValue)
        {
            string[] Ids = keyValue.Split(',');
            foreach (var Id in Ids)
            {
                var leave = leaveApp.GetForm(Id);
                if (leave.F_IsCheck == null && leave.F_LeaveStatus == (int)LeaveStatusEnum.UnChecked)//未审核
                {
                    leave.F_IsCheck      = leaveEntity.F_IsCheck != null ? leaveEntity.F_IsCheck : null;
                    leave.F_CheckOpinion = leaveEntity.F_CheckOpinion != "" ? leaveEntity.F_CheckOpinion : "";
                    if (leave.F_IsCheck.HasValue && leave.F_IsCheck == true)
                    {
                        leave.F_LeaveStatus = (int)LeaveStatusEnum.UnApproved;      //状态改为未批准
                        if (leave.F_CheckLeaderId.Equals(leave.F_ApprovalLeaderId)) //审核人和批准人一样
                        {
                            leave.F_IsApproval   = true;
                            leave.F_LeaveStatus  = (int)LeaveStatusEnum.Success;//状态改为审批通过
                            leave.F_ApprovalTime = DateTime.Now;
                        }
                        else
                        {
                            var ApprovalLeader = userApp.GetForm(leave.F_ApprovalLeaderId);
                            var user           = userApp.GetForm(leave.F_UserId);
                            if (!string.IsNullOrEmpty(ApprovalLeader.F_Email))
                            {
                                mHelper.MailServer = "10.110.120.2";
                                mHelper.Send(ApprovalLeader.F_Email, "OA请假单", "你好," + user.F_RealName + "有请假单需要你登录OA去做批准,请点击链接<a>http://10.110.120.6:8090/</a>");
                            }
                        }
                    }
                    else
                    {
                        leave.F_LeaveStatus  = (int)LeaveStatusEnum.Fail;//状态改为审核失败
                        leave.F_ApprovalTime = DateTime.Now;
                    }
                }
                else
                {
                    if (leave.F_IsApproval == null && leave.F_LeaveStatus == (int)LeaveStatusEnum.UnApproved)//未批准
                    {
                        leave.F_IsApproval      = leaveEntity.F_IsApproval != null ? leaveEntity.F_IsApproval : null;
                        leave.F_ApprovalOpinion = leaveEntity.F_ApprovalOpinion != "" ? leaveEntity.F_ApprovalOpinion : "";
                        if (leave.F_IsApproval.HasValue && leave.F_IsApproval == true)
                        {
                            leave.F_LeaveStatus  = (int)LeaveStatusEnum.Success;//状态改为审核通过
                            leave.F_ApprovalTime = DateTime.Now;
                        }
                        else
                        {
                            leave.F_LeaveStatus  = (int)LeaveStatusEnum.Fail;//状态改为审核通过
                            leave.F_ApprovalTime = DateTime.Now;
                        }
                    }
                }

                leaveApp.SubmitForm(leave, Id);
            }
            return(Success("操作成功。"));
        }
コード例 #2
0
 public ActionResult GetFormJson(string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         LeaveEntity leave = leaveApp.GetForm(keyValue);
         return(Content(leave.ToJson()));
     }
     return(null);
 }