Exemplo n.º 1
0
        public ActionResult CreateReceiveCapitalCall(FormCollection collection)
        {
            CreateReceiveModel model=new CreateReceiveModel();
            ResultModel resultModel=new ResultModel();
            this.TryUpdateModel(model);
            if(ModelState.IsValid) {

                // Attempt to create receive capital call.

                Models.Entity.CapitalCall capitalCall=CapitalCallRepository.FindCapitalCall(model.CapitalCallId);
                if(capitalCall!=null) {
                    CapitalCallLineItem item;
                    capitalCall.CapitalAmountCalled=model.CapitalAmountCalled;
                    capitalCall.CapitalCallDate=model.CapitalCallDate;
                    capitalCall.CapitalCallDueDate=model.CapitalCallDueDate;
                    capitalCall.LastUpdatedBy=Authentication.CurrentUser.UserID;
                    capitalCall.LastUpdatedDate=DateTime.Now;
                    int index;
                    for(index=1;index<model.ItemCount+1;index++) {
                        item=capitalCall.CapitalCallLineItems.SingleOrDefault(capitalCallItem => capitalCallItem.CapitalCallLineItemID==Convert.ToInt32(collection[index.ToString()+"_"+"CapitalCallLineItemId"]));
                        if(item!=null) {
                            item.LastUpdatedBy=Authentication.CurrentUser.UserID;
                            item.LastUpdatedDate=DateTime.Now;
                            if(string.IsNullOrEmpty(collection[index.ToString()+"_"+"CapitalAmountCalled"])==false) {
                                item.CapitalAmountCalled=Convert.ToDecimal(collection[index.ToString()+"_"+"CapitalAmountCalled"]);
                            }
                            if(string.IsNullOrEmpty(collection[index.ToString()+"_"+"ManagementFees"])==false) {
                                item.ManagementFees=Convert.ToDecimal(collection[index.ToString()+"_"+"ManagementFees"]);
                            }
                            if(string.IsNullOrEmpty(collection[index.ToString()+"_"+"InvestmentAmount"])==false) {
                                item.InvestmentAmount=Convert.ToDecimal(collection[index.ToString()+"_"+"InvestmentAmount"]);
                            }
                            if(string.IsNullOrEmpty(collection[index.ToString()+"_"+"InvestedAmountInterest"])==false) {
                                item.InvestedAmountInterest=Convert.ToDecimal(collection[index.ToString()+"_"+"InvestedAmountInterest"]);
                            }
                            if(string.IsNullOrEmpty(collection[index.ToString()+"_"+"ManagementFeeInterest"])==false) {
                                item.ManagementFeeInterest=Convert.ToDecimal(collection[index.ToString()+"_"+"ManagementFeeInterest"]);
                            }
                            if(string.IsNullOrEmpty(collection[index.ToString()+"_"+"Received"])==false) {
                                if(collection[index.ToString()+"_"+"Received"].Contains("true")) {
                                    if(string.IsNullOrEmpty(collection[index.ToString()+"_"+"ReceivedDate"])==false) {
                                        item.ReceivedDate=Convert.ToDateTime(collection[index.ToString()+"_"+"ReceivedDate"]);
                                    }
                                } else {
                                    item.ReceivedDate=null;
                                }
                            }
                            if((item.ReceivedDate??Convert.ToDateTime("01/01/1900")).Year<=1900) {
                                item.ReceivedDate=null;
                            }
                        }
                    }
                    IEnumerable<ErrorInfo> errorInfo=CapitalCallRepository.SaveCapitalCall(capitalCall);
                    resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
                }
            }
            if(ModelState.IsValid==false) {
                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);
        }
Exemplo n.º 2
0
 public JsonResult FindCapitalCall(int id)
 {
     CreateReceiveModel model=new CreateReceiveModel();
     Models.Entity.CapitalCall capitalCall=CapitalCallRepository.FindCapitalCall(id);
     if(capitalCall!=null) {
         model.FundId=capitalCall.Fund.FundID;
         model.FundName=capitalCall.Fund.FundName;
         model.CapitalCallNumber=capitalCall.CapitalCallNumber;
         model.CapitalAmountCalled=capitalCall.CapitalAmountCalled;
         model.CapitalCallDate=capitalCall.CapitalCallDate;
         model.CapitalCallDueDate=capitalCall.CapitalCallDueDate;
         model.CapitalCallId=capitalCall.CapitalCallID;
         model.Items=new List<CapitalCallLineItemDetail>();
         int index=0;
         foreach(var item in capitalCall.CapitalCallLineItems) {
             index++;
             model.Items.Add(new CapitalCallLineItemDetail {
                 Index=index,
                 InvestorName=item.Investor.InvestorName,
                 CapitalAmountCalled=item.CapitalAmountCalled,
                 InvestedAmountInterest=item.InvestedAmountInterest??0,
                 CapitalCallLineItemId=item.CapitalCallLineItemID,
                 InvestmentAmount=item.InvestedAmountInterest??0,
                 ManagementFeeInterest=item.ManagementFeeInterest??0,
                 ManagementFees=item.ManagementFees??0,
                 Received=(item.ReceivedDate.HasValue?true:false),
                 ReceivedDate=((item.ReceivedDate??Convert.ToDateTime("01/01/1900")).Year<=1900?string.Empty:(item.ReceivedDate??Convert.ToDateTime("01/01/1900")).ToString("MM/dd/yyyy"))
             });
         }
     }
     return Json(model,JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 3
0
 public ActionResult Receive(int? id,int? fundId)
 {
     ViewData["MenuName"]="FundManagement";
     ViewData["SubmenuName"]="Capital Call";
     ViewData["PageName"]="Receive Capital Call";
     CreateReceiveModel model=new CreateReceiveModel();
     model.CapitalCallId=id??0;
     model.FundId=fundId??0;
     model.CapitalCalls=new List<SelectListItem>();
     model.CapitalCalls.Add(new SelectListItem {
         Value="0",
         Text="--Select One--",
         Selected=false
     });
     model.Items=new List<CapitalCallLineItemDetail>();
     model.Items.Add(new CapitalCallLineItemDetail());
     return View(model);
 }