public void SetUp() { addDataForTesting.DeleteInstallments(); addDataForTesting.DeleteCreditContract(); addDataForTesting.DeletedProject(); addDataForTesting.DeleteInstallmentTypes(); addDataForTesting.DeleteTiers(); addDataForTesting.DeleteAllUser(); addDataForTesting.AddGenericFundingLine(); collateral = addDataForTesting.AddCollateral(); biWeekly = addDataForTesting.AddBiWeeklyInstallmentType(); package.Id = addDataForTesting.AddGenericPackage(); package.Name = "Package"; user.Id = addDataForTesting.AddUserWithIntermediaryAttributs(); //addDataForTesting.AddGenericFundingLine(); tiers.Id = addDataForTesting.AddGenericTiersIntoDatabase(OClientTypes.Group); tiers.LoanCycle = 1; _project = new Project(); _project.ProjectStatus = OProjectStatus.Refused; _project.Name = "NotSet"; _project.Code = "NotSet"; _project.Aim = "NotSet"; _project.BeginDate = TimeProvider.Today; _project.Id = projectManager.Add(_project, tiers.Id, null); //fundingLine = new FundingLine("AFD130",false); credit = new Loan(new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisioningTable.GetInstance(new User())); credit.LoanOfficer = user; credit.BranchCode = "DU"; credit.CreationDate = DateTime.Today.AddDays(-1); credit.StartDate = DateTime.Today; credit.CloseDate = DateTime.Today.AddDays(1); credit.Closed = true; credit.Rural = true; credit.Product = package; credit.Amount = 1000m; credit.InterestRate = 3; credit.InstallmentType = biWeekly; credit.NbOfInstallments = 2; credit.NonRepaymentPenalties.InitialAmount = 2.5; credit.AnticipatedRepaymentPenalties = 1.2; credit.Disbursed = false; credit.LoanOfficer = user; credit.FundingLine = new FundingLine { Name = "AFD130" }; credit.EntryFees = 2.05; credit.WriteOff = false; credit.Rescheduled = false; credit.BadLoan = false; credit.AddInstallment(installment1); credit.AddInstallment(installment2); }
async Task getPosition() { Collateral col = null; try { col = await client.GetMyCollateral(); } catch (Exception ex) { label2.Text = "Failed to get collateral info."; label3.Text = ""; label6.Text = ex.ToString(); return; } label2.Text = "Equity: " + Math.Round(col.CollateralAmount, 1).ToString() + " JPY, Margin: " + Math.Round(col.KeepRate * 100, 2).ToString() + " %"; List <Position> pos = null; try { pos = await client.GetMyPositions(); } catch (Exception ex) { label3.Text = "Failed to get position info."; label6.Text = ex.ToString(); return; } double average = 0; positions = 0; foreach (Position ps in pos) { average += (ps.Size * ps.Price); positions += ps.Size; } if (pos.Count == 0) { label8.Text = "Ave: "; label3.Text = "No Open Position."; label3.ForeColor = Color.Black; } else { label8.Text = "Ave: " + Math.Round(average / positions, 1).ToString(); label3.Text = pos[0].Side + ss[1] + positions.ToString() + " BTC, PL: " + (0 < col.OpenPositionProfitAndLoss ? "+" : "") + Math.Round(col.OpenPositionProfitAndLoss, 1).ToString() + " JPY"; if (0 <= col.OpenPositionProfitAndLoss) { label3.ForeColor = Color.Blue; } else { label3.ForeColor = Color.Red; } } }
/// <summary> /// 保存抵押物信息 /// </summary> /// <param name="Collaterals"></param> /// <param name="auditId"></param> public void SaveCollaterals <T>(ICollection <Collateral> collaterals, string auditId) where T : class, new() { var type = typeof(T); if (type.Equals(typeof(CollateralAudit))) { CollateralAuditDAL caDAL = new CollateralAuditDAL(); foreach (var model in collaterals) { #region 抵押物信息 CollateralAudit caModel = new CollateralAudit() { ID = Guid.NewGuid().ToString(), AuditID = auditId, CollateralType = model.CollateralType, HouseNumber = model.HouseNumber, BuildingName = model.BuildingName, Address = model.Address, RightOwner = model.RightOwner, HouseSize = model.HouseSize, Sequence = model.Sequence, CompletionDate = model.CompletionDate, LandType = model.LandType, HouseType = model.HouseType, TotalHeight = model.TotalHeight }; #endregion 抵押物信息 #region 房屋文件保存 caModel.HouseFile = SaveFiles(model.HouseFile, caModel.ID, auditId); #endregion 房屋文件保存 caDAL.Add(caModel); //保存抵押物信息 } } else if (type.Equals(typeof(Collateral))) { CollateralDAL caDAL = new CollateralDAL(); foreach (var model in collaterals) { #region 抵押物信息 Collateral caModel = new Collateral() { ID = Guid.NewGuid().ToString(), CollateralType = model.CollateralType, HouseNumber = model.HouseNumber, BuildingName = model.BuildingName, Address = model.Address, RightOwner = model.RightOwner, HouseSize = model.HouseSize, CaseID = auditId, Sequence = model.Sequence, CompletionDate = model.CompletionDate, LandType = model.LandType, HouseType = model.HouseType, TotalHeight = model.TotalHeight }; #endregion 抵押物信息 #region 房屋文件保存 caModel.HouseFile = SaveFiles(model.HouseFile, caModel.ID, auditId); #endregion 房屋文件保存 caDAL.Add(caModel); //保存抵押物信息 } } }
public Tier(TierLevel level, Collateral collateral) { Level = level; Collateral = collateral; }
public IActionResult Upsert(CollateralVM collateralVM) { UserDetails(); CartCount(); if (ModelState.IsValid) { string webRootPath = _hostEnvironment.WebRootPath; var files = HttpContext.Request.Form.Files; if (files.Count > 0) { string fileName = Guid.NewGuid().ToString(); var uploads = Path.Combine(webRootPath, @"img\CorpComm\Collaterals"); var extension = Path.GetExtension(files[0].FileName); if (collateralVM.Collateral.ImgUrl != null) { // this is an edit and we need to remove old image var imagePath = Path.Combine(webRootPath, collateralVM.Collateral.ImgUrl.TrimStart('\\')); if (System.IO.File.Exists(imagePath)) { System.IO.File.Delete(imagePath); } } using (var fileStreams = new FileStream(Path.Combine(uploads, fileName + extension), FileMode.Create)) { files[0].CopyTo(fileStreams); } collateralVM.Collateral.ImgUrl = @"\img\CorpComm\Collaterals\" + fileName + extension; } else { // only for update when they do not change the image if (collateralVM.Collateral.Id != 0) { Collateral objFromDb = _unitOfWork.Collateral.Get(collateralVM.Collateral.Id); collateralVM.Collateral.ImgUrl = objFromDb.ImgUrl; } } if (collateralVM.Collateral.Id == 0) { _unitOfWork.Collateral.Add(collateralVM.Collateral); } else { _unitOfWork.Collateral.Update(collateralVM.Collateral); } _unitOfWork.Save(); return(RedirectToAction(nameof(Index))); } else { collateralVM.SizeList = _unitOfWork.Size.GetAll().Select(i => new SelectListItem { Text = i.Name, Value = i.Id.ToString() }); collateralVM.UnitList = _unitOfWork.Unit.GetAll().Select(i => new SelectListItem { Text = i.Name, Value = i.Id.ToString() }); collateralVM.BrandList = _unitOfWork.Brand.GetAll().Select(i => new SelectListItem { Text = i.Name, Value = i.Id.ToString() }); collateralVM.LocationList = _unitOfWork.Location.GetAll().Select(i => new SelectListItem { Text = i.Name, Value = i.Id.ToString() }); if (collateralVM.Collateral.Id != 0) { collateralVM.Collateral = _unitOfWork.Collateral.Get(collateralVM.Collateral.Id); } } return(View(collateralVM)); }
public IActionResult Transfer(CollateralVM collateralVM, int qtyfrom) { Collateral objMinusItem = _unitOfWork.Collateral.Get(collateralVM.Collateral.Id); objMinusItem.Count -= qtyfrom; History histMinus = new History(); if (collateralVM.Collateral.Id != 0) { histMinus.LoginUser = ViewBag.DisplayName; histMinus.CollateralId = objMinusItem.Id; histMinus.CollateralName = objMinusItem.Name; histMinus.Quantity = qtyfrom; histMinus.RequestDate = DateTime.Now;; if (SD.collateralName == SD.DO_Edsa) { histMinus.ReconRemarks = "Transfered (" + qtyfrom + ") to " + SD.DO_LKG; } if (SD.collateralName == SD.DO_LKG) { histMinus.ReconRemarks = "Transfered (" + qtyfrom + ") to " + SD.DO_Edsa; } _unitOfWork.History.Add(histMinus); _unitOfWork.Save(); } if (SD.collateralName == SD.DO_LKG) { Collateral collateral = _unitOfWork.Collateral.GetFirstOrDefault(c => c.Name == SD.collateralLoc && c.LocationId != SD.collateralLocId); collateral.Count += qtyfrom; History histPlusEdsa = new History(); if (collateralVM.Collateral.Id != 0) { histPlusEdsa.LoginUser = ViewBag.DisplayName; histPlusEdsa.CollateralId = collateral.Id; histPlusEdsa.CollateralName = collateral.Name; histPlusEdsa.Quantity = qtyfrom; histPlusEdsa.RequestDate = DateTime.Now;; histPlusEdsa.ReconRemarks = "Transfered (" + qtyfrom + ") from " + SD.DO_LKG; _unitOfWork.History.Add(histPlusEdsa); _unitOfWork.Save(); } } if (SD.collateralName == SD.DO_Edsa) { Collateral collateral = _unitOfWork.Collateral.GetFirstOrDefault(c => c.Name == SD.collateralLoc && c.LocationId != SD.collateralLocId); collateral.Count += qtyfrom; History histPlusLKG = new History(); if (collateralVM.Collateral.Id != 0) { histPlusLKG.LoginUser = ViewBag.DisplayName; histPlusLKG.CollateralId = collateral.Id; histPlusLKG.CollateralName = collateral.Name; histPlusLKG.Quantity = qtyfrom; histPlusLKG.RequestDate = DateTime.Now;; histPlusLKG.ReconRemarks = "Transfered (" + qtyfrom + ") from " + SD.DO_Edsa; _unitOfWork.History.Add(histPlusLKG); _unitOfWork.Save(); } _unitOfWork.Save(); } return(RedirectToAction(nameof(Index))); }
public IActionResult ForDeliveryRequest() { OrderHeader orderHeader = _unitOfWork.OrderHeader .GetFirstOrDefault(u => u.Id == OrderVM.OrderHeader.Id); // change status from "Approved" to "For Deliver" orderHeader.OrderStatus = SD.StatusForDelivery; orderHeader.RequestType = OrderVM.OrderHeader.RequestType; orderHeader.ShippingDate = OrderVM.OrderHeader.ShippingDate; orderHeader.PickUpPoints = OrderVM.OrderHeader.PickUpPoints; _unitOfWork.Save(); #region Email Process var OrderId = OrderVM.OrderHeader.Id; #region get order details for email OrderVMEmail = new OrderDetailsVM() { OrderHeader = _unitOfWork.OrderHeader.GetFirstOrDefault(u => u.Id == OrderId), OrderDetails = _unitOfWork.OrderDetails.GetAll(o => o.OrderId == OrderId, includeProperties: "Collateral") }; string itemlist = ""; var itemname = ""; int itemcount; foreach (var item in OrderVMEmail.OrderDetails) { itemname = item.Collateral.Name; itemcount = item.Count; itemlist += "<tr>" + " <td align='center'>" + itemname + "</td>" + " <td align='center'>" + itemcount + "</td>" + "</tr>"; } #endregion get order details for email _unitOfWork.Save(); #endregion Email Process #region History Process var orderDetails = _unitOfWork.OrderDetails.GetAll(u => u.OrderId == OrderVM.OrderHeader.Id); foreach (var order in orderDetails) { OrderHeader orderHeader2 = _unitOfWork.OrderHeader.GetFirstOrDefault(u => u.Id == OrderVM.OrderHeader.Id); // taken the stocks after approval Collateral collateral = _unitOfWork.Collateral.Get(order.CollateralId.Value); collateral.Count -= order.Count; // insert details to history History history = new History(); history.RequestId = orderHeader.Id; history.RequestDate = orderHeader.OrderDate; history.LoginUser = orderHeader.LoginUser; history.CollateralName = collateral.Name; history.CollateralId = collateral.Id; history.EventType = orderHeader.EventName; history.Quantity = order.Count; history.StationEvent = orderHeader.StationEvent; history.EventDate = orderHeader.EventDate; history.ShippingDate = orderHeader.ShippingDate; history.DropOffPoint = orderHeader.PickUpPoints; history.rating = orderHeader.OrderRating; _unitOfWork.History.Add(history); _unitOfWork.Save(); } #endregion History Process //string hereurl; SD.Template = null; SD.Subject = null; SD.Subject2 = null; SD.OrderId = null; SD.ShippingDate = null; SD.PickUpPoints = null; SD.LoginUser = null; SD.RequestorEmail = null; SD.RejectReason = null; SD.clickhere = null; SD.items = null; SD.Template = "2"; SD.Subject = "PTT COLLATERALS: Your request is now for delivery!"; SD.Subject2 = "FOR DELIVERY"; SD.OrderId = OrderId.ToString(); SD.ShippingDate = OrderVM.OrderHeader.ShippingDate.ToShortDateString(); SD.PickUpPoints = OrderVM.OrderHeader.PickUpPoints; SD.LoginUser = OrderVM.OrderHeader.LoginUser; SD.RequestorEmail = OrderVM.OrderHeader.RequestorEmail; SD.RejectReason = ""; //hereurl = SD.IntranetLink + "CorpComm/Collateral/Catalog"; SD.clickhere = "Your request has been approved and is now for delivery."; SD.items = itemlist; return(RedirectToAction(nameof(SendEmail))); }
public override void VisitCollateral(Collateral n) { VisitDeclarationClass(n); }