public ActionResult Create(MasterBranchDealviewModel model) { ValidateMasterBranchDealviewModel(model); TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"]; string BranchCode = mDealProvider.GetBranchCodeByBranchId(obj.LoginTypeId); try { if (!ModelState.IsValid) { model.CreatedBy = obj.AppUserId; model.BranchOfficeId = obj.LoginTypeId; model.BranchOfficeCode = BranchCode; if (model.CopyDeal == true) { mDealProvider.CopyDealFromOneToAnotherForMobileBranch(model.DealName, model.DealMasterId, 3, model.BranchOfficeId, model.CreatedBy); } else { mDealProvider.AddDealMaster(model, 3); } return(RedirectToAction("Index", "BranchsDealSetup")); } else { return(RedirectToAction("Index", "BranchsDealSetup")); } } catch { return(RedirectToAction("Index", "BranchsDealSetup")); } }
public ActionResult Create(MasterBranchDealviewModel model) { ValidateMasterDistributorDealviewModel(model); TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"]; string DistributorCode = mDealProvider.GetDistributorCodeByDistributorId(obj.LoginTypeId); try { if (!ModelState.IsValid) { model.CreatedBy = obj.AppUserId; model.BranchOfficeId = obj.LoginTypeId; model.DistributorCode = DistributorCode; mDealProvider.AddDistributorDealMaster(model, 1); if (model.CopyDeal == true) { mDealProvider.CopyDealfromOneToAnotherfordistributor(model.DealName, model.DealMasterId, 1, model.BranchOfficeId, model.CreatedBy); } return(RedirectToAction("Index", "DistributorDealSetup")); } else { return(RedirectToAction("Index", "DistributorDealSetup")); } } catch { return(RedirectToAction("Index", "DistributorDealSetup")); } }
public ActionResult Create(MasterBranchDealviewModel model) { ValidateMasterBranchDealviewModel(model); TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"]; string DistributorCode = mDealProvider.GetDistributorCodeByDistributorId(obj.LoginTypeId); try { if (!ModelState.IsValid) { model.CreatedBy = obj.AppUserId; model.BranchOfficeId = obj.LoginTypeId; model.DistributorCode = DistributorCode; mDealProvider.AddDistributorDealMaster(model, 2); return(RedirectToAction("Index", "HotelDistributorDealSetup")); } else { return(RedirectToAction("Index", "HotelDistributorDealSetup")); } } catch { return(RedirectToAction("Index", "HotelBranchDealSetup")); } }
public void AddDistributorDealMaster(MasterBranchDealviewModel model, int productId) { Core_DistributorDealMasters datamodel = new Core_DistributorDealMasters { DistributorDealName = model.DistributorCode + "-" + model.DealName, ProductId = productId, DistributorId = model.BranchOfficeId, CreatedBy = model.CreatedBy, CreatedDate = DateTime.Now, }; ent.AddToCore_DistributorDealMasters(datamodel); ent.SaveChanges(); }
public void AddDealMaster(MasterBranchDealviewModel model) { Core_BranchDealMasters datamodel = new Core_BranchDealMasters { BranchDealName = model.BranchOfficeCode + "-" + model.DealName, ProductId = model.ProductID, BranchOfficeId = model.BranchOfficeId, CreatedBy = model.CreatedBy, CreatedDate = DateTime.Now, }; ent.AddToCore_BranchDealMasters(datamodel); ent.SaveChanges(); }
public ActionResult Create() { TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"]; string DistributorCode = mDealProvider.GetDistributorCodeByDistributorId(obj.LoginTypeId); MasterBranchDealviewModel viewmodel = new MasterBranchDealviewModel() { DealMasterList = mDealProvider.GetAllDistributorDealMasterList(1, obj.LoginTypeId), DistributorCode = DistributorCode }; if (Request != null && Request.IsAjaxRequest()) { return(PartialView("VUC_CreateNewDeal", viewmodel)); } else { return(View(viewmodel)); } }
public ActionResult Create() { TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"]; string BranchCode = mDealProvider.GetBranchCodeByBranchId(obj.LoginTypeId); MasterBranchDealviewModel viewmodel = new MasterBranchDealviewModel() { DealMasterList = mDealProvider.GetAllBranchDealMasterList(3, obj.LoginTypeId), BranchOffices = new SelectList(distributorManagementProvider.GetBranchOffices(), "BranchOfficeId", "BranchOfficeName"), BranchOfficeCode = BranchCode }; if (Request != null && Request.IsAjaxRequest()) { return(PartialView("VUC_CreateNewDeal", viewmodel)); } else { return(View(viewmodel)); } }
private void ValidateMasterBranchDealviewModel(MasterBranchDealviewModel dealmaster) { bool dealmasterIsNull = dealmaster == null ? true : false; const string decimalRegex = @"^\d+(\.\d\d)?$"; Regex rgx = new Regex(decimalRegex); // Validation logic if ((dealmasterIsNull) || (string.IsNullOrEmpty(dealmaster.DealName))) { ModelState.AddModelError("DealName", "DealName is required."); } if ((dealmasterIsNull) || (string.IsNullOrEmpty((dealmaster.DealTypeId).ToString())) || (dealmaster.DealTypeId == 0)) { ModelState.AddModelError("DealTypeId", "DealType Name is required."); } if ((dealmasterIsNull) || (string.IsNullOrEmpty(dealmaster.EffectiveFrom.ToString()))) { ModelState.AddModelError("EffectiveFrom", "EffectiveFrom Date is required."); } if ((dealmasterIsNull) || (string.IsNullOrEmpty(dealmaster.ExpireOn.ToString()))) { ModelState.AddModelError("ExpireOn", "ExpireOn Date is required."); } }