Пример #1
0
 public ActionResult UpdateShareClassType(FormCollection collection)
 {
     EditShareClassTypeModel model=new EditShareClassTypeModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=ShareClassAvailable(model.ShareClass,model.ShareClassTypeId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("Name",ErrorMessage);
     }
     if(ModelState.IsValid) {
         ShareClassType shareClassType=AdminRepository.FindShareClassType(model.ShareClassTypeId);
         if(shareClassType==null) {
             shareClassType=new ShareClassType();
             shareClassType.CreatedBy=Authentication.CurrentUser.UserID;
             shareClassType.CreatedDate=DateTime.Now;
         }
         shareClassType.ShareClass=model.ShareClass;
         shareClassType.Enabled=model.Enabled;
         shareClassType.EntityID=Authentication.CurrentEntity.EntityID;
         shareClassType.LastUpdatedBy=Authentication.CurrentUser.UserID;
         shareClassType.LastUpdatedDate=DateTime.Now;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveShareClassType(shareClassType);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+shareClassType.ShareClassTypeID;
         }
     } 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);
 }
Пример #2
0
 public ActionResult UpdateUnderlyingFundType(FormCollection collection)
 {
     EditUnderlyingFundTypeModel model=new EditUnderlyingFundTypeModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=UnderlyingFundTypeNameAvailable(model.Name,model.UnderlyingFundTypeId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("Name",ErrorMessage);
     }
     if(ModelState.IsValid) {
         UnderlyingFundType underlyingFundType=AdminRepository.FindUnderlyingFundType(model.UnderlyingFundTypeId);
         if(underlyingFundType==null) {
             underlyingFundType=new UnderlyingFundType();
         }
         underlyingFundType.Name=model.Name;
         underlyingFundType.EntityID=Authentication.CurrentEntity.EntityID;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveUnderlyingFundType(underlyingFundType);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+underlyingFundType.UnderlyingFundTypeID;
         }
     } 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);
 }
Пример #3
0
 public ActionResult UpdateReportingFrequency(FormCollection collection)
 {
     EditReportingFrequencyModel model=new EditReportingFrequencyModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=ReportingFrequencyAvailable(model.ReportingFrequency,model.ReportingFrequencyId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("Name",ErrorMessage);
     }
     if(ModelState.IsValid) {
         ReportingFrequency reportingFrequency=AdminRepository.FindReportingFrequency(model.ReportingFrequencyId);
         if(reportingFrequency==null) {
             reportingFrequency=new ReportingFrequency();
             reportingFrequency.CreatedBy=Authentication.CurrentUser.UserID;
             reportingFrequency.CreatedDate=DateTime.Now;
         }
         reportingFrequency.ReportingFrequency1=model.ReportingFrequency;
         reportingFrequency.Enabled=model.Enabled;
         reportingFrequency.EntityID=Authentication.CurrentEntity.EntityID;
         reportingFrequency.LastUpdatedBy=Authentication.CurrentUser.UserID;
         reportingFrequency.LastUpdatedDate=DateTime.Now;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveReportingFrequency(reportingFrequency);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+reportingFrequency.ReportingFrequencyID;
         }
     } 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);
 }
Пример #4
0
 public ActionResult UpdateSecurityType(FormCollection collection)
 {
     EditSecurityTypeModel model=new EditSecurityTypeModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=SecurityTypeNameAvailable(model.Name,model.SecurityTypeId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("Name",ErrorMessage);
     }
     if(ModelState.IsValid) {
         SecurityType securityType=AdminRepository.FindSecurityType(model.SecurityTypeId);
         if(securityType==null) {
             securityType=new SecurityType();
         }
         securityType.Name=model.Name;
         securityType.Enabled=model.Enabled;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveSecurityType(securityType);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True";
         }
     } 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);
 }
Пример #5
0
 public ActionResult UpdateMenu(FormCollection collection)
 {
     ICacheManager cacheManager=new MemoryCacheManager();
     EditMenuModel model=new EditMenuModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     if(ModelState.IsValid) {
         Menu menu=AdminRepository.FindMenu(model.MenuID);
         if(menu==null) {
             menu=new Menu();
         }
         menu.DisplayName=model.DisplayName;
         menu.ParentMenuID=model.ParentMenuID;
         menu.URL=model.URL;
         menu.Title=model.Title;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveMenu(menu);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             // Remove entity menu cache
             cacheManager.RemoveByPattern(MenuHelper.ENTITYMENUKEY);
             resultModel.Result="True||"+menu.MenuID;
         }
     } 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);
 }
Пример #6
0
 public ActionResult UpdateModule(FormCollection collection)
 {
     EditModule model=new EditModule();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=ModuleFieldTextAvailable(model.ModuleName,model.ModuleID);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("ModuleName",ErrorMessage);
     }
     if(ModelState.IsValid) {
         MODULE module=AdminRepository.FindModule(model.ModuleID);
         if(module==null) {
             module=new MODULE();
         }
         module.ModuleName=model.ModuleName;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveModule(module);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True";
         }
     } 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);
 }
Пример #7
0
 public ActionResult UpdateFileType(FormCollection collection)
 {
     EditFileTypeModel model=new EditFileTypeModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=FileTypeNameAvailable(model.FileTypeName,model.FileTypeId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("FileTypeText",ErrorMessage);
     }
     if(ModelState.IsValid) {
         FileType fileType=AdminRepository.FindFileType(model.FileTypeId);
         if(fileType==null) {
             fileType=new FileType();
         }
         fileType.FileTypeName=model.FileTypeName;
         fileType.FileExtension=model.FileExtension;
         fileType.Description=model.Description;
         fileType.EntityID=Authentication.CurrentEntity.EntityID;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveFileType(fileType);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+fileType.FileTypeID;
         }
     } 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);
 }
Пример #8
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);
 }
Пример #9
0
 public ActionResult UpdateEntityMenu(FormCollection collection)
 {
     ICacheManager cacheManager=new MemoryCacheManager();
     EditEntityMenuModel model=new EditEntityMenuModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     //string ErrorMessage = EntityMenuAvailable(model.DisplayName, model.EntityMenuID);
     //if (String.IsNullOrEmpty(ErrorMessage) == false) {
     //    ModelState.AddModelError("DisplayName", ErrorMessage);
     //}
     if(ModelState.IsValid) {
         EntityMenu entityMenu=AdminRepository.FindEntityMenu(model.EntityMenuID);
         if(entityMenu==null) {
             entityMenu=new EntityMenu();
         }
         entityMenu.DisplayName=model.DisplayName;
         entityMenu.MenuID=model.MenuID;
         entityMenu.EntityID=Authentication.CurrentEntity.EntityID;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveEntityMenu(entityMenu);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             // Remove entity menu cache
             cacheManager.RemoveByPattern(string.Format(MenuHelper.ENTITYMENUKEY,entityMenu.EntityID));
             resultModel.Result="True||"+entityMenu.EntityMenuID;
         }
     } 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);
 }
Пример #10
0
 public ActionResult UpdateEntityMenuSortOrder(FormCollection collection)
 {
     ICacheManager cacheManager=new MemoryCacheManager();
     ResultModel resultModel=new ResultModel();
     int entityMenuID=0;
     int alterEntityMenuID=0;
     int.TryParse(collection["entityMenuID"],out entityMenuID);
     int.TryParse(collection["alterEntityMenuID"],out alterEntityMenuID);
     EntityMenu entityMenu=AdminRepository.FindEntityMenu(entityMenuID);
     EntityMenu alterEntityMenu=AdminRepository.FindEntityMenu(alterEntityMenuID);
     IEnumerable<ErrorInfo> errorInfo=null;
     if(entityMenu!=null&&alterEntityMenu!=null) {
         int entityMenuSortOrder=entityMenu.SortOrder;
         int alterEntityMenuSortOrder=alterEntityMenu.SortOrder;
         entityMenu.SortOrder=alterEntityMenuSortOrder;
         alterEntityMenu.SortOrder=entityMenuSortOrder;
         AdminRepository.SaveEntityMenu(entityMenu);
         AdminRepository.SaveEntityMenu(alterEntityMenu);
     }
     if(errorInfo!=null) {
         resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
     } else {
         // Remove entity menu cache
         cacheManager.RemoveByPattern(string.Format(MenuHelper.ENTITYMENUKEY,entityMenu.EntityID));
         resultModel.Result="True||"+entityMenu.EntityMenuID;
     }
     return View("Result",resultModel);
 }
Пример #11
0
 public ActionResult UpdateEntity(FormCollection collection)
 {
     ICacheManager cacheManager=new MemoryCacheManager();
     ENTITY model=new ENTITY();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     bool isNewEntity=false;
     string ErrorMessage=EntityNameAvailable(model.EntityName,model.EntityID);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("EntityName",ErrorMessage);
     }
     ErrorMessage=EntityCodeAvailable(model.EntityCode,model.EntityID);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("EntityCode",ErrorMessage);
     }
     if(ModelState.IsValid) {
         ENTITY entity=AdminRepository.FindEntity(model.EntityID);
         if(entity==null) {
             entity=new ENTITY();
             entity.CreatedDate=DateTime.Now;
             isNewEntity=true;
         }
         entity.EntityName=model.EntityName;
         entity.EntityCode=model.EntityCode;
         entity.Enabled=model.Enabled;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveEntity(entity);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+entity.EntityID;
             // Create default user
             if(isNewEntity) {
                 string username="******";
                 string password="******";
                 string firstname="admin";
                 string lastname="admin";
                 string email="*****@*****.**";
                 USER user=new USER();
                 user.Login=username;
                 user.PasswordSalt=SecurityExtensions.CreateSalt();
                 user.PasswordHash=password.CreateHash(user.PasswordSalt);
                 user.Email=email;
                 user.FirstName=firstname;
                 user.LastName=lastname;
                 user.EntityID=entity.EntityID;
                 user.CreatedDate=DateTime.Now;
                 user.LastUpdatedDate=DateTime.Now;
                 user.Enabled=true;
                 user.IsAdmin=true;
                 AdminRepository.SaveUser(user);
             }
         }
         // Create entity menu
         if(AdminRepository.GetEntityMenuCount(entity.EntityID)<=0) {
             AdminRepository.SaveEntityMenu(entity.EntityID);
             // Remove entity menu cache
             cacheManager.RemoveByPattern(string.Format(MenuHelper.ENTITYMENUKEY,entity.EntityID));
         }
     } 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);
 }
Пример #12
0
 public ActionResult UpdateDealContact(FormCollection collection)
 {
     EditDealContactModel model=new EditDealContactModel();
     ResultModel resultModel=new ResultModel();
     IEnumerable<ErrorInfo> errorInfo=null;
     this.TryUpdateModel(model);
     string ErrorMessage=DealContactNameAvailable(model.ContactName,model.ContactId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("ContactName",ErrorMessage);
     }
     if(ModelState.IsValid) {
         Contact contact=AdminRepository.FindContact(model.ContactId);
         if(contact==null) {
             contact=new Contact();
             contact.CreatedBy=Authentication.CurrentUser.UserID;
             contact.CreatedDate=DateTime.Now;
         }
         contact.LastUpdatedBy=Authentication.CurrentUser.UserID;
         contact.LastUpdatedDate=DateTime.Now;
         contact.EntityID=Authentication.CurrentEntity.EntityID;
         contact.ContactName=model.ContactName;
         contact.LastName="n/a";
         contact.Title=model.ContactTitle;
         contact.Notes=model.ContactNotes;
         AddCommunication(contact,Models.Admin.Enums.CommunicationType.Email,model.Email);
         AddCommunication(contact,Models.Admin.Enums.CommunicationType.HomePhone,model.Phone);
         AddCommunication(contact,Models.Admin.Enums.CommunicationType.WebAddress,model.WebAddress);
         errorInfo=AdminRepository.SaveDealContact(contact);
         resultModel.Result=ValidationHelper.GetErrorInfo(errorInfo);
         if(string.IsNullOrEmpty(resultModel.Result)) {
             resultModel.Result+="True||"+contact.ContactID.ToString();
         }
     } 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);
 }
Пример #13
0
 public ActionResult UpdateCustomField(FormCollection collection)
 {
     EditCustomFieldModel model=new EditCustomFieldModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=CustomFieldTextAvailable(model.CustomFieldText,model.CustomFieldId,model.ModuleId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("CustomFieldText",ErrorMessage);
     }
     if(ModelState.IsValid) {
         CustomField customField=AdminRepository.FindCustomField(model.CustomFieldId);
         if(customField==null) {
             customField=new CustomField();
         }
         customField.CustomFieldText=model.CustomFieldText;
         customField.DataTypeID=model.DataTypeId;
         customField.ModuleID=model.ModuleId;
         customField.OptionalText=model.OptionalText;
         customField.Search=model.Search;
         customField.EntityID=Authentication.CurrentEntity.EntityID;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveCustomField(customField);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+customField.CustomFieldID;
         }
     } 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);
 }
Пример #14
0
        public ActionResult UpdateUser(FormCollection collection)
        {
            EditUserModel model=new EditUserModel();
            ResultModel resultModel=new ResultModel();
            this.TryUpdateModel(model);
            string ErrorMessage=UserNameAvailable(model.Login,model.UserId);
            if(String.IsNullOrEmpty(ErrorMessage)==false) {
                ModelState.AddModelError("Login",ErrorMessage);
            }
            ErrorMessage=EmailAvailable(model.Email,model.UserId);
            if(String.IsNullOrEmpty(ErrorMessage)==false) {
                ModelState.AddModelError("Email",ErrorMessage);
            }
            if(model.ChangePassword) {
                if(string.IsNullOrEmpty(model.Password))
                    ModelState.AddModelError("Password","Password is required");
            }
            if(ModelState.IsValid) {
                USER user=AdminRepository.FindUser(model.UserId);
                if(user==null) {
                    user=new USER();
                    user.CreatedDate=DateTime.Now;
                }
                user.EntityID=Authentication.CurrentEntity.EntityID;
                user.LastUpdatedDate=DateTime.Now;

                user.FirstName=model.FirstName;
                user.LastName=model.LastName;
                user.MiddleName=model.MiddleName;
                user.PhoneNumber=model.PhoneNumber;
                if(model.ChangePassword) {
                    user.PasswordSalt=SecurityExtensions.CreateSalt();
                    user.PasswordHash=model.Password.CreateHash(user.PasswordSalt);
                }
                user.Login=model.Login;
                user.Email=model.Email;
                user.Enabled=model.Enabled;
                user.IsAdmin=model.IsAdmin;

                IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveUser(user);
                if(errorInfo!=null) {
                    resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
                } else {
                    resultModel.Result="True||"+user.UserID;
                }
            } 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);
        }
Пример #15
0
 public ActionResult UpdateFundClosing(FormCollection collection)
 {
     EditFundClosingModel model=new EditFundClosingModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=FundClosingNameAvailable(model.Name,model.FundClosingId,model.FundId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("Name",ErrorMessage);
     }
     if(ModelState.IsValid) {
         FundClosing fundClosing=AdminRepository.FindFundClosing(model.FundClosingId);
         if(fundClosing==null) {
             fundClosing=new FundClosing();
         }
         fundClosing.Name=model.Name;
         fundClosing.FundClosingDate=model.FundClosingDate;
         fundClosing.FundID=model.FundId;
         fundClosing.IsFirstClosing=model.IsFirstClosing;
         fundClosing.EntityID=Authentication.CurrentEntity.EntityID;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveFundClosing(fundClosing);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+fundClosing.FundClosingID;
         }
     } 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);
 }
Пример #16
0
 public ActionResult Upload(FormCollection collection)
 {
     ImportExcelFileModel model=new ImportExcelFileModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     if(model.UploadFile==null) {
         ModelState.AddModelError("UploadFile","File is required");
     }
     if(model.UploadFile!=null) {
         string ext=Path.GetExtension(model.UploadFile.FileName).ToLower();
         if(ext!=".xlsx") {
             ModelState.AddModelError("UploadFile",".xlsx files only allowed");
         }
     }
     if(ModelState.IsValid) {
         DeepBlue.Models.File.UploadFileModel uploadFileModel=UploadFileHelper.UploadTempFile(model.UploadFile);
         model.FileName=uploadFileModel.FileName;
         model.FilePath=uploadFileModel.FilePath;
     } 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";
                 }
             }
         }
     }
     resultModel.Result=JsonSerializer.ToJsonObject(new { Result=resultModel.Result,FilePath=model.FilePath,FileName=model.FileName }).ToString();
     return View("Result",resultModel);
 }
Пример #17
0
        public ActionResult CreateScheduleK1(FormCollection collection)
        {
            ScheduleK1Model model=new ScheduleK1Model();
            this.TryUpdateModel(model);
            IEnumerable<ErrorInfo> errorInfo=null;
            ResultModel resultModel=new ResultModel();
            if(ModelState.IsValid) {
                PartnersShareForm scheduleK1;
                if(model.PartnersShareFormID>0) {
                    scheduleK1=AdminRepository.FindScheduleK1((model.PartnersShareFormID??0));
                } else {
                    scheduleK1=new PartnersShareForm();
                    scheduleK1.CreatedBy=Authentication.CurrentUser.UserID;
                    scheduleK1.CreatedDate=DateTime.Now;
                }

                scheduleK1.LastUpdatedBy=Authentication.CurrentUser.UserID;
                scheduleK1.LastUpdatedDate=DateTime.Now;
                scheduleK1.EntityID=Authentication.CurrentEntity.EntityID;

                scheduleK1.AlternativeMinimumTax=model.AlternativeMinimumTax;
                scheduleK1.BeginingCapital=model.BeginingCapital;
                scheduleK1.BeginingLoss=model.BeginingLoss;
                scheduleK1.BeginingProfit=model.BeginingProfit;
                scheduleK1.BeginningCapitalAccount=model.BeginningCapitalAccount;
                scheduleK1.CapitalContributed=model.CapitalContributed;
                scheduleK1.Collectibles28GainLoss=model.Collectibles28GainLoss;
                scheduleK1.Credits=model.Credits;
                scheduleK1.CurrentYearIncrease=model.CurrentYearIncrease;
                scheduleK1.Distribution=model.Distribution;
                scheduleK1.EndingCapital=model.EndingCapital;
                scheduleK1.EndingCapitalAccount=model.EndingCapitalAccount;
                scheduleK1.EndingLoss=model.EndingLoss;
                scheduleK1.EndingProfit=model.EndingProfit;
                scheduleK1.ForeignTransaction=model.ForeignTransaction;
                scheduleK1.FundID=model.FundID;
                scheduleK1.GuaranteedPayment=model.GuaranteedPayment;
                scheduleK1.InterestIncome=model.InterestIncome;
                scheduleK1.IRSCenter=model.IRSCenter;
                scheduleK1.IsDomesticPartner=model.IsDomesticPartner;
                scheduleK1.IsForeignPartner=model.IsForeignPartner;
                scheduleK1.IsGAAP=model.IsGAAP;
                scheduleK1.IsGain=model.IsGain;
                scheduleK1.IsGeneralPartner=model.IsGeneralPartner;
                scheduleK1.IsLimitedPartner=model.IsLimitedPartner;
                scheduleK1.IsOther=model.IsOther;
                scheduleK1.IsPTP=model.IsPTP;
                scheduleK1.IsSection704=model.IsSection704;
                scheduleK1.IsTaxBasis=model.IsTaxBasis;
                scheduleK1.NetLongTermCapitalGainLoss=model.NetLongTermCapitalGainLoss;
                scheduleK1.NetRentalRealEstateIncome=model.NetRentalRealEstateIncome;
                scheduleK1.NetSection1231GainLoss=model.NetSection1231GainLoss;
                scheduleK1.NetShortTermCapitalGainLoss=model.NetShortTermCapitalGainLoss;
                scheduleK1.NonRecourse=model.NonRecourse;
                scheduleK1.OrdinaryBusinessIncome=model.OrdinaryBusinessIncome;
                scheduleK1.OrdinaryDividends=model.OrdinaryDividends;
                scheduleK1.OtherDeduction=model.OtherDeduction;
                scheduleK1.OtherIncomeLoss=model.OtherIncomeLoss;
                scheduleK1.OtherInformation=model.OtherInformation;
                scheduleK1.OtherNetRentalIncomeLoss=model.OtherNetRentalIncomeLoss;
                scheduleK1.PartnerEIN=model.PartnerEIN;
                scheduleK1.PartnershipEIN=model.PartnershipEIN;
                scheduleK1.PartnerType=model.PartnerType;
                scheduleK1.QualifiedDividends=model.QualifiedDividends;
                scheduleK1.QualifiedNonRecourseFinancing=model.QualifiedNonRecourseFinancing;
                scheduleK1.Recourse=model.Recourse;
                scheduleK1.Royalties=model.Royalties;
                scheduleK1.Section179Deduction=model.Section179Deduction;
                scheduleK1.SelfEmploymentEarningLoss=model.SelfEmploymentEarningLoss;
                scheduleK1.TaxExemptIncome=model.TaxExemptIncome;
                scheduleK1.UnderlyingFundID=model.UnderlyingFundID;
                scheduleK1.UnrecapturedSection1250Gain=model.UnrecapturedSection1250Gain;
                scheduleK1.WithdrawalsAndDistributions=model.WithdrawalsAndDistributions;

                Address partnerAddress=null;

                if(model.PartnerAddressID>0) {
                    partnerAddress=AdminRepository.FindAddress((model.PartnerAddressID??0));
                }

                if(partnerAddress==null) {
                    partnerAddress=new Address();
                    partnerAddress.CreatedBy=Authentication.CurrentUser.UserID;
                    partnerAddress.CreatedDate=DateTime.Now;
                }

                partnerAddress.LastUpdatedBy=Authentication.CurrentUser.UserID;
                partnerAddress.LastUpdatedDate=DateTime.Now;
                partnerAddress.EntityID=Authentication.CurrentEntity.EntityID;
                partnerAddress.Address1=model.PartnerAddress1;
                partnerAddress.Address2=model.PartnerAddress2;
                partnerAddress.AddressTypeID=(int)DeepBlue.Models.Admin.Enums.AddressType.Work;
                partnerAddress.City=model.PartnerCity;
                partnerAddress.Country=model.PartnerCountry;
                partnerAddress.State=model.PartnerState;
                partnerAddress.PostalCode=model.PartnerZip;
                errorInfo=AdminRepository.SaveAddress(partnerAddress);

                if(errorInfo==null) {
                    scheduleK1.PartnerAddressID=partnerAddress.AddressID;
                    errorInfo=AdminRepository.SaveScheduleK1(scheduleK1);
                }

                if(errorInfo!=null) {
                    foreach(var err in errorInfo.ToList()) {
                        resultModel.Result+=err.PropertyName+" : "+err.ErrorMessage+"\n";
                    }
                }
            } 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);
        }