Esempio n. 1
0
        public ActionResult AddApplyCar(Models.ApplyCar.ApplyCarEditModel vm)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var error = new List <string>();
                if (error.Count == decimal.Zero)
                {
                    //审批内容表记录
                    var tb = new Wechat.Entity.tbWeOAApplyCar();
                    tb.CarTime       = vm.ApplyCarEditDto.CarTime;
                    tb.Destination   = vm.ApplyCarEditDto.Destination;
                    tb.OtherUsers    = vm.ApplyCarEditDto.OtherUsers;
                    tb.Remark        = vm.ApplyCarEditDto.Remark;
                    tb.tbTeacherDept = db.Set <Teacher.Entity.tbTeacherDept>().Find(vm.ApplyCarEditDto.tbTeacherDeptId);
                    db.Set <Wechat.Entity.tbWeOAApplyCar>().Add(tb);
                    db.SaveChanges();

                    //执行流程引擎
                    OAWeWorkFlow.ExecuteWorkFlowEngine(db, flowTypeCode, tb.Id, "", "发起流程", false, vm.ApplyCarEditDto.NextApproveUserId);
                }
                else
                {
                    return(Content(string.Join("\r\n", error)));//不提交文件表单的方式
                }
                return(Code.MvcHelper.Post(error, Url.Action("ApplyCarIndex")));
            }
        }
Esempio n. 2
0
 public ActionResult RejectWorkFlow(int approveBodyId = 0, string conditionalFormula = "", string approveOpinion = "")
 {
     using (var db = new XkSystem.Models.DbContext())
     {
         OAWeWorkFlow.ExecuteWorkFlowEngine(db, flowTypeCode, approveBodyId, conditionalFormula, approveOpinion, true);
     }
     return(Content("<script type='text/javascript'> window.parent.location.href = '" + Url.Action("ApplyCarIndex", "ApplyCar", new { area = "wechat" }) + "';</script>"));
 }
Esempio n. 3
0
        public ActionResult AddOffice(Models.Office.OfficeEditModel vm)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                if (string.IsNullOrEmpty(vm.OfficeEditDto.OfficeFileName) && !string.IsNullOrEmpty(vm.OfficeEditDto.FileContent))
                {
                    ModelState.Remove("OfficeEditDto.OfficeFileName");
                }
                else if (!string.IsNullOrEmpty(vm.OfficeEditDto.OfficeFileName) && string.IsNullOrEmpty(vm.OfficeEditDto.FileContent))
                {
                    ModelState.Remove("OfficeEditDto.FileContent");
                }
                else if (string.IsNullOrEmpty(vm.OfficeEditDto.OfficeFileName) && string.IsNullOrEmpty(vm.OfficeEditDto.FileContent))
                {
                    ModelState.Remove("OfficeEditDto.FileContent");
                }
                var error = new List <string>();
                if (error.Count == decimal.Zero)
                {
                    //保存附件,rar,word(doc),pdf
                    string FileName = string.Empty;
                    if (!string.IsNullOrEmpty(vm.OfficeEditDto.OfficeFileName))
                    {
                        var file   = Request.Files[nameof(vm.OfficeEditDto) + "." + nameof(vm.OfficeEditDto.OfficeFileName)];
                        var suffix = file.FileName.Substring(file.FileName.LastIndexOf("."));
                        FileName = System.IO.Path.GetRandomFileName().Replace(".", string.Empty) + suffix;
                        vm.OfficeEditDto.OfficeFileName = file.FileName;
                        file.SaveAs(Server.MapPath("~/Files/OfficeFile/") + FileName);
                    }

                    //审批内容表记录
                    var tb = new Wechat.Entity.tbWeOAOffice();
                    tb.OfficeFileFrom    = vm.OfficeEditDto.OfficeFileFrom;
                    tb.OfficeFileName    = vm.OfficeEditDto.OfficeFileName;
                    tb.OfficeFileNameSeq = FileName;
                    tb.ReceiveFileTime   = vm.OfficeEditDto.ReceiveFileTime;
                    tb.Title             = vm.OfficeEditDto.Title;
                    tb.FileContent       = vm.OfficeEditDto.FileContent;
                    tb.LimitDateTo       = vm.OfficeEditDto.LimitDateTo;
                    db.Set <Wechat.Entity.tbWeOAOffice>().Add(tb);
                    db.SaveChanges();

                    //执行流程引擎
                    OAWeWorkFlow.ExecuteWorkFlowEngine(db, flowTypeCode, tb.Id, "", "发起流程", false, vm.OfficeEditDto.NextApproveUserId);
                }
                else
                {
                    vm.ErrorMsg = string.Join("\r\n", error);
                    return(View(vm));//包含文件表单的方式
                }
                return(Content("<script type='text/javascript'> window.parent.location.href = '" + Url.Action("OfficeIndex", "Office", new { area = "wechat" }) + "';</script>"));
            }
        }
Esempio n. 4
0
        public ActionResult AddApplyLeave(Models.ApplyLeave.ApplyLeaveEditModel vm)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var error = new List <string>();
                if (error.Count == decimal.Zero)
                {
                    //审批内容表记录
                    var tb = new Wechat.Entity.tbWeOAApplyLeave();
                    tb.CaseFileName    = vm.ApplyLeaveEditDto.CaseFileName;
                    tb.LeaveDayCount   = vm.ApplyLeaveEditDto.LeaveDayCount;
                    tb.LeaveFromTime   = vm.ApplyLeaveEditDto.LeaveFromTime;
                    tb.LeaveToTime     = vm.ApplyLeaveEditDto.LeaveToTime;
                    tb.Reason          = vm.ApplyLeaveEditDto.Reason;
                    tb.tbWeOALeaveType = db.Set <Wechat.Entity.tbWeOALeaveType>().Find(vm.ApplyLeaveEditDto.tbWeOALeaveTypeId);
                    tb.tbTeacherDept   = db.Set <Teacher.Entity.tbTeacherDept>().Find(vm.ApplyLeaveEditDto.tbTeacherDeptId);
                    db.Set <Wechat.Entity.tbWeOAApplyLeave>().Add(tb);
                    db.SaveChanges();

                    if (vm.ApplyLeaveEditDto.LeaveDayCount <= 0.5)
                    {
                        vm.ApplyLeaveEditDto.ConditionalFormula = "day=0.5";
                    }
                    else if (vm.ApplyLeaveEditDto.LeaveDayCount <= 2 && vm.ApplyLeaveEditDto.LeaveDayCount > 0.5)
                    {
                        vm.ApplyLeaveEditDto.ConditionalFormula = "day<=2&day>0.5";
                    }
                    else if (vm.ApplyLeaveEditDto.LeaveDayCount >= 3)
                    {
                        vm.ApplyLeaveEditDto.ConditionalFormula = "day>=3";
                    }

                    //执行流程引擎
                    OAWeWorkFlow.ExecuteWorkFlowEngine(db, flowTypeCode, tb.Id, vm.ApplyLeaveEditDto.ConditionalFormula, "发起流程", false, vm.ApplyLeaveEditDto.NextApproveUserId);
                }
                else
                {
                    vm.ErrorMsg = string.Join("\r\n", error);
                    return(View(vm));//包含文件表单的方式
                }
                return(Content("<script type='text/javascript'> window.parent.location.href = '" + Url.Action("ApplyLeaveIndex", "ApplyLeave", new { area = "wechat" }) + "';</script>"));
            }
        }