Esempio n. 1
0
 public ActionResult UpdateCommunicationType(FormCollection collection)
 {
     EditCommunicationTypeModel model=new EditCommunicationTypeModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=CommunicationTypeNameAvailable(model.CommunicationTypeName,model.CommunicationTypeId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("CommunicationTypeName",ErrorMessage);
     }
     if(ModelState.IsValid) {
         DeepBlue.Models.Entity.CommunicationType communicationType=AdminRepository.FindCommunicationType(model.CommunicationTypeId);
         if(communicationType==null) {
             communicationType=new DeepBlue.Models.Entity.CommunicationType();
         }
         communicationType.CommunicationTypeName=model.CommunicationTypeName;
         communicationType.Enabled=model.Enabled;
         communicationType.EntityID=Authentication.CurrentEntity.EntityID;
         communicationType.CommunicationGroupingID=model.CommunicationGroupId;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveCommunicationType(communicationType);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+communicationType.CommunicationTypeID;
         }
     } else {
         foreach(var values in ModelState.Values.ToList()) {
             foreach(var err in values.Errors.ToList()) {
                 if(string.IsNullOrEmpty(err.ErrorMessage)==false) {
                     resultModel.Result+=err.ErrorMessage+"\n";
                 }
             }
         }
     }
     return View("Result",resultModel);
 }
Esempio n. 2
0
 public ActionResult CommunicationType()
 {
     ViewData["MenuName"]="AdminManagement";
     ViewData["SubmenuName"]="InvestorManagement";
     ViewData["PageName"]="CommunicationType";
     EditCommunicationTypeModel model=new EditCommunicationTypeModel();
     model.CommunicationGroupings=SelectListFactory.GetCommunicationGroupingSelectList(AdminRepository.GetAllCommunicationGroupings());
     return View(model);
 }