Esempio n. 1
0
 public virtual ActionResult UpdateConfiguration(EditCustomerVasViewModel model)
 {
     //TC: VAS should be updated properly with given new details, Only RegEx pattern and RegEx Pattern Description should change here.
     _service.UpdateVasConfiguration(model.CustomerId, model.VasId, model.ConstructedRegEx, model.ConstructedRegExDescription, null, true);
     AddStatusMessage(string.Format("New settings updated successfully for the customer {0}.", model.CustomerId));
     return(RedirectToAction(Actions.CustomerVas(model.CustomerId, model.VasId)));
 }
Esempio n. 2
0
        public virtual ActionResult VerifyVasPattern(EditCustomerVasViewModel model)
        {
            var customerVasList = _service.GetCustomerVasSettings(model.CustomerId).ToArray();

            if (customerVasList.All(p => p.VasId != model.VasId))
            {
                ModelState.AddModelError("", string.Format("VAS setting for customer {0} is already removed.", model.CustomerId));
                return(RedirectToAction(Actions.Index()));
            }
            var customerVasSetting = customerVasList.First(p => p.VasId == model.VasId);

            var newModel = new VerifyVasPatternViewModel
            {
                CustomerId       = model.CustomerId,
                VasId            = model.VasId,
                CustomerName     = customerVasSetting.CustomerName,
                VasDescription   = customerVasSetting.VasDescription,
                PatternRegEx     = customerVasSetting.PatternRegEx,
                RegExDescription = customerVasSetting.VasPatternDescription,
                PoPatternType    = model.DoApplyPoPattern ? model.PoPatternType : null,
                PoTextType       = model.DoApplyPoPattern ? model.PoTextType : null,
                Labels           = model.Labels,
                PoText           = model.DoApplyPoPattern && model.PoTextType == null ? model.PoText : string.Empty
            };
            var query = _service.GetComprehensivePoList(model.CustomerId, model.VasId, customerVasSetting.PatternRegEx, newModel.ConstructedRegEx).ToArray();

            newModel.ListWillApply = (from item in query
                                      where item.Item1 == VasConfigurationRepository.PoQualificationType.NewOnly || item.Item1 == VasConfigurationRepository.PoQualificationType.BothOldAndNew
                                      select new VasSettingChangeModel
            {
                IsNew = item.Item1 == VasConfigurationRepository.PoQualificationType.NewOnly,
                PoId = item.Item2
            }).OrderBy(p => p.IsNew).ToArray();
            newModel.ListWillNotApply = (from item in query
                                         where item.Item1 == VasConfigurationRepository.PoQualificationType.OldOnly || item.Item1 == VasConfigurationRepository.PoQualificationType.NeitherOldNorNew
                                         select new VasSettingChangeModel
            {
                IsNew = item.Item1 == VasConfigurationRepository.PoQualificationType.OldOnly,
                PoId = item.Item2
            }).OrderBy(p => p.IsNew).ToArray();
            return(View(Views.VerifyVasPattern, newModel));
        }
Esempio n. 3
0
        public virtual ActionResult EditCustomerVas(string customerId, string vasId)
        {
            var customerVasList = _service.GetCustomerVasSettings(customerId).ToArray();

            if (customerVasList.All(p => p.VasId != vasId))
            {
                ModelState.AddModelError("", string.Format("VAS setting for customer {0} is already removed.", customerId));
                return(RedirectToAction(Actions.Index()));
            }
            var customerVasSetting = customerVasList.First(p => p.VasId == vasId);

            var model = new EditCustomerVasViewModel
            {
                CustomerId       = customerId,
                CustomerName     = customerVasSetting.CustomerName,
                VasId            = vasId,
                VasDescription   = customerVasSetting.VasDescription,
                RegExDescription = customerVasSetting.VasPatternDescription,
            };

            return(View(Views.EditCustomerVas, model));
        }