public ActionResult updProcess3(int?id, string status) { try { //ViewBag.MenuId = menuId; //HttpUtility.UrlDecode(m); _repo.PostProcessReset3(); EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Settlement NAP Processing Lock Reset"); TempData["msg"] = "Record Updated Successfully"; return(View("Index")); } catch (SqlException ex) { TempData["msg"] = "Problem Updating Record."; return(View("Index")); } catch (Exception ex) { TempData["msg"] = "Problem Updating Record."; return(View("Index")); } }
public ActionResult Reject(decimal AuthId, int?m, string Narration) { try { var rec2 = repoAuth.Find(AuthId); if (rec2 == null) { respMsg = "Problem processing request. Try again or contact Administrator."; //TempData["msg"] = respMsg; //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(rec2.ITBID.ToString()), m = SmartObj.Encrypt(rec2.MENUID.GetValueOrDefault().ToString()) }); return(Json(new { RespCode = 1, RespMessage = respMsg })); } else if (rec2.STATUS.ToLower() != "open") { respMsg = "This request has already been processed by an authorizer."; //TempData["msg"] = respMsg; //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()), m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) }); return(Json(new { RespCode = 1, RespMessage = respMsg })); } int recordId = 0; // bool suc = false; //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew)) //{ var d = new AuthListUtil(); //menuId = 5; var dd = d.GetCheckerRecord(m.GetValueOrDefault(), AuthId, 0, institutionId); if (dd.authListObj.Count < checkerNo) { var chk = new SM_AUTHCHECKER() { AUTHLIST_ITBID = AuthId, CREATEDATE = DateTime.Now, NARRATION = Narration, STATUS = reject, USERID = User.Identity.Name, }; repoAuthChecker.Insert(chk); var rst = uow.Save(User.Identity.Name); if (rst > 0) { var noA = dd.authListObj.Where(f => f.CHECKERSTATUS == approve).Count(); noA += 1; if (noA == checkerNo) { recordId = (int)rec2.RECORDID; //menuId = rec2.MENUID.GetValueOrDefault(); var recc = repoFreqTemp.Find(recordId); if (recc != null) { recc.STATUS = reject; } rec2.STATUS = reject; var t = uow.Save(User.Identity.Name); if (t > 0) { sucNew = true; // txscope.Complete(); } } } } //} if (sucNew) { EmailerNotification.SendApprovalRejectionMail(rec2.USERID, rec2.EVENTTYPE, reject, "Frequency Rejection", null, fullName); respMsg = "Record Rejected. A mail has been sent to the user."; return(Json(new { RespCode = 0, RespMessage = respMsg, status = reject })); } respMsg = "Problem processing request. Try again or contact Administrator."; return(Json(new { RespCode = 1, RespMessage = respMsg })); } catch (Exception ex) { //return Json(new { RespCode = 99, RespMessage = "Problem processing request. Try again or contact Administrator." }); respMsg = "Problem processing request. Try again or contact Administrator."; TempData["msg"] = respMsg; return(RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()), m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) })); } }
public ActionResult Create(FrequencyObj model, string m) { try { menuId = SmartUtil.GetMenuId(m); ViewBag.MenuId = HttpUtility.UrlDecode(m); var errorMsg = ""; if (ModelState.IsValid) { if (model.ITBID > 0) { //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew)) //{ var BType = new SM_FREQUENCYTEMP() { FREQUENCY_DESC = model.FREQUENCY_DESC, WORKDAYS = model.WORKDAYS, STATUS = open, RECORDID = model.ITBID, USERID = User.Identity.Name, CREATEDATE = DateTime.Now }; repoFreqTemp.Insert(BType); if (uow.Save(User.Identity.Name) > 0) { SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = model.STATUS == active ? eventEdit : model.STATUS, MENUID = menuId, //MENUNAME = "", RECORDID = BType.ITBID, STATUS = open, // TABLENAME = "ADMIN_DEPARTMENT", URL = Request.FilePath, USERID = User.Identity.Name, INSTITUTION_ITBID = institutionId, POSTTYPE = Single }; repoAuth.Insert(auth); var rst = uow.Save(User.Identity.Name) > 0 ? true : false; if (rst) { EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Frequency Record"); TempData["msg"] = "Record Updated SuccessFully...Authorization Pending."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(RedirectToAction("Index", "Frequency", new { m = m })); //return Json(new { RespCode = 0, RespMessage = "Record Updated SuccessFully...Authorization Pending." }); } else { ViewBag.Message = "Problem Updating Record."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(View("Add", new { m = m, id = model.ITBID })); //return Json(new { RespCode = 1, RespMessage = "Problem Updating Record." }); } } // var ret = _repo.PostRole(model, 1); //if (ret != null && ret.RespCode == 0) //{ // model.RoleId = int.Parse(ret.OutputKey.ToString()); // return Json(new { data = model, RespCode = 0, RespMessage = "Record Created Successfully" }); //} } else { var BType = new SM_FREQUENCYTEMP() { FREQUENCY_DESC = model.FREQUENCY_DESC, WORKDAYS = model.WORKDAYS, STATUS = open, RECORDID = model.ITBID, USERID = User.Identity.Name, CREATEDATE = DateTime.Now }; repoFreqTemp.Insert(BType); if (uow.Save(User.Identity.Name) > 0) { //var controller = ControllerContext.Controller..ToString(); SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = eventInsert, MENUID = menuId, //MENUNAME = "", RECORDID = BType.ITBID, STATUS = open, // TABLENAME = "ADMIN_DEPARTMENT", URL = Request.FilePath, USERID = User.Identity.Name, INSTITUTION_ITBID = institutionId, POSTTYPE = Single }; repoAuth.Insert(auth); var rst = uow.Save(User.Identity.Name) > 0 ? true : false; if (rst) { //newR = 1; EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Frequency Record"); TempData["msg"] = "Record Created SuccessFully...Authorization Pending."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(RedirectToAction("Index", new { m = m })); //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); } else { ViewBag.Message = "Problem Updating Record."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(View("Add", new { m = m })); // return Json(new { RespCode = 1, RespMessage = "Problem Creating Record." }); } } } } // If we got this far, something failed, redisplay form return(Json(new { RespCode = 1, RespMessage = errorMsg })); } catch (SqlException ex) { ViewBag.Message = "Problem Updating Record."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(View("Add", new { m = m })); //return Json(new { RespCode = 1, RespMessage = ex.Message }); } catch (Exception ex) { ViewBag.Message = "Problem Updating Record."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(View("Add", new { m = m })); //return Json(new { RespCode = 1, RespMessage = ex.Message }); } }
// [ValidateAntiForgeryToken] public ActionResult Process() { string batchId = ""; try { var rv = new SetReconUpldSession(); var rec = rv.GetSetReconUpload(User.Identity.Name); // isUp = userInstitutionItbid == 1 ? true : false; //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew, new TimeSpan(0, 30, 0))) //{ int errorcnt = 0; DateTime curDate = DateTime.Now; batchId = SmartObj.GenRefNo2(); int i = 0; int valCount = rec.Count(f => f.VALIDATIONERRORSTATUS == false); foreach (var d in rec) { if (i == 0) { SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = eventInsert, MENUID = menuId, //MENUNAME = "", // RECORDID = objG.ITBID, STATUS = open, //TABLENAME = "SM_FREQUENCY", URL = Request.FilePath, USERID = User.Identity.Name, INSTITUTION_ITBID = institutionId, BATCHID = batchId, POSTTYPE = Batch }; repoAuth.Insert(auth); } i++; if (d.VALIDATIONERRORSTATUS == true) { errorcnt++; continue; } var obj = new SM_SETRECONCILIATION_TEMP()// SM_MERCHANTTERMINALUPLD() { PAYREFNO = d.PAYREFNO, AMOUNT = d.AMOUNT, PAYMENTDATE = d.PAYMENTDATE, VALUEDATE = d.VALUEDATE, //RECEIPTNO = d.RECEIPTNO, CUSTOMERNAME = d.CUSTOMERNAME, PAYMENTMETHOD = d.PAYMENTMETHOD, //TRANSACTIONSTATUS = d.TRANSACTIONSTATUS, //DEPOSITSLIPNO = d.DEPOSITSLIPNO, BANKNAME = d.BANKNAME, //BRANCHNAME = d.BRANCHNAME, //PAYERID = d.PAYERID, //VALUEGRANTED = d.VALUEGRANTED, //RECONCILE = d.RECONCILE, BATCHID = batchId, CREATEDATE = curDate, STATUS = open, USERID = User.Identity.Name, }; repoSetReconciliationTemp.Insert(obj); //cnt++; } var rst = uow.Save(User.Identity.Name); if (rst > 0) { //SessionHelper.GetCart(Session).Clear(); rv.PurgeSetReconUpload(User.Identity.Name); try { EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, string.Format("Setttlement Reconciliation Upload Batch #{0}", batchId)); } catch { } //txscope.Complete(); } else { return(Json(new { RespCode = 1, RespMessage = "Problem Processing Request." })); } //} } catch (Exception ex) { return(Json(new { RespCode = 1, RespMessage = ex.Message })); } var msg = string.Format("<i class='fa fa-check' ></i> Record with Batch-ID #{0} Processed SuccessFully and has been forwarded for authorization", batchId); return(Json(new { RespCode = 0, RespMessage = msg })); }
public ActionResult Approve(decimal AuthId, int?m) { var sucNew = false; try { //int menuId; //var mid = SmartObj.Decrypt(m); //var ai = SmartObj.Decrypt(a_i); //if (int.TryParse(mid, out menuId) && decimal.TryParse(ai, out authId)) //{ var obj = new AuthViewObj(); var rec2 = repoAuth.Find(AuthId); if (rec2 == null) { respMsg = "Problem processing request. Try again or contact Administrator."; //TempData["msg"] = respMsg; //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(rec2.ITBID.ToString()), m = SmartObj.Encrypt(rec2.MENUID.GetValueOrDefault().ToString()) }); return(Json(new { RespCode = 1, RespMessage = respMsg })); } else if (rec2.STATUS.ToLower() != "open") { respMsg = "This request has already been processed by an authorizer."; //TempData["msg"] = respMsg; //return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()), m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) }); return(Json(new { RespCode = 1, RespMessage = respMsg })); } int recordId = 0; bool suc = false; //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew)) //{ var d = new AuthListUtil(); //menuId = 5; var dd = d.GetCheckerRecord(m.GetValueOrDefault(), AuthId, 0, institutionId); if (dd.authListObj.Count < checkerNo) { var chk = new SM_AUTHCHECKER() { AUTHLIST_ITBID = authId, CREATEDATE = DateTime.Now, NARRATION = null, STATUS = approve, USERID = User.Identity.Name, }; repoAuthChecker.Insert(chk); var rst = uow.Save(User.Identity.Name); if (rst > 0) { var noA = dd.authListObj.Where(f => f.CHECKERSTATUS == approve).Count(); noA += 1; if (noA == checkerNo) { recordId = (int)rec2.RECORDID; menuId = rec2.MENUID.GetValueOrDefault(); switch (rec2.EVENTTYPE) { case "New": { suc = CreateMainRecord(recordId); break; } case "Modify": { suc = ModifyMainRecord(recordId); break; } case "CLOSE": { suc = CloseMainRecord(recordId); break; } default: { break; } } // rec2.STATUS = close; if (suc) { rec2.STATUS = approve; var t = uow.Save(rec2.USERID, User.Identity.Name); if (t > 0) { sucNew = true; //txscope.Complete(); } } else { //return Json(new { RespCode = 99, RespMessage = "Problem processing request. Try again or contact Administrator." }); respMsg = "Problem processing request. Try again or contact Administrator."; // TempData["msg"] = respMsg; // return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(rec2.ITBID.ToString()), m = SmartObj.Encrypt(rec2.MENUID.GetValueOrDefault().ToString()) }); return(Json(new { RespCode = 1, RespMessage = respMsg })); } } //if (!isApprove) //{ // pnlResponse.Visible = true; // pnlResponse.CssClass = "alert alert-success alert-dismissable alert-bold fade in"; // pnlResponseMsg.Text = "Record Successfully Approved"; //} } } //else //{ // //bad request // respMsg = "Problem processing request. Try again or contact Administrator."; // // TempData["msg"] = respMsg; // // return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()) , m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) }); // return Json(new { RespCode = 1, RespMessage = respMsg }); //} //} if (sucNew) { EmailerNotification.SendApprovalRejectionMail(rec2.USERID, rec2.EVENTTYPE, approve, "Currency Approval", null, fullName); respMsg = "Record Authorized Successfully. A mail has been sent to the user."; return(Json(new { RespCode = 0, RespMessage = respMsg, status = approve })); } respMsg = "This request has already been processed by an authorizer."; return(Json(new { RespCode = 1, RespMessage = respMsg })); } catch (Exception ex) { //return Json(new { RespCode = 99, RespMessage = "Problem processing request. Try again or contact Administrator." }); respMsg = "Problem processing request. Try again or contact Administrator."; // TempData["msg"] = respMsg; // return RedirectToAction("DetailAuth", new { a_i = SmartObj.Encrypt(AuthId.ToString()) , m = SmartObj.Encrypt(m.GetValueOrDefault().ToString()) }); return(Json(new { RespCode = 1, RespMessage = respMsg })); } }
public ActionResult AddPolicy(CompanyProfileObj model, int?m) { try { //menuId = SmartUtil.GetMenuId(m); //GetMenuId(); var errorMsg = ""; if (ModelState.IsValid) { if (model.ITBID > 0) { var BType = new SM_COMPANY_PROFILETEMP() { COMPANY_ADDRESS = model.COMPANY_ADDRESS, COMPANY_CITY = model.COMPANY_CITY, COMPANY_CODE = model.COMPANY_CODE, COMPANY_COUNTRY = model.COMPANY_COUNTRY, COMPANY_EMAIL = model.COMPANY_EMAIL, COMPANY_NAME = model.COMPANY_NAME, COMPANY_PHONE1 = model.COMPANY_PHONE1, COMPANY_PHONE2 = model.COMPANY_PHONE2, COMPANY_STATE = model.COMPANY_STATE, COMPANY_WEBSITE = model.COMPANY_WEBSITE, STATUS = open, RECORDID = model.ITBID, USERID = User.Identity.Name, CREATEDATE = DateTime.Now, LOCKOUT_TRIAL_COUNT = model.LOCKOUT_TRIAL_COUNT, PASSWORDLENGTH = model.PASSWORDLENGTH, PASSWORD_CHANGE_DAYS = model.PASSWORD_CHANGE_DAYS, SYSTEM_IDLE_TIMEOUT = model.SYSTEM_IDLE_TIMEOUT }; //BType = model; // BType.RECORDID = model.ITBID; // BType.USERID = model.USERID; // BType.CREATEDATE = model.CREATEDATE; // BType.STATUS = open; // BType.ITBID = 0; repoCompTemp.Insert(BType); if (uow.Save(User.Identity.Name) > 0) { SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = eventEdit, // model.STATUS == active ? eventEdit : model.STATUS, MENUID = m, //MENUNAME = "", RECORDID = BType.ITBID, STATUS = open, // TABLENAME = "ADMIN_DEPARTMENT", URL = Request.FilePath, USERID = User.Identity.Name, INSTITUTION_ITBID = institutionId, POSTTYPE = Single, //TABLENAME = "COMP" }; repoAuth.Insert(auth); var rst = uow.Save(User.Identity.Name) > 0 ? true : false; if (rst) { EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Department Record"); return(Json(new { RespCode = 0, RespMessage = "Record Updated SuccessFully...Authorization Pending." })); } } return(Json(new { RespCode = 1, RespMessage = "Problem Updating Record." })); } else { var BType = new SM_COMPANY_PROFILETEMP(); BType = model; BType.RECORDID = model.ITBID; BType.USERID = model.USERID; BType.CREATEDATE = model.CREATEDATE; BType.STATUS = open; BType.ITBID = 0; repoCompTemp.Insert(BType); if (uow.Save(User.Identity.Name) > 0) { //var controller = ControllerContext.Controller..ToString(); SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = eventInsert, MENUID = m, //MENUNAME = "", RECORDID = BType.ITBID, STATUS = open, // TABLENAME = "ADMIN_DEPARTMENT", URL = Request.FilePath, USERID = User.Identity.Name, INSTITUTION_ITBID = institutionId, POSTTYPE = Single, //TABLENAME = "COMP" }; repoAuth.Insert(auth); var rst = uow.Save(User.Identity.Name) > 0 ? true : false; if (rst) { //newR = 1; EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Department Record"); return(Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." })); } else { return(Json(new { RespCode = 1, RespMessage = "Problem Creating Record." })); } } } } // If we got this far, something failed, redisplay form return(Json(new { RespCode = 1, RespMessage = errorMsg })); } catch (SqlException ex) { return(Json(new { RespCode = 1, RespMessage = ex.Message })); } catch (Exception ex) { return(Json(new { RespCode = 1, RespMessage = ex.Message })); } }
public ActionResult ResetLockout(string[] selected_value) { try { //ViewBag.MenuId = menuId; //HttpUtility.UrlDecode(m); var bid = SmartObj.GenRefNo2(); var errorMsg = ""; if (ModelState.IsValid) { if (selected_value != null) { foreach (var d in selected_value) { var BType = new SM_RESETLOCKOUT_TEMP() { BatchId = bid, UserName = d, Status = open, UserId = User.Identity.Name, CreateDate = DateTime.Now, }; repoReset.Insert(BType); } if (uow.Save(User.Identity.Name) > 0) { SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = eventInsert,// model.STATUS == active ? eventEdit : model.STATUS, MENUID = menuId, BATCHID = bid, //MENUNAME = "", //RECORDID = BType.ITBID, STATUS = open, // TABLENAME = "ADMIN_DEPARTMENT", URL = Request.FilePath, USERID = User.Identity.Name, INSTITUTION_ITBID = institutionId, POSTTYPE = Single }; repoAuth.Insert(auth); var rst = uow.Save(User.Identity.Name) > 0 ? true : false; if (rst) { EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Lockout Reset Record"); return(Json(new { RespCode = 0, RespMessage = "Record Updated SuccessFully...Authorization Pending." })); } else { return(Json(new { RespCode = 1, RespMessage = "Problem Processing Record." })); } } } else { return(Json(new { RespCode = 1, RespMessage = "Problem Processing Record." })); } } // If we got this far, something failed, redisplay form return(Json(new { RespCode = 1, RespMessage = errorMsg })); } catch (SqlException ex) { var msg = "Problem Updating Record."; return(Json(new { RespCode = 1, RespMessage = msg })); } catch (Exception ex) { var msg = "Problem Updating Record."; return(Json(new { RespCode = 1, RespMessage = msg })); } }
public ActionResult Add(SERVICEChannelObj model, string m) { try { menuId = SmartUtil.GetMenuId(m); ViewBag.MenuId = HttpUtility.UrlDecode(m); var errorMsg = ""; if (ModelState.IsValid) { if (model.ITBID == 0) { ViewBag.HeaderTitle = "Add ServiceChannel"; ViewBag.StatusVisible = false; ViewBag.ButtonText = "Save"; } else { //var d = _repo.GetSession(0, true); ViewBag.HeaderTitle = "Edit ServiceChannel"; ViewBag.StatusVisible = true; ViewBag.ButtonText = "Update"; } if (model.ITBID > 0) { //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew)) //{ var BType = new SM_SERVICECHANNELSTEMP() { CODE = model.CODE, DESCRIPTION = model.DESCRIPTION, ChannelID = model.ChannelID, BankCode = model.BankCode, BankAccount = model.BankAccount, STATUS = open, RECORDID = model.ITBID, USERID = User.Identity.Name, CREATEDATE = DateTime.Now }; repoServiceChannelTemp.Insert(BType); if (uow.Save(User.Identity.Name) > 0) { SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = model.STATUS == active ? eventEdit : model.STATUS, MENUID = menuId, //MENUNAME = "", RECORDID = BType.ITBID, STATUS = open, // TABLENAME = "ADMIN_DEPARTMENT", URL = Request.FilePath, USERID = User.Identity.Name, INSTITUTION_ITBID = institutionId, POSTTYPE = Single }; repoAuth.Insert(auth); var rst = uow.Save(User.Identity.Name) > 0 ? true : false; if (rst) { EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "ServiceChannel Record"); TempData["msg"] = "Record Updated SuccessFully...Authorization Pending."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(RedirectToAction("Index", "ServiceChannel", new { m = m })); //return Json(new { RespCode = 0, RespMessage = "Record Updated SuccessFully...Authorization Pending." }); } else { ViewBag.Message = "Problem Updating Record."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(View("Add", model)); //return Json(new { RespCode = 1, RespMessage = "Problem Updating Record." }); } } } else { var BType = new SM_SERVICECHANNELSTEMP() { CODE = model.CODE, DESCRIPTION = model.DESCRIPTION, STATUS = open, RECORDID = model.ITBID, ChannelID = model.ChannelID, BankCode = model.BankCode, BankAccount = model.BankAccount, USERID = User.Identity.Name, CREATEDATE = DateTime.Now }; repoServiceChannelTemp.Insert(BType); if (uow.Save(User.Identity.Name) > 0) { //var controller = ControllerContext.Controller..ToString(); SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = eventInsert, MENUID = menuId, //MENUNAME = "", RECORDID = BType.ITBID, STATUS = open, // TABLENAME = "ADMIN_DEPARTMENT", URL = Request.FilePath, USERID = User.Identity.Name, INSTITUTION_ITBID = institutionId, POSTTYPE = Single }; repoAuth.Insert(auth); var rst = uow.Save(User.Identity.Name) > 0 ? true : false; if (rst) { //newR = 1; EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "ServiceChannel Record"); TempData["msg"] = "Record Created SuccessFully...Authorization Pending."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(RedirectToAction("Index", new { m = m })); //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); } else { ViewBag.Message = "Problem Updating Record."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(View("Add", model)); // return Json(new { RespCode = 1, RespMessage = "Problem Creating Record." }); } } } } // If we got this far, something failed, redisplay form //errorMsg = GetModelError(); errorMsg = ModelStateErrorHandler.StringifyModelErrors(ModelState); ViewBag.Message = errorMsg; return(View("Add", model)); } catch (SqlException ex) { ViewBag.Message = "Problem Updating Record."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(View("Add", model)); //return Json(new { RespCode = 1, RespMessage = ex.Message }); } catch (Exception ex) { ViewBag.Message = "Problem Updating Record."; //return Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." }); return(View("Add", model)); //return Json(new { RespCode = 1, RespMessage = ex.Message }); } }
public ActionResult Add(int MenuId, int NoLevel, string m) { try { string bid = SmartObj.GenRefNo2(); var errorMsg = ""; if (ModelState.IsValid) { //using (var txscope = new TransactionScope(TransactionScopeOption.RequiresNew)) //{ SM_APPROVAL_ROUTE_TEMP BType = new SM_APPROVAL_ROUTE_TEMP() { // BType.PARTY_CODE = int.Parse(txtpartyCode.Value); MENUID = MenuId, NOLEVEL = NoLevel, STATUS = open, CREATEDATE = DateTime.Now, BATCHID = bid, USERID = User.Identity.Name, //RECORDID = model.ITBID, }; repoAppRouteTemp.Insert(BType); var rst = uow.Save(User.Identity.Name) > 0 ? true : false; if (rst) { SaveRouteOfficerTemp(eventEdit, bid); SM_AUTHLIST auth = new SM_AUTHLIST() { CREATEDATE = DateTime.Now, EVENTTYPE = eventEdit, MENUID = menuId, RECORDID = BType.ITBID, STATUS = open, URL = Request.FilePath, USERID = User.Identity.Name, POSTTYPE = Single, BATCHID = bid, INSTITUTION_ITBID = institutionId }; repoAuth.Insert(auth); var rst1 = uow.Save(User.Identity.Name); if (rst1 > 0) { EmailerNotification.SendForAuthorization(menuId, fullName, deptCode, institutionId, "Approval Route Record"); //txscope.Complete(); //TempData["msg"] = "Record Created SuccessFully...Authorization Pending."; return(Json(new { RespCode = 0, RespMessage = "Record Created SuccessFully...Authorization Pending." })); //return RedirectToAction("Index", new { m = m }); } } //} // If we got this far, something failed, redisplay form return(Json(new { RespCode = 1, RespMessage = errorMsg })); } } catch (SqlException ex) { //BindCombo(); //ViewBag.PartyAcct = GetRvHeadLines(); //ViewBag.Message = ex.Message; //return View("Add", model); return(Json(new { RespCode = 1, RespMessage = ex.Message })); } catch (Exception ex) { //BindCombo(); //ViewBag.PartyAcct = GetRvHeadLines(); //ViewBag.Message = ex.Message; //return View("Add", model); return(Json(new { RespCode = 1, RespMessage = ex.Message })); } //BindCombo(); //ViewBag.PartyAcct = GetRvHeadLines(); //ViewBag.Message = "Problem Processing Request, Try again or Contact Administrator."; //return View("Add", model); return(Json(new { RespCode = 1, RespMessage = "Problem Processing Request, Try again or Contact Administrator." })); }