public ActionResult Add(DirectDebitClass model) { if (Session["Login"] != null) { LoginSession loginsession = (LoginSession)Session["Login"]; ViewBag.CompanyLogo = loginsession.CompanyLogo; ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType); String actionName = this.ControllerContext.RouteData.Values["action"].ToString(); String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType)); ViewBag.RoleName = loginsession.RoleName; if (String.IsNullOrEmpty(model.CustomerID.ToString())) { ModelState.AddModelError("Consumer ", "Please Enter Consumer"); } if (ModelState.IsValid) { try { model.CreateBy = Convert.ToInt64(loginsession.UserID); if (BAL.DirectDebitModel.AddDirectDebit(model)) { return Json(new { result = 1, message = "Record was successfully Saved!" }); } else { return Json(new { result = 0, message = "Duplicate Notification Name " }); } } catch (Exception ex) { return Json(new { result = 0, message = "ErrorMessage" + ":" + ex.StackTrace.ToString() }); } } else { String errorMessage = String.Empty; String exception = String.Empty; foreach (var modelStateVal in ViewData.ModelState.Values) { foreach (var error in modelStateVal.Errors) { errorMessage = error.ErrorMessage; exception = error.Exception.ToString(); } } return Json(new { result = 0, message = "ErrorMessage" + ":" + exception }); } } else { return RedirectToAction("Index", "Home"); } }
public static bool UpdateDirectDebit(DirectDebitClass debit) { Boolean flag = false; try { Icontext objinter = new BALDirectDebit(); flag = objinter.UpdateRecord(debit); } catch (Exception ex) { throw; } return flag; }
public static Boolean IsApprovedDirectDebit(DirectDebitClass debit) { Boolean flag = false; try { IsApproved objtext = new BALDirectDebit(); flag = objtext.IsApprovedRecord(debit); } catch (Exception ex) { throw; } return flag; }
public static Boolean AddDirectDebit(DirectDebitClass debit) { Boolean flag = false; try { IRecordInsert objtext = new BALDirectDebit(); flag = objtext.AddRecord(debit); } catch (Exception ex) { throw; } return flag; }
public Object EditRecord(Int64 ID) { DirectDebitClass _Debit = new DirectDebitClass(); try { DirectDebit Debit = DAL.DALDirectDebit.EditDirectDebit(Convert.ToInt64(ID)); _Debit.ID = Debit.ID; if (Debit.AccountHolderName != null) { _Debit.AccountHolderName = Debit.AccountHolderName; } if (Debit.BankName != null) { _Debit.BankName = Debit.BankName; } if (Debit.BankSortCode != null) { _Debit.BankSortCode = Debit.BankSortCode; } if (Debit.AccountNumber != null) { _Debit.BankAccountNumber = Debit.AccountNumber; } if (Debit.DirectDebitDate != null) { _Debit.DirectDebitDate = Common.DateGBString(Debit.DirectDebitDate.ToString()); } if (Debit.Email != null) { _Debit.Email = Debit.Email; } if (Debit.Mobile != null) { _Debit.Mobile = Debit.Mobile; } if (Debit.StartDate != null) { _Debit.StartDate = Common.DateGBString(Debit.StartDate.ToString()); } if (Debit.EndDate != null) { _Debit.EndDate = Common.DateGBString(Debit.EndDate.ToString()); } if (_Debit.Amount != null) { _Debit.Amount = Convert.ToString(Debit.Amount); } if (_Debit.DateOfDebitDebit != null) { Debit.DateOfDebitDebit = _Debit.DateOfDebitDebit; } _Debit.DirectDebitType = Debit.DirectDebitType; } catch (Exception ex) { throw; } return _Debit; }
public ActionResult Edit(String DebitID) { if (Session["Login"] != null) { LoginSession loginsession = (LoginSession)Session["Login"]; String actionName = this.ControllerContext.RouteData.Values["action"].ToString(); String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType)); if (DebitID != null) { String DecDebitID = BAL.Security.URLDecrypt(DebitID); if ((DecDebitID != "0") && (DecDebitID != null)) { ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType); DirectDebitClass Debit = new DirectDebitClass(); try { Debit = BAL.DirectDebitModel.EditDirectDebit(DecDebitID); ViewBag.DebitID = Debit.ID; } catch (Exception ex) { return Content(ex.Message); } return View(Debit); } } { return RedirectToAction("Index", "DirectDebit"); } } else { return RedirectToAction("Index", "Home"); } }
public ActionResult Update(DirectDebitClass model) { if (Session["Login"] != null) { LoginSession loginsession = (LoginSession)Session["Login"]; String actionName = this.ControllerContext.RouteData.Values["action"].ToString(); String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType)); if (ModelState.IsValid) { try { model.modifyBy = Convert.ToInt64(loginsession.UserID); ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType); if (BAL.DirectDebitModel.UpdateDirectDebit(model)) { return RedirectToAction("Index", "DirectDebit"); } else { return Content("Unable to save , try again"); } } catch (Exception ex) { return Content("ErrorMessage" + ":" + ex.StackTrace.ToString()); } } else { String errorMessage = String.Empty; String exception = String.Empty; foreach (var modelStateVal in ViewData.ModelState.Values) { foreach (var error in modelStateVal.Errors) { errorMessage = error.ErrorMessage; exception = error.Exception.ToString(); } } return Content("ErrorMessage" + ":" + exception); } } else { return RedirectToAction("Index", "Home"); } }
public ActionResult Approved(String DebitID) { if (Session["Login"] != null) { LoginSession loginsession = (LoginSession)Session["Login"]; String actionName = this.ControllerContext.RouteData.Values["action"].ToString(); String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType)); if (DebitID != null) { String DecDebitID = BAL.Security.URLDecrypt(DebitID); if ((DecDebitID != "0") && (DecDebitID != null)) { ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType); DirectDebitClass Debit = new DirectDebitClass(); try { Debit.ID = Convert.ToInt64(DecDebitID); Debit.ApprovedBY= Convert.ToInt64(loginsession.UserID); if (Debit != null) { if (BAL.DirectDebitModel.IsApprovedDirectDebit(Debit)) { return RedirectToAction("Index", "DirectDebit"); } else { return Content("Unable to Deleted , try again"); } } else { return Content("Unable to Deleted , try again"); } } catch (Exception ex) { return Content(ex.Message); } } } { return RedirectToAction("Index", "DirectDebit"); } } else { return RedirectToAction("Index", "Home"); } }