public ActionResult eventSchedule(string id = "") { vwEventSchedule model = new vwEventSchedule(); model.user = ctx.getCurrentUser(User.Identity.Name); prepareEventScheduleViewBag(); if (id == "") { model.id = ""; model.billDate = ctx.getLocalTiime(); model.beginDate = ctx.getLocalTiime(); model.endDate = ctx.getLocalTiime(); } else { EventSchedule eventObj = ctx.eventScheduleList.Where(x => x.id == id).FirstOrDefault(); FlowMain fmain = ctx.FlowMainList.Where(x => x.id == eventObj.flowId).FirstOrDefault(); model.id = eventObj.id; model.billNo = fmain.billNo; model.flowId = fmain.id; model.billDate = fmain.billDate; model.beginHH = eventObj.beginHH; model.beginMM = eventObj.beginMM; model.endHH = eventObj.endHH; model.endMM = eventObj.endMM; model.beginDate = eventObj.beginDate; model.endDate = eventObj.endDate; model.subject = eventObj.subject; model.location = eventObj.location; model.eventType = eventObj.eventType; model.sMemo = eventObj.sMemo; model.colorTag = eventObj.colorTag; } return(View(model)); }
public async Task <ActionResult> reqInHouse(vwReqInHouse Model) { Model.user = ctx.getCurrentUser(User.Identity.Name); ViewBag.userList = ctx.getUserList(); ViewBag.depList = ctx.getDepList(); #region "checkinput" List <string> errList = new List <string>(); var context = new ApplicationDbContext(); if (!ModelState.IsValid) { return(View(Model)); } #endregion #region "FlowWork" string FlowDefKey = "ReqInHouse"; FlowMain fmain = new FlowMain(); List <FlowSub> fsublist = new List <FlowSub>(); FlowDefMain fDefMain = context.FlowDefMainList.Where(x => x.enm == FlowDefKey).FirstOrDefault(); List <FlowDefSub> fDefSubList = new List <FlowDefSub>(); if (fDefMain != null) { fDefSubList = context.FlowDefSubList.Where(x => x.pid == fDefMain.id).OrderBy(x => x.seq).ToList <FlowDefSub>(); } var sender = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault(); fmain.billNo = ctx.genBillNo(FlowDefKey); fmain.id = Guid.NewGuid().ToString(); fmain.defId = FlowDefKey; fmain.flowName = fDefMain.nm; fmain.flowStatus = 1; fmain.senderNo = sender.workNo; fmain.billDate = context.getLocalTiime(); context.FlowMainList.Add(fmain); ReqInHouse fmObj = new ReqInHouse { contact = Model.contact, depNo = Model.depNo, reqLimit = Model.reqLimit, reqMemo = Model.reqMemo, id = Guid.NewGuid().ToString(), flowId = fmain.id }; context.reqInHouseList.Add(fmObj); int flowSeq = 1; dbHelper dbh = new dbHelper(); string senderPoNo = dbh.sql2Str("select poNo from PoUsers where UserId='" + sender.workNo + "' and ApplicationUser_Id is not null"); string senderMgrNo = ""; List <string> signerList = new List <string>(); if (!string.IsNullOrEmpty(senderPoNo)) { string senderDepNo = dbh.sql2Str("select depNo from jobPoes where poNo='" + senderPoNo + "'"); if (!string.IsNullOrEmpty(senderDepNo)) { dep depObj = context.deps.Where(x => x.depNo == senderDepNo).FirstOrDefault(); signerList = getDepSigner(context, depObj, sender.workNo, signerList); } } foreach (string signer in signerList) { FlowSub fsub = new FlowSub(); fsub.pid = fmain.id; fsub.id = Guid.NewGuid().ToString(); fsub.seq = flowSeq; fsub.workNo = signer; fsub.signType = 1; fsub.signResult = 0; flowSeq++; context.FlowSubList.Add(fsub); } foreach (FlowDefSub defItem in fDefSubList) { if (defItem.workNo != senderMgrNo && signerList.Where(x => x == defItem.workNo).Count() == 0 && defItem.workNo != sender.workNo) { FlowSub fsub = new FlowSub(); fsub.pid = fmain.id; fsub.id = Guid.NewGuid().ToString(); fsub.seq = flowSeq; fsub.workNo = defItem.workNo; fsub.signType = defItem.signType; fsub.signResult = 0; flowSeq++; context.FlowSubList.Add(fsub); signerList.Add(defItem.workNo); } } #endregion try { context.SaveChanges(); StringBuilder sb = new StringBuilder(); sb.Append("您好," + "<br/><br/>"); sb.Append(sender.workNo + " " + sender.cName + " 送出廠務派工及總務需求申請單:" + fmain.billNo + "<br/><br/>"); sb.AppendFormat("<a href='{0}'>{1}</a><br/>", Url.Action("Details", "FormMgr", new RouteValueDictionary(new { id = fmain.id }), HttpContext.Request.Url.Scheme, HttpContext.Request.Url.Authority), "單據網址" ); sb.Append("<br/>此信件為系統發出,請勿直接回信<br/>"); foreach (string signer in signerList) { vwEmployee emp = ctx.getUserByWorkNo(signer); if (!string.IsNullOrEmpty(emp.Email)) { List <EmailAddress> mailList = new List <EmailAddress>(); mailList.Add(new EmailAddress { Email = emp.Email, Name = emp.workNo + " " + emp.UserCName }); await SendGridSrv.sendEmail(mailList, "廠務派工及總務需求申請單", sb.ToString()); } } return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(Model)); } }
public async Task <ActionResult> eventSchedule(vwEventSchedule model) { model.user = ctx.getCurrentUser(User.Identity.Name); prepareEventScheduleViewBag(); if (!ModelState.IsValid) { return(View(model)); } try { DateTime _dt = Convert.ToDateTime(model.billDate); } catch (Exception ex) { ModelState.AddModelError("billDate", "請輸入正確日期格式"); return(View(model)); } var sender = ctx.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault(); FlowMain fmain = new FlowMain(); if (string.IsNullOrEmpty(model.id)) { #region "FlowWork" string FlowDefKey = "EventSchedule"; List <FlowSub> fsublist = new List <FlowSub>(); FlowDefMain fDefMain = ctx.FlowDefMainList.Where(x => x.enm == FlowDefKey).FirstOrDefault(); List <FlowDefSub> fDefSubList = new List <FlowDefSub>(); if (fDefMain != null) { fDefSubList = ctx.FlowDefSubList.Where(x => x.pid == fDefMain.id).OrderBy(x => x.seq).ToList <FlowDefSub>(); } fmain.billNo = ctx.genBillNo(FlowDefKey); fmain.id = Guid.NewGuid().ToString(); fmain.defId = FlowDefKey; fmain.flowName = fDefMain.nm; fmain.flowStatus = 1; fmain.senderNo = sender.workNo; fmain.billDate = model.billDate; ctx.FlowMainList.Add(fmain); EventSchedule fmObj = new EventSchedule { id = Guid.NewGuid().ToString(), flowId = fmain.id, subject = model.subject, location = model.location, beginHH = model.beginHH, beginMM = model.beginMM, endHH = model.endHH, endMM = model.endMM, beginDate = model.beginDate, endDate = model.endDate, eventType = model.eventType, sMemo = model.sMemo, colorTag = model.colorTag }; ctx.eventScheduleList.Add(fmObj); int flowSeq = 1; dbHelper dbh = new dbHelper(); string senderPoNo = dbh.sql2Str("select poNo from PoUsers where UserId='" + sender.workNo + "' and ApplicationUser_Id is not null"); string senderMgrNo = ""; List <string> signerList = new List <string>(); if (!string.IsNullOrEmpty(senderPoNo)) { string senderDepNo = dbh.sql2Str("select depNo from jobPoes where poNo='" + senderPoNo + "'"); if (!string.IsNullOrEmpty(senderDepNo)) { dep depObj = ctx.deps.Where(x => x.depNo == senderDepNo).FirstOrDefault(); signerList = getDepSigner(ctx, depObj, sender.workNo, signerList); } } foreach (string signer in signerList) { FlowSub fsub = new FlowSub(); fsub.pid = fmain.id; fsub.id = Guid.NewGuid().ToString(); fsub.seq = flowSeq; fsub.workNo = signer; fsub.signType = 1; fsub.signResult = 0; flowSeq++; ctx.FlowSubList.Add(fsub); } foreach (FlowDefSub defItem in fDefSubList) { if (defItem.workNo != senderMgrNo && signerList.Where(x => x == defItem.workNo).Count() == 0 && defItem.workNo != sender.workNo) { FlowSub fsub = new FlowSub(); fsub.pid = fmain.id; fsub.id = Guid.NewGuid().ToString(); fsub.seq = flowSeq; fsub.workNo = defItem.workNo; fsub.signType = defItem.signType; fsub.signResult = 0; flowSeq++; ctx.FlowSubList.Add(fsub); signerList.Add(defItem.workNo); } } #endregion try { ctx.SaveChanges(); StringBuilder sb = new StringBuilder(); sb.Append("您好," + "<br/><br/>"); if (model.eventType == 1) { sb.Append(sender.workNo + " " + sender.cName + " 送出業務拜訪行程:" + fmain.billNo + "<br/><br/>"); } else { sb.Append(sender.workNo + " " + sender.cName + " 送出公司行程/活動:" + fmain.billNo + "<br/><br/>"); } sb.AppendFormat("<a href='{0}'>{1}</a><br/>", Url.Action("Details", "FormMgr", new RouteValueDictionary(new { id = fmain.id }), HttpContext.Request.Url.Scheme, HttpContext.Request.Url.Authority), "單據網址" ); sb.Append("<br/>此信件為系統發出,請勿直接回信<br/>"); foreach (string signer in signerList) { vwEmployee emp = ctx.getUserByWorkNo(signer); if (!string.IsNullOrEmpty(emp.Email)) { List <EmailAddress> mailList = new List <EmailAddress>(); mailList.Add(new EmailAddress { Email = emp.Email, Name = emp.workNo + " " + emp.UserCName }); await SendGridSrv.sendEmail(mailList, "公司行程規劃通知", sb.ToString()); } } return(RedirectToAction("ListEventSchedule")); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(model)); } } else { fmain = ctx.FlowMainList.Where(x => x.id == model.flowId).FirstOrDefault(); EventSchedule eventObj = ctx.eventScheduleList.Where(x => x.id == model.id).FirstOrDefault(); eventObj.subject = model.subject; eventObj.location = model.location; eventObj.beginHH = model.beginHH; eventObj.beginMM = model.beginMM; eventObj.endHH = model.endHH; eventObj.endMM = model.endMM; eventObj.beginDate = model.beginDate; eventObj.endDate = model.endDate; eventObj.eventType = model.eventType; eventObj.sMemo = model.sMemo; eventObj.colorTag = model.colorTag; ctx.SaveChanges(); return(RedirectToAction("Details", "Form", new { @id = model.flowId })); } }
public ActionResult Details(string id, string FlowPageType = "", string ReturnAction = "") { var store = new UserStore <ApplicationUser>(ctx); var manager = new UserManager <ApplicationUser>(store); var user = manager.FindByName(User.Identity.Name); var roleStore = new RoleStore <ApplicationRole>(ctx); var roleManager = new RoleManager <ApplicationRole>(roleStore); bool isAdmin = false; FlowMain fmain = ctx.FlowMainList.Where(x => x.id == id).FirstOrDefault(); ViewBag.flowMain = fmain; vwEmployee employee = ctx.getUserByWorkNo(fmain.senderNo); ViewBag.Employee = employee; foreach (var role in roleManager.Roles) { if (user.Roles.Where(x => x.RoleId == role.Id && role.Name.ToUpper() == "ADMIN").Count() > 0) { isAdmin = true; break; } } if (!isAdmin && fmain.defId != "EventSchedule") { if (ctx.FlowSubList.Where(x => x.pid == id && x.workNo == User.Identity.Name).Count() == 0) { return(RedirectToAction("AccessDenied", "Account")); } } if (ctx.FlowSubList.Where(x => x.pid == id && x.workNo == User.Identity.Name && x.signType == 701).Count() > 0) { FlowPageType = "HRCheck"; } if (FlowPageType == "") { FlowPageType = fmain.defId == "EventSchedule" ? "EventSchedule" : ""; } var context = new ApplicationDbContext(); ViewBag.FlowPageType = FlowPageType; ViewBag.ReturnAction = ReturnAction; List <vwFlowSub> list = new List <vwFlowSub>(); List <FlowSub> fsubList = context.FlowSubList.Where(x => x.pid == id).OrderBy(x => x.seq).ToList <FlowSub>(); foreach (FlowSub sitem in fsubList) { var signResultObj = context.signResultList().Where(x => x.id == sitem.signResult).FirstOrDefault(); var signTypeObj = context.signTypeList().Where(x => x.id == sitem.signType).FirstOrDefault(); var signUser = context.Users.Where(x => x.workNo == sitem.workNo).FirstOrDefault(); vwFlowSub item = new vwFlowSub { id = sitem.id, seq = sitem.seq, signDate = sitem.signDate, signResult = signResultObj == null ? "" : signResultObj.nm, signType = signTypeObj == null ? "會簽" : signTypeObj.nm, signer = signUser == null ? "" : signUser.workNo + "-" + signUser.cName, comment = sitem.comment }; list.Add(item); } #region "非工作時間廠務申請單" if (fmain.defId == "OverTime") { fmain.flowName += "(P016A1)"; ReqOverTime reqOverTimeObj = context.reqOverTimeList.Where(x => x.flowId == id).FirstOrDefault(); vwReqOverTime vwReqOverTimeObj = null; if (reqOverTimeObj != null) { vwReqOverTimeObj = new vwReqOverTime { billNo = fmain.billNo, dtBegin = reqOverTimeObj.dtBegin, dtEnd = reqOverTimeObj.dtEnd, hours = reqOverTimeObj.hours, sMemo = reqOverTimeObj.sMemo }; JObject jobjext = null; try { jobjext = JObject.Parse(reqOverTimeObj.jext); vwReqOverTimeObj.sType = jobjext["stype"] == null ? "" : jobjext["stype"].ToString(); vwReqOverTimeObj.place = jobjext["place"] == null ? "" : jobjext["place"].ToString(); vwReqOverTimeObj.otherPlace = jobjext["otherPlace"] == null ? "" : jobjext["otherPlace"].ToString(); vwReqOverTimeObj.prjId = jobjext["prjId"] == null ? "" : jobjext["prjId"].ToString(); vwReqOverTimeObj.sMemo2 = jobjext["sMemo2"] == null ? "" : jobjext["sMemo2"].ToString(); vwReqOverTimeObj.worker = jobjext["worker"] == null ? "" : jobjext["worker"].ToString(); vwReqOverTimeObj.depNo = jobjext["depNo"] == null ? "" : jobjext["depNo"].ToString(); vwReqOverTimeObj.poNo = jobjext["poNo"] == null ? "" : jobjext["poNo"].ToString(); vwReqOverTimeObj.poNm = jobjext["poNo"] == null ? "" : context.jobPos.Where(x => x.poNo.Equals(vwReqOverTimeObj.poNo)).FirstOrDefault().poNm; jobPo poObj = context.jobPos.Where(x => x.poNo == vwReqOverTimeObj.poNo).First(); string depNo = poObj.depNo; string depNm = context.getParentDeps(depNo, context) + " : " + poObj.poNm; vwReqOverTimeObj.depNm = depNm; } catch (Exception ex) { } } ViewBag.SubModel = vwReqOverTimeObj; return(View(list)); } #endregion #region "加班單" if (fmain.defId == "RealOverTime") { fmain.flowName += "(P017A1)"; ReqOverTime reqOverTimeObj = context.reqOverTimeList.Where(x => x.flowId == id).FirstOrDefault(); vwRealOverTime vwReqOverTimeObj = null; if (reqOverTimeObj != null) { vwReqOverTimeObj = new vwRealOverTime { user = ctx.getUserByWorkNo(fmain.senderNo), billNo = fmain.billNo, dtBegin = reqOverTimeObj.dtBegin, dtEnd = reqOverTimeObj.dtEnd, hours = reqOverTimeObj.hours, sMemo = reqOverTimeObj.sMemo }; JObject jobjext = null; try { jobjext = JObject.Parse(reqOverTimeObj.jext); vwReqOverTimeObj.sMemo2 = jobjext["sMemo2"] == null ? "" : jobjext["sMemo2"].ToString(); } catch (Exception ex) { } } ViewBag.SubModel = vwReqOverTimeObj; return(View(list)); } #endregion #region "請假單" if (fmain.defId == "DayOff") { fmain.flowName += "(P018A1)"; vwDayOffForm subModel = new vwDayOffForm(); dayOff dayOffObj = ctx.dayOffList.Where(x => x.flowId == fmain.id).FirstOrDefault(); subModel.dayOffForm = new vwdayOff { id = dayOffObj.id, billNo = fmain.billNo, dtBegin = dayOffObj.dtBegin, dtEnd = dayOffObj.dtEnd, hours = dayOffObj.hours, dType = dayOffObj.dType, sMemo = dayOffObj.sMemo, jobAgent = dayOffObj.jobAgent }; ViewBag.SubModel = subModel; return(View("Details", list)); } #endregion #region "外出申請單" if (fmain.defId == "PublicOut") { fmain.flowName += "(P019A1)"; publicOut publicOutObj = ctx.publicOutList.Where(x => x.flowId == fmain.id).FirstOrDefault(); vwPublicOut subModel = new vwPublicOut { id = publicOutObj.id, billNo = fmain.billNo, user = ctx.getUserByWorkNo(fmain.senderNo), requestDate = publicOutObj.requestDate, dtBegin = publicOutObj.dtBegin, dtEnd = publicOutObj.dtEnd, subject = publicOutObj.subject, destination = publicOutObj.destination, transport = publicOutObj.transport }; ViewBag.SubModel = subModel; return(View("Details", list)); } #endregion #region "訪客申請單" if (fmain.defId == "GuestForm") { fmain.flowName += "(P011A1)"; guestForm formObj = ctx.guestFormList.Where(x => x.flowId == fmain.id).FirstOrDefault(); vwGuestForm subModel = new vwGuestForm { id = formObj.id, user = ctx.getUserByWorkNo(fmain.senderNo), requestDate = formObj.requestDate, dtBegin = formObj.dtBegin, dtEnd = formObj.dtEnd, subject = formObj.subject, to = formObj.to, toDep = formObj.toDep, guestCmp = formObj.guestCmp, guestName = formObj.guestName, guestCnt = formObj.guestCnt, cellPhone = formObj.cellPhone, area1 = formObj.area1, area2 = formObj.area2, area21 = formObj.area21, area3 = formObj.area3, area4 = formObj.area4, area41 = formObj.area41, sMemo = formObj.sMemo }; ViewBag.SubModel = subModel; return(View("Details", list)); } #endregion #region "廠務派工及總務需求申請單" if (fmain.defId == "ReqInHouse") { fmain.flowName += "(P020A1)"; ReqInHouse formObj = ctx.reqInHouseList.Where(x => x.flowId == fmain.id).FirstOrDefault(); vwReqInHouse subModel = new vwReqInHouse { id = formObj.id, user = ctx.getUserByWorkNo(fmain.senderNo), billDate = fmain.billDate, contact = formObj.contact, depNo = formObj.depNo, reqLimit = formObj.reqLimit, reqMemo = formObj.reqMemo, sMemo = formObj.sMemo }; ViewBag.SubModel = subModel; return(View("Details", list)); } #endregion #region "公司行程規劃表" if (fmain.defId == "EventSchedule") { fmain.flowName += "(B001A1)"; EventSchedule formObj = ctx.eventScheduleList.Where(x => x.flowId == fmain.id).FirstOrDefault(); vwEventSchedule subModel = new vwEventSchedule { id = formObj.id, user = ctx.getUserByWorkNo(fmain.senderNo), billDate = fmain.billDate, beginHH = formObj.beginHH, beginMM = formObj.beginMM, subject = formObj.subject, location = formObj.location, eventType = formObj.eventType, sMemo = formObj.sMemo }; ViewBag.SubModel = subModel; return(View("Details", list)); } #endregion return(View(list)); }
public ActionResult SignIt(FormCollection collection) { var context = new ApplicationDbContext(); string id = collection["hid"].ToString(); string signValue = collection["signValue"].ToString(); string signMemo = collection["signMemo"].ToString(); string workNo = context.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault().workNo; FlowSub fsub = context.FlowSubList.Where(x => x.pid == id && x.workNo == workNo && x.signType != 701).FirstOrDefault(); FlowMain fmain = ctx.FlowMainList.Where(x => x.id == id).FirstOrDefault(); bool bIsGmDep = false; bIsGmDep = isGmDep(workNo); if (fsub != null && fmain != null) { if (fmain.defId == "OverTime") { fsub.signDate = context.getLocalTiime(); fsub.signResult = Convert.ToInt16(signValue); fsub.comment = signMemo; context.SaveChanges(); dbHelper dbh = new dbHelper(); if (fsub.signResult == 1) { dbh.execSql("update FlowMains set flowStatus=2 where id='" + id + "'"); } if (fsub.signResult == 2) { dbh.execSql("update FlowMains set flowStatus=3 where id='" + id + "'"); } } if (fmain.defId == "RealOverTime") { if (fsub.signType != 3 && (!bIsGmDep)) { List <FlowSub> qPriorSigner = ctx.FlowSubList.Where(x => x.pid == id && x.signType != 701 && x.seq < fsub.seq && x.signResult == 0).ToList <FlowSub>(); if (qPriorSigner.Count() > 0) { TempData["error"] = "上一位簽核人尚未簽核"; return(RedirectToAction("Details", "FormMgr", new { id = fmain.id })); } } fsub.signDate = context.getLocalTiime(); fsub.signResult = Convert.ToInt16(signValue); fsub.comment = signMemo; context.SaveChanges(); dbHelper dbh = new dbHelper(); var fsublist = ctx.FlowSubList.Where(x => x.pid == id && x.signType != 701); if (fsub.signResult == 1 && (fsublist.Where(x => x.signResult == 1).Count() == fsublist.Count() || bIsGmDep) ) { dbh.execSql("update FlowMains set flowStatus=2 where id='" + id + "'"); } if (fsub.signResult == 2) { dbh.execSql("update FlowMains set flowStatus=3 where id='" + id + "'"); } } if (fmain.defId == "DayOff") { if (fsub.signType != 3 && (!bIsGmDep)) { List <FlowSub> qPriorSigner = ctx.FlowSubList.Where(x => x.pid == id && x.signType != 701 && x.seq < fsub.seq && x.signResult == 0).ToList <FlowSub>(); if (qPriorSigner.Count() > 0) { TempData["error"] = "上一位簽核人尚未簽核"; return(RedirectToAction("Details", "FormMgr", new { id = fmain.id })); } } fsub.signDate = context.getLocalTiime(); fsub.signResult = Convert.ToInt16(signValue); fsub.comment = signMemo; context.SaveChanges(); dbHelper dbh = new dbHelper(); var fsublist = ctx.FlowSubList.Where(x => x.pid == id && x.signType != 701); if (fsub.signResult == 1 && (fsublist.Where(x => x.signResult == 1).Count() == fsublist.Count() || bIsGmDep) ) { dbh.execSql("update FlowMains set flowStatus=2 where id='" + id + "'"); } if (fsub.signResult == 2) { dbh.execSql("update FlowMains set flowStatus=3 where id='" + id + "'"); } } if (fmain.defId == "PublicOut") { fsub.signDate = context.getLocalTiime(); fsub.signResult = Convert.ToInt16(signValue); fsub.comment = signMemo; context.SaveChanges(); dbHelper dbh = new dbHelper(); if (fsub.signResult == 1) { dbh.execSql("update FlowMains set flowStatus=2 where id='" + id + "'"); } if (fsub.signResult == 2) { dbh.execSql("update FlowMains set flowStatus=3 where id='" + id + "'"); } } if (fmain.defId == "GuestForm") { fsub.signDate = context.getLocalTiime(); fsub.signResult = Convert.ToInt16(signValue); fsub.comment = signMemo; context.SaveChanges(); dbHelper dbh = new dbHelper(); if (fsub.signResult == 1) { dbh.execSql("update FlowMains set flowStatus=2 where id='" + id + "'"); } if (fsub.signResult == 2) { dbh.execSql("update FlowMains set flowStatus=3 where id='" + id + "'"); } } if (fmain.defId == "ReqInHouse") { fsub.signDate = context.getLocalTiime(); fsub.signResult = Convert.ToInt16(signValue); fsub.comment = signMemo; context.SaveChanges(); dbHelper dbh = new dbHelper(); if (fsub.signResult == 1) { dbh.execSql("update FlowMains set flowStatus=2 where id='" + id + "'"); } if (fsub.signResult == 2) { dbh.execSql("update FlowMains set flowStatus=3 where id='" + id + "'"); } } if (fsub.signResult == 1) { dbHelper dbh = new dbHelper(); try { dbh.execSql("update FlowMains set signDate='" + ctx.getLocalTiime().ToString("yyyy-MM-dd HH:mm:ss") + "' where id='" + id + "'"); } catch (Exception ex) { } } } return(RedirectToAction("Index", "FormMgr")); }