示例#1
0
 public ActionResult Create(MasterDealviewModel model)
 {
     ValidateMasterDealviewModel(model);
     try
     {
         if (!ModelState.IsValid)
         {
             if (model.CopyDeal == true)
             {
                 mDealProvider.CopyDealfromOneToAnother(model.DealName, model.DealMasterId, model.DealTypeId, model.EffectiveFrom, model.ExpireOn);
             }
             else
             {
                 mDealProvider.AddDealMaster(model, 1);
             }
             return(RedirectToAction("Index", "DealSetup"));
         }
         else
         {
             return(RedirectToAction("Index", "DealSetup"));
         }
     }
     catch
     {
         return(RedirectToAction("Index", "DealSetup"));
     }
 }
        public ActionResult GetDealByAirline(int id)
        {
            MasterDealviewModel viewmodel = new MasterDealviewModel()
            {
                AirlineWiseDealDetailsList = _DealProvider.GetAllDealDetailsByAirline(id),
            };

            return(PartialView("PVC_AirlineWiseDealDetails", viewmodel));
        }
        public ActionResult GetAllDealAssociatedlToAgent(int id)
        {
            MasterDealviewModel viewmodel = new MasterDealviewModel()
            {
                AssociatedAgentList = _DealProvider.GetDealDetailsByAgent(id),
            };

            return(PartialView("PVC_AssociatedAgentinDeal", viewmodel));
        }
示例#4
0
        public ActionResult Create()
        {
            MasterDealviewModel viewmodel = new MasterDealviewModel()
            {
                DealMasterList = mDealProvider.GetAllDealMasterList(1),
                DealTypeList   = mDealProvider.GetAllDealTypeList(1),
            };

            if (Request != null && Request.IsAjaxRequest())
            {
                return(PartialView("VUC_CreateNewDeal", viewmodel));
            }
            else
            {
                return(View(viewmodel));
            }
        }
        private void ValidateMasterDealviewModel(MasterDealviewModel 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.");
            }
        }