Exemplo n.º 1
0
        public ActionResult LoadLeaveWarning()
        {
            QueryParam queryParam = new QueryParam();

            var extendParams = Request.Params["extendParams"];

            if (extendParams != null)
            {
                JavaScriptSerializer             js        = new JavaScriptSerializer();
                List <FilterModel>               filters   = js.Deserialize <List <FilterModel> >(extendParams);
                Dictionary <string, FilterModel> filterSet = filters.ToDictionary(key => key.key, model => model);

                queryParam.filters = filterSet;
            }

            OperateResult or = LeaveManager.LeaveWarningByPager(queryParam);

            if (or.status == OperateStatus.Success &&
                or.data != null)
            {
                return(Json(or.data, JsonRequestBehavior.AllowGet));
            }

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public void LeaveWarningTest1()
        {
            //打桩
            LeaveWarningStub();
            // 打桩:先离职
            Assert.AreEqual(EmployeeLeaveStub(1, new DateTime(2010, 5, 1)), true);
            Assert.AreEqual(EmployeeLeaveStub(2, new DateTime(2010, 5, 10)), true);
            Assert.AreEqual(EmployeeLeaveStub(3, new DateTime(2010, 5, 12)), true);

            var or = LeaveManager.LeaveWarning();

            Assert.AreEqual(or.status, OperateStatus.Success);

            OutputResult(or);

            Assert.AreEqual(EmployeeLeaveStub(4, new DateTime(2018, 9, 1)), true);
            Assert.AreEqual(EmployeeLeaveStub(5, new DateTime(2018, 9, 1)), true);
            Assert.AreEqual(EmployeeLeaveStub(6, new DateTime(2018, 9, 1)), true);


            or = LeaveManager.LeaveWarning();
            Assert.AreEqual(or.status, OperateStatus.Success);

            OutputResult(or);
        }
Exemplo n.º 3
0
        public ActionResult Index(Leave le)
        {
            LeaveManager lm = new LeaveManager();

            if (le.LeaveTime < DateTime.Now)
            {
                if (le.LeaveTime < le.LeaveResult)
                {
                    le.UserId          = Convert.ToInt32(Request.Form["UserId"]);
                    le.LeaveTime       = Convert.ToDateTime(Request.Form["LeaveTime"]);
                    le.LeaveOver       = "未批准";
                    le.Leave_Condition = "可见";
                    bool b = lm.Add(le);
                    if (b)
                    {
                        return(Redirect("/LiuXin/Leave/Query"));;
                    }
                    return(Content("<script>alert('批准失败');window.location.href='/LiuXin/Leave/Query';</script>"));
                }
                else
                {
                    return(Content("<script>alert('请输入合理的返校时间');window.location.href='/LiuXin/Leave/Query';</script>"));
                }
            }
            else
            {
                return(Content("<script>alert('请输入合理的请假时间');window.location.href='/LiuXin/Leave/Query';</script>"));
            }
        }
Exemplo n.º 4
0
        private void DeleteLeave()
        {
            if (leafBindingSource?.Current == null)
            {
                return;
            }
            var dResult = MessageBox.Show(@"Delete current record? - Leave", @"Delete", MessageBoxButtons.YesNo,
                                          MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (dResult != DialogResult.Yes)
            {
                return;
            }
            if (LeaveManager.Delete(((Leaf)leafBindingSource.Current).LeaveId))
            {
                MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                leafBindingSource.RemoveCurrent();
            }
            else
            {
                MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                leafDataGridView.Focus();
            }
        }
        // GET: Leave
        public async Task <ActionResult> Index()
        {
            var userId = User.Identity.GetUserId();
            var user   = await UserManager.FindByIdAsync(userId);

            if (user == null)
            {
                return(HttpNotFound());
            }
            //var leaves = await LeaveManager.GetLeavesAsync(user);
            //var leaves = user.Leaves.ToList();
            var leaves = await LeaveManager.GetUnResumeLeavesOfUserAsync(user).ToListAsync();

            var list = new List <LeaveListViewModel>();

            foreach (var leave in leaves)
            {
                //list.Add(new LeaveListViewModel() { Leave = leave, Status = await LeaveManager.GetLeaveStatus(leave.Id) });
                list.Add(new LeaveListViewModel()
                {
                    Leave = leave
                });
            }
            return(View(list));
        }
Exemplo n.º 6
0
        public ActionResult TcAgree()
        {
            LeaveManager lm        = new LeaveManager();
            List <Leave> listleave = lm.GetBySomeother("批准", "可见");

            return(View(listleave));
        }
        public async Task <ActionResult> Cancel(int?id)
        {
            if (ModelState.IsValid)
            {
                var userid = User.Identity.GetUserId();
                var user   = await UserManager.FindByIdAsync(userid);

                if (user == null)
                {
                    return(View("Error", new[] { "找不到用户" }));
                }
                var leave = await LeaveManager.FindEntityByIdAsync(id ?? 0);

                if (leave == null)
                {
                    return(View("Error", new[] { "找不到该项" }));
                }
                leave.LeaveStatus = LeaveStatus.已取消;
                await LeaveManager.UpdateEntityAsync(leave);

                //var teacher = leave.Checks.First(e => e.CheckOrder == 0).CheckTeacher;
                //teacher.TeacherInfo.ResumeApplies
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
        // GET: LiuXin/MangerLeave
        public ActionResult Index()
        {
            LeaveManager lm        = new LeaveManager();
            List <Leave> listleave = lm.GetBySome("未批准");
            List <Leave> lists     = listleave.OrderByDescending(x => x.LeaveTime).ToList();

            return(View(lists));
        }
Exemplo n.º 9
0
        public ActionResult History()
        {
            LeaveManager lm          = new LeaveManager();
            List <Leave> listhistory = lm.GetByother("未批准");
            List <Leave> lists       = listhistory.OrderByDescending(x => x.LeaveTime).ToList();;

            return(View(lists));
        }
Exemplo n.º 10
0
        public void ShouldGetLeaveForGivenEmployeeIdTest()
        {
            uowMock.Setup(x => x.Leaves.GetAllIncluding(It.IsAny <Expression <Func <Leave, bool> > >(), It.IsAny <Expression <Func <Leave, object> > >()))
            .Returns(DataUtilities.GetListOfMockedLeaves().AsQueryable());
            var manager         = new LeaveManager(uowMock.Object, publicHolidaysManager.Object);
            var results         = manager.GetLeaveByEmployeeId(DataUtilities.id);
            var expectedResults = DataUtilities.GetListOfMockedLeaves();

            Assert.AreEqual(expectedResults.Count(), results.Count());
        }
Exemplo n.º 11
0
        public void ShouldUpdateLeaveTest()
        {
            uowMock.Setup(x => x.Leaves.Update(It.IsAny <Leave>()));
            uowMock.Setup(x => x.PublicHolidays.GetWhere(It.IsAny <Expression <Func <PublicHoliday, bool> > >()))
            .Returns(new List <PublicHoliday>().AsQueryable());
            uowMock.Setup(x => x.Save()).Returns(1);
            var manager = new LeaveManager(uowMock.Object, publicHolidaysManager.Object);
            var results = manager.UpdateLeave(DataUtilities.GetListOfMockedLeaves().First());

            Assert.AreEqual(results, 1);
        }
Exemplo n.º 12
0
        public void ShouldUpdateLeaveStatusTest()
        {
            uowMock.Setup(x => x.Leaves.GetById(It.IsAny <int>()))
            .Returns(DataUtilities.GetListOfMockedLeaves().FirstOrDefault());
            uowMock.Setup(x => x.Leaves.Update(It.IsAny <Leave>()));
            uowMock.Setup(x => x.Save()).Returns(1);
            var manager = new LeaveManager(uowMock.Object, publicHolidaysManager.Object);
            var results = manager.UpdateLeaveStatus(1, Infrastructure.LeaveStatusEnum.Approved);

            Assert.AreEqual(results, 1);
        }
Exemplo n.º 13
0
    private void SaveData(string IsDelete)
    {
        long lngID = 0;

        try
        {
            if (hfIsUpdate.Value == "N")
            {
                lngID = objDB.GerMaxIDNumber("LeavePakMst", "LeavePakID");
            }
            else
            {
                lngID = Convert.ToInt64(hfID.Value);
            }

            LeavePakMst objLeavePakMst = new LeavePakMst(lngID.ToString(), txtLeavePakName.Text, txtDescription.Text, (chkIsOffdayCounted.Checked == true ? "Y" : "N"),
                                                         (chkLeavCalcOnJoining.Checked == true ? "Y" : "N"), (chkInActive.Checked == true ? "N" : "Y"), ddlEmploymentType.SelectedValue.ToString(), (chkIsDefault.Checked == true ? "Y" : "N"), Session["USERID"].ToString(),
                                                         Common.SetDateTime(DateTime.Now.ToString()), "N", ddlMonthFrom.SelectedValue.ToString(), ddlMonthTo.SelectedValue.ToString(), (chkIsNextYear.Checked == true ? "Y" : "N"), strStartDate, strEndDate);

            objLeaveManager.InsertLeavePakMst(objLeavePakMst, hfIsUpdate.Value, IsDelete, (chkInActive.Checked == true ? "N" : "Y"), grLeaveList);

            if (hfIsUpdate.Value == "Y")
            {
                LeaveManager objLeaveMgr = new LeaveManager();
                objLeaveMgr.InsertLeaveProfile(ddlEmploymentType.SelectedValue, lngID.ToString(), Session["USERID"].ToString());
            }

            if ((hfIsUpdate.Value == "N") && (IsDelete == "N"))
            {
                lblMsg.Text = "Record Saved Successfully";
            }
            else if ((hfIsUpdate.Value == "Y") && (IsDelete == "N"))
            {
                lblMsg.Text = "Record Updated Successfully";
            }
            else if (IsDelete == "Y")
            {
                lblMsg.Text = "Record Deleted Successfully";
            }
            this.OpenRecord();

            Common.EmptyTextBoxValues(this);
            this.EntryMode(false);
        }
        catch (Exception ex)
        {
            lblMsg.Text = "";
            throw (ex);
        }
    }
Exemplo n.º 14
0
        public ActionResult Query()
        {
            LeaveManager lm        = new LeaveManager();
            string       name      = ((User)Session["User"]).UserName;//Session["User"]
            int          UserId    = ((User)Session["User"]).UserId;
            List <Leave> listcount = lm.Where(x => x.UserId == UserId);

            ViewBag.UserCount = listcount.Count();
            UserManager um       = new UserManager();
            List <User> Userlist = um.GetAll();

            ViewData["Userlist"] = Userlist;
            return(View(listcount));
        }
Exemplo n.º 15
0
        public void ShouldAddLeaveThatIsNotADuplicateWithNoPublicHolidaysInBetweenTest()
        {
            uowMock.Setup(x => x.Leaves.GetWhere(It.IsAny <Expression <Func <Leave, bool> > >()))
            .Returns(new List <Leave>().AsQueryable());
            uowMock.Setup(x => x.PublicHolidays.GetWhere(It.IsAny <Expression <Func <PublicHoliday, bool> > >()))
            .Returns(new List <PublicHoliday>().AsQueryable());
            uowMock.Setup(x => x.Leaves.Add(It.IsAny <Leave>()));
            uowMock.Setup(x => x.Save()).Returns(1);
            var manager = new LeaveManager(uowMock.Object, publicHolidaysManager.Object);
            var results = manager.AddLeave(DataUtilities.GetMockedLeaveToAdd());

            uowMock.Verify(x => x.Leaves.Add(It.IsAny <Leave>()), Times.Once());
            uowMock.Verify(x => x.Save(), Times.Once());
        }
Exemplo n.º 16
0
        public ActionResult RcDisAgree(int id)
        {
            LeaveManager lm        = new LeaveManager();
            string       leaveover = "不批准";
            //int id = Convert.ToInt32(Request.QueryString["id"]);
            bool pd = lm.UpdateG(id, leaveover);

            if (pd)
            {
                return(Redirect("~/LiuXin/MangerLeave/TcAgree"));
            }
            else
            {
                return(Content("<script>alert('不允许批准');window.location.href='~/LiuXin/MangerLeave/TcAgree';</script>"));
            }
        }
        public async Task <ActionResult> Detail(int?id)
        {
            var leave = await LeaveManager.FindEntityByIdAsync(id ?? 0);

            if (leave == null)
            {
                return(View("Error", new[] { "找不到该信息" }));
            }
            var model = new LeaveDetailViewModel
            {
                Leave  = leave,
                Checks = leave.Checks
            };

            return(View(model));
        }
Exemplo n.º 18
0
        public ActionResult JLdisagree(int id)
        {
            LeaveManager lm        = new LeaveManager();
            string       leaveover = "不批准";
            bool         pdd       = lm.UpdateL(id, leaveover);

            if (pdd)
            {
                string leaveoline = "不可见";
                lm.UpdateC(id, leaveoline);
                return(Redirect("~/LiuXin/MangerLeave/Index"));
            }
            else
            {
                return(Content("<script>alert('不允许批准');window.location.href='~/LiuXin/MangerLeave/Index';</script>"));
            }
        }
Exemplo n.º 19
0
        public HttpResponseMessage AuditLeave(string token, string ccode)
        {
            string        errMsg = "";
            ReturnMessage msg    = new ReturnMessage();

            vouMag = (VoucherManager)HttpContext.Current.Application.Get(token);
            if (vouMag == null)
            {
                msg.Success = false;
                msg.Msg     = "参数token无效或已过期";
                msg.Code    = 500;
            }
            else
            {
                LeaveManager leaveMag = new LeaveManager(vouMag.UFDataConnstringForNet);
                int          i        = leaveMag.auditLeave(ccode, vouMag.cUserName, vouMag.cUserID, ref errMsg);
                if (i >= 2)
                {
                    msg.Success = true;
                    msg.Code    = 200;
                    dynamic c = new { code = ccode };
                    msg.Data = JsonConvert.SerializeObject(c);
                    msg.Msg  = "审核成功";
                }
                else
                {
                    msg.Success = false;
                    msg.Code    = 500;
                    msg.Msg     = "审核失败:" + errMsg;
                }
            }

            HttpContext.Current.Application.Remove(vouMag.GetGUID);
            string str = msg.ToJson();

            return(new HttpResponseMessage {
                Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
            });
        }
Exemplo n.º 20
0
        private void leafDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e)
        {
            if (leafBindingSource?.Current == null)
            {
                return;
            }
            if (leafDataGridView.Rows.Count <= 1)
            {
                return;
            }
            if (!leafDataGridView.IsCurrentRowDirty)
            {
                return;
            }
            Validate();
            ((Leaf)leafBindingSource.Current).EmployeeId = ((Empoyee)empoyeeBindingSource.Current).EmployeeId;
            leafBindingSource.EndEdit();
            var iResult = LeaveManager.Save((Leaf)leafBindingSource.Current);

            if (iResult > 0)
            {
                LoadInitLeaves();
            }
        }
Exemplo n.º 21
0
 private void LoadInitLeaves()
 {
     Cursor.Current = Cursors.WaitCursor;
     leafBindingSource.DataSource = LeaveManager.GetAll(((Empoyee)empoyeeBindingSource.Current).EmployeeId);
     Cursor.Current = Cursors.Default;
 }
 public SelfServiceController(EmployeeManager Emparam, ILeaveManagement lParam)
 {
     empManager       = Emparam;
     leaveRepo        = lParam;
     leavemanagerRepo = new LeaveManager(leaveRepo, empManager);
 }
Exemplo n.º 23
0
 public LeaveController(ILeaveManagement lParam, IBusinessUnits bparam)
 {
     leaveRepo        = lParam;
     BunitsRepo       = bparam;
     leavemanagerRepo = new LeaveManager(leaveRepo, new EmployeeManager());
 }
Exemplo n.º 24
0
        //[SwaggerResponse(HttpStatusCode.OK, Type = typeof(LeaveVoucher))]
        public HttpResponseMessage AddLeave(string token, string json)
        {
            string        errMsg = "";
            ReturnMessage msg    = new ReturnMessage();

            try
            {
                ReceiveLog receive = new ReceiveLog();
                receive.uuid          = Guid.NewGuid();
                receive.receiveData   = json;
                receive.interfaceCode = "Leave";
                receive.interfaceDesc = "请假单新增";
                receive.op            = "add";

                vouMag = (VoucherManager)HttpContext.Current.Application.Get(token);
                if (vouMag == null)
                {
                    msg.Success = false;
                    msg.Msg     = "参数token无效或已过期";
                    msg.Code    = 500;
                }
                else
                {
                    ReceiveLogManager logManager = new ReceiveLogManager(vouMag.UFDataConnstringForNet);
                    logManager.AddReceiveLog(receive, ref errMsg);
                    LeaveManager leaveMag = new LeaveManager(vouMag.UFDataConnstringForNet);
                    LeaveVoucher leave    = (LeaveVoucher)JsonConvert.DeserializeObject(json, typeof(LeaveVoucher));
                    int          i        = leaveMag.addLeave(leave, ref errMsg);
                    if (i >= 2)
                    {
                        //msg.Success = true;
                        //msg.Code = 200;
                        //dynamic c = new { code = leaveMag.ccode };
                        //msg.Data = JsonConvert.SerializeObject(c);
                        //msg.Msg = "新增成功";
                        int q = leaveMag.auditLeave(leaveMag.ccode, leave.head, ref errMsg);
                        if (q >= 2)
                        {
                            msg.Success = true;
                            msg.Code    = 200;
                            dynamic c = new { code = leaveMag.ccode };
                            msg.Data = JsonConvert.SerializeObject(c);
                            msg.Msg  = "审核成功";
                        }
                        else
                        {
                            msg.Success = false;
                            msg.Code    = 500;
                            msg.Msg     = "审核失败:" + errMsg;
                        }
                    }
                    else
                    {
                        msg.Success = false;
                        msg.Code    = 500;
                        msg.Msg     = "新增失败:" + errMsg;
                    }
                    receive = logManager.getReturnDesc(receive, msg);
                    logManager.UpdateReceiveLog(receive, ref errMsg);
                }

                HttpContext.Current.Application.Remove(vouMag.GetGUID);
                string str = msg.ToJson();
                return(new HttpResponseMessage {
                    Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
                });
            }
            catch (Exception ex)
            {
                msg.Success = false;
                msg.Code    = 500;
                msg.Msg     = ex.Message.ToString();
                string str = msg.ToJson();
                return(new HttpResponseMessage {
                    Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
                });
            }
        }
        public async Task <ActionResult> Apply(LeaveApplyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var userid = User.Identity.GetUserId();
                var user   = await UserManager.FindByIdAsync(userid);

                if (user.StudentInfo.BelongClass == null ||
                    user.StudentInfo.Dormitory == null ||
                    user.StudentInfo.HomeAddress == null ||
                    user.StudentInfo.PersonalTel == null)
                {
                    ModelState.AddModelError("", "请完善个人信息");
                    return(View(model));
                }

                if (!await LeaveManager.IsAllLeaveResumedAsync(userid))
                {
                    ModelState.AddModelError("", "还未销假");
                }
                else
                {
                    var config = await LeaveConfigManager.GetConfigAsync();

                    if (await LeaveManager.IsAllLeaveConditionMeeted(userid, config))
                    {
                        if (model.Category == LeaveCategory.病假)
                        {
                            if (model.TimeType == TimeType.一天以上)
                            {
                                if ((model.EndDate - model.StartDate).Days + 1 >= config.LeastSickLeaveDay)
                                {
                                    if (model.UploadFile == null)
                                    {
                                        ModelState.AddModelError("", "请上传图片附件");
                                        return(View(model));
                                    }
                                    else
                                    {
                                        //"E:\\MyPrivateProject\\StudentManageSystem\\LeaveSystem\\LeaveSystem.Web\\"
                                        var p = Server.MapPath("/UploadImageAttach/");
                                        if (!Directory.Exists(p))
                                        {
                                            Directory.CreateDirectory(p);
                                        }
                                        var t        = DateTime.Now.Ticks;
                                        var namea    = model.UploadFile.FileName.Split('\\');
                                        var name     = namea[namea.Length - 1];
                                        var filename = "/UploadImageAttach/" + t.ToString() + "_" +
                                                       name;

                                        model.UploadFile.SaveAs(p + t.ToString() + "_" + name);
                                        model.ImageUrls = filename;
                                    }
                                }
                            }
                        }

                        Leave leave = new Leave
                        {
                            Category    = model.Category,
                            StartDate   = model.StartDate,
                            EndDate     = model.EndDate,
                            ImageUrls   = model.ImageUrls,
                            OneDayTime  = model.OneDayTime,
                            OneDayStart = model.OneDayStart,
                            OneDayEnd   = model.OneDayEnd,
                            Reason      = model.Reason,
                            ToWhere     = model.ToWhere,
                            TimeType    = model.TimeType,
                            Student     = user.StudentInfo,
                            LeaveStatus = LeaveStatus.已提交,
                            AddTime     = DateTime.Now,
                            ResumeTime  = DateTime.Now,
                            IsResume    = 0,
                        };
                        leave.Checks = new List <Check>();
                        var classHeadTeacher = user.StudentInfo.BelongClass.ClassTeacher;
                        leave.Checks.Add(new Check()
                        {
                            CheckTeacher = classHeadTeacher,
                            CheckOrder   = 0,
                            CheckStatus  = CheckStatus.未查看,
                            CheckTime    = DateTime.Now,
                            AddTime      = DateTime.Now
                        });
                        if (model.TimeType == TimeType.一天以上)
                        {
                            if ((model.EndDate - model.StartDate).Days > config.LeastDayToSign)
                            {
                                var clerk = config.ClerkTeacher;
                                leave.Checks.Add(new Check()
                                {
                                    CheckTeacher = clerk.Teacher.TeacherInfo,
                                    CheckOrder   = 1,
                                    CheckStatus  = CheckStatus.未查看,
                                    CheckTime    = DateTime.Now,
                                    AddTime      = DateTime.Now
                                });
                            }
                        }
                        await LeaveManager.AddEntityAsync(leave);

                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "请假添加不符合");
                    }
                }
            }
            return(View(model));
        }
        public async Task <ActionResult> AddLeaveImages(AddLeaveImagesViewModel omodel)
        {
            if (ModelState.IsValid)
            {
                if (Session["TempLeave"] == null)
                {
                    return(View("Error", new[] { "请按照流程" }));
                }
                var model = Session["TempLeave"] as LeaveApplyViewModel;
                if (model == null)
                {
                    return(View("Error", new[] { "请按照流程" }));
                }
                model.ImageUrls = omodel.ImagesUrl;
                var userid = User.Identity.GetUserId();
                var user   = await UserManager.FindByIdAsync(userid);

                var config = await LeaveConfigManager.GetConfigAsync();

                Leave leave = new Leave
                {
                    Category    = model.Category,
                    StartDate   = model.StartDate,
                    EndDate     = model.EndDate,
                    ImageUrls   = model.ImageUrls,
                    OneDayTime  = model.OneDayTime,
                    OneDayStart = model.OneDayStart,
                    OneDayEnd   = model.OneDayEnd,
                    Reason      = model.Reason,
                    ToWhere     = model.ToWhere,
                    TimeType    = model.TimeType,
                    //UserId = userid,
                    LeaveStatus = LeaveStatus.已提交,
                    AddTime     = DateTime.Now,
                    ResumeTime  = DateTime.Now,
                    IsResume    = 0,
                };
                leave.Checks = new Check[] { };
                var classHeadTeacher = user.StudentInfo.BelongClass.ClassTeacher;
                leave.Checks.Add(new Check()
                {
                    CheckTeacher = classHeadTeacher,
                    CheckOrder   = 0,
                    CheckStatus  = CheckStatus.未查看,
                    CheckTime    = DateTime.Now,
                    CheckOpinion = ""
                });
                if (model.TimeType == TimeType.一天以上)
                {
                    if ((model.EndDate - model.StartDate).Days > config.LeastDayToSign)
                    {
                        var clerk = config.ClerkTeacher;
                        leave.Checks.Add(new Check()
                        {
                            CheckTeacher = clerk.Teacher.TeacherInfo,
                            CheckOrder   = 1,
                            CheckStatus  = CheckStatus.未查看,
                            CheckTime    = DateTime.Now,
                            CheckOpinion = ""
                        });
                    }
                }
                await LeaveManager.AddEntityAsync(leave);

                return(RedirectToAction("Index"));
            }
            return(View(omodel));
        }