public async Task <BuyerInfo> GetById(Guid id) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(_options.Value.DefaultConnection)) { var sql = $@"select b.Id, a.*, c.* from Person a join PersonUnit b on a.Id = b.PersonId join Unit c on b.UnitId = c.Id where b.Id = @Id"; var param = new { Id = id }; var result = await connection.QueryAsync <Entities.PersonUnit, Entities.Person, Entities.Unit, BuyerInfo>(sql, (personUnit, person, unit) => { var res = new BuyerInfo() { Id = personUnit.Id, PersonId = person.Id, Name = person.Name, Address = person.Address, UnitId = unit.Id, ProjectName = unit.ProjectName, CondoUnit = unit.CondoUnit, LoanAmount = unit.LoanAmount, Term = unit.Term, StartOfPayment = unit.StartOfPayment, InterestRate = unit.InterestRate }; return(res); }, param).ConfigureAwait(false); return(result.FirstOrDefault()); } }
public async Task <IEnumerable <BuyerInfo> > GetAll() { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(_options.Value.DefaultConnection)) { var sql = @"select b.Id, a.*, c.* from Person a join PersonUnit b on a.Id = b.PersonId join Unit c on b.UnitId = c.Id"; return(await connection.QueryAsync <Entities.PersonUnit, Entities.Person, Entities.Unit, BuyerInfo>(sql, (personUnit, person, unit) => { var res = new BuyerInfo() { Id = personUnit.Id, PersonId = person.Id, Name = person.Name, Address = person.Address, UnitId = unit.Id, ProjectName = unit.ProjectName, CondoUnit = unit.CondoUnit, LoanAmount = unit.LoanAmount, Term = unit.Term, StartOfPayment = unit.StartOfPayment, InterestRate = unit.InterestRate }; return res; }).ConfigureAwait(false)); } }
public async Task <IActionResult> PutBuyerInfo(int id, BuyerInfo buyerInfo) { if (id != buyerInfo.BuyerInfoID) { return(BadRequest()); } _context.Entry(buyerInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BuyerInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Info(int sellerId, int productId) { string msg; ProductInfo productInfo = null; BuyerInfo user = Session["User"] as BuyerInfo; if (user == null) { return(View(productInfo)); } productInfo = ProductInfoBll.GetModel(sellerId, productId, out msg); var list = BuyerInfoBll.GetBuyerProductView(user.BuyerId, sellerId); BuyerProductView productInfo1 = list.FirstOrDefault(p => p.ProductId == productId); if (productInfo == null) { productInfo = new ProductInfo() { ProductFullName = "商品信息有误" } } ; return(View(productInfo)); }
internal void AddTotal(List <TotalItem> totalItems, double TotalPrice, List <string> Buyers, string OrderPartitionID) { this.contents.body.contents.Add(new TotalTitleBox()); foreach (TotalItem TotalItem in totalItems) { this.contents.body.contents.Add(new TotalItemBox(TotalItem.Item, TotalItem.Amount)); //加入品項 foreach (string Buyer in Buyers) //檢查每個訂餐者是否有針對此品項備註 { UserStatus userStatus = new UserStatus(Buyer); BuyerInfo buyer = new BuyerInfo(); buyer.OrderPartitionID = OrderPartitionID; buyer.BuyerID = Buyer; List <BuyerInfo> list = buyer.SelectItemAndAmontByBuyerID(); //選出訂餐者的訂餐細節 foreach (BuyerInfo BuyerInfo in list) //處理訂餐細節 { if (TotalItem.Item == BuyerInfo.Item) { if (BuyerInfo.Note != "no") { this.contents.body.contents.Add(new NoteBox($"Note:{BuyerInfo.Note} ")); } } } } } this.contents.body.contents.Add(new TotalPrice(TotalPrice)); }
public async Task <IActionResult> CreateAmortizationSchedule([FromBody] BuyerInfo model) { var buyerInfoId = model.Id; if (buyerInfoId == Guid.Empty) { buyerInfoId = await _buyerInfoService.SaveBuyerInfo(model).ConfigureAwait(false); if (buyerInfoId == null) { return(BadRequest()); } model.Id = buyerInfoId; } var result = await _amortizationScheduleService.CreateSchedule(model).ConfigureAwait(false); if (result == null) { return(BadRequest()); } return(Ok(result)); }
public async Task <ActionResult <BuyerInfo> > PostBuyerInfo(BuyerInfo buyerInfo) { _context.BuyerInfos.Add(buyerInfo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBuyerInfo", new { id = buyerInfo.BuyerInfoID }, buyerInfo)); }
public async Task <int> UpdateBuyerInfo(BuyerInfo model) { // should I regenerate schedule when updated? var result = await _buyerInfoService.UpdateBuyerInfo(model).ConfigureAwait(false); return(result); }
public PartialViewResult GetCategorysProduct(int sellerId = 0, int classId = 0) { List <BuyerProductView> productViews = new List <BuyerProductView>(); BuyerInfo user = Session["User"] as BuyerInfo; if (user == null) { return(PartialView(productViews)); } List <BuyerProductView> list = new List <BuyerProductView>(); if (classId == 0) { list = BuyerInfoBll.GetBuyerProductView(user.BuyerId, sellerId); } else { ViewBag.SelectType = "class"; list = BuyerInfoBll.GetBuyerProductView(user.BuyerId, sellerId, classId); } return(PartialView(list)); }
internal static ConfirmTemplate MakeDeletOrderItem(string message, int QIDnow, int OIDnow, string BuyerInfoID, string userId, string channelAccessToken) { var actions = new List <isRock.LineBot.TemplateActionBase>(); NextHelper nextHelper = new NextHelper(QIDnow, OIDnow); QuestionDetail questionDetailNext = nextHelper.GetNext(); CancelHelper cancelHelper = new CancelHelper(QIDnow, OIDnow); QuestionDetail questionDetailCancel = cancelHelper.GetCancel(); BuyerInfo buyerInfo = new BuyerInfo(); buyerInfo.ID = int.Parse(BuyerInfoID); buyerInfo.SelectAllByBuyerInfoID(); message = "缺定要刪除?"; actions.Add(new isRock.LineBot.PostbackAction() { label = "確定", data = $"{DateTime.Now},{questionDetailNext.QID},{questionDetailNext.OID},{BuyerInfoID}" }); actions.Add(new isRock.LineBot.PostbackAction() { label = "取消", data = $"{DateTime.Now},{questionDetailCancel.QID},{questionDetailCancel.OID},{buyerInfo.Item},{BuyerInfoID}" }); var ConfirmTemplateMsg = new isRock.LineBot.ConfirmTemplate() { altText = "替代文字(在無法顯示Confirm Template的時候顯示)", text = message, actions = actions //設定回覆動作 }; return(ConfirmTemplateMsg); }
public CreditCardEventArgs(Guid instanceId, BuyerInfo buyer, decimal price, string trackingNumber) : base(instanceId) { this.Buyer = buyer; this.Price = price; this.TrackingNumber = trackingNumber; }
public ActionResult DeleteConfirmed(int id) { BuyerInfo buyerInfo = db.BuyerInfo.Find(id); db.BuyerInfo.Remove(buyerInfo); db.SaveChanges(); Success("Deleted successfully !!", true); return(RedirectToAction("Index")); }
private List <AmortizationSchedule> BuildSchedule(BuyerInfo model) { try { // initial values var date = model.StartOfPayment; var noOfDays = (date - DateTime.Now).TotalDays; var rate = (decimal)(model.InterestRate / 100); var interest = model.LoanAmount * (decimal)noOfDays * rate / 365; var principal = model.LoanAmount / model.Term; var balance = model.LoanAmount - principal; var schedule = new List <AmortizationSchedule>(); schedule.Add(new AmortizationSchedule() { Id = Guid.NewGuid(), PersonUnitId = model.Id, Date = date, Principal = principal, Interest = interest, LoanAmount = model.LoanAmount, NoOfDays = noOfDays, Total = principal + interest, Balance = balance }); for (var i = 1; i < model.Term; i++) { // succeeding values date = schedule[i - 1].Date.AddMonths(1); noOfDays = (date - schedule[i - 1].Date).TotalDays; interest = schedule[i - 1].Balance * (decimal)noOfDays * rate / 365; balance = schedule[i - 1].Balance - principal; var item = new AmortizationSchedule() { Id = Guid.NewGuid(), PersonUnitId = model.Id, Date = date, Principal = principal, Interest = interest, LoanAmount = model.LoanAmount, NoOfDays = noOfDays, Total = principal + interest, Balance = balance }; schedule.Add(item); } return(schedule); } catch (DivideByZeroException) { return(null); } }
public void save() { BuyerInfo buyer = new BuyerInfo(); buyer.Name = txtBillingName.Text; buyer.Email = txtBillingEmail.Text; buyer.Address = txtBillingAddress1.Text; buyer.CreatedDate = DateTime.Now; buyer.IsonlinePayment = false; buyer.IsSuccessful = false; BuyerInfo.Save(buyer); }
public async Task <IActionResult> SaveBuyerInfo([FromBody] BuyerInfo model) { var result = await _buyerInfoService.SaveBuyerInfo(model).ConfigureAwait(false); if (result == null) { return(BadRequest()); } return(Ok(result)); }
public async Task <IActionResult> CreateAmortizationSchedule([FromBody] BuyerInfo model) { var result = await _service.CreateAmortizationSchedule(model).ConfigureAwait(false); if (result == null) { return(BadRequest()); } return(Ok(_mapper.Map <AmortizationScheduleDTO[]>(result))); }
// POST: odata/BuyerInfoes public IHttpActionResult Post(BuyerInfo buyerInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BuyerInfos.Add(buyerInfo); db.SaveChanges(); return(Created(buyerInfo)); }
protected void btnPaypalCheckout_Click(object sender, EventArgs e) { BuyerInfo buyer = new BuyerInfo(); buyer.Name = txtBillingName.Text; buyer.Email = txtBillingEmail.Text; buyer.Address = txtBillingAddress1.Text; buyer.CreatedDate = DateTime.Now; buyer.IsonlinePayment = true; buyer.IsSuccessful = false; BuyerInfo.Save(buyer); Response.Redirect("~/Order.aspx"); }
public PartialViewResult GetCategorysProduct(int sellerId = 0, int classId = 0) { BuyerInfo user = Session["User"] as BuyerInfo; if (user == null) { return(PartialView("NeedLogin")); } var list = BuyerInfoBll.GetBuyerProductView(user.BuyerId, sellerId, classId); return(PartialView(list)); }
public async Task <BuyerInfo> SaveBuyerInfo(BuyerInfo model) { var id = await _buyerInfoService.SaveBuyerInfo(model).ConfigureAwait(false); var result = await _buyerInfoService.GetBuyerInfoById(id).ConfigureAwait(false); if (result == null) { return(null); } return(result); }
// GET: BuyerInfo/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BuyerInfo buyerInfo = db.BuyerInfo.Find(id); if (buyerInfo == null) { return(HttpNotFound()); } return(View(buyerInfo)); }
// GET: BuyerInfo/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BuyerInfo buyerInfo = db.BuyerInfo.Find(id); if (buyerInfo == null) { return(HttpNotFound()); } ViewBag.BankBranchId = new SelectList(db.BankBranch.Where(x => x.IsForeign == true).Select(x => new { Id = x.Id, Name = x.Name + " - " + x.BranchName }), "Id", "Name", buyerInfo.BankBranchId); ViewBag.MerchandiserId = new SelectList(db.CompanyResources, "Id", "Name", buyerInfo.MerchandiserId); ViewBag.CountryInfoId = new SelectList(db.CountryInfo, "Id", "Name", buyerInfo.CountryInfoId); ViewBag.MiddlePartyId = new SelectList(db.MiddleParty, "Id", "Name", buyerInfo.MiddlePartyId); //List<SelectListItem> paymentType = new List<SelectListItem>() //{ // new SelectListItem { Text = "LC", Value = "0" }, // new SelectListItem { Text = "TT", Value = "1" } //}; var paymentType = new SelectList(new List <SelectListItem> { new SelectListItem { Text = "LC", Value = "0" }, new SelectListItem { Text = "TT", Value = "1" }, }, "Value", "Text", buyerInfo.PaymentTypeId); ViewBag.PaymentTypeId = paymentType; //List<SelectListItem> paymentTerm = new List<SelectListItem>() //{ // new SelectListItem { Text = "At Sight", Value = "0" }, // new SelectListItem { Text = "From BL", Value = "1" } //}; //ViewBag.PaymentTerm = paymentTerm; var paymentTerm = new SelectList(new List <SelectListItem> { new SelectListItem { Text = "At Sight", Value = "0" }, new SelectListItem { Text = "From BL", Value = "1" }, }, "Value", "Text", buyerInfo.PaymentTerm); ViewBag.PaymentTerm = paymentTerm; return(View(buyerInfo)); }
public void Index() { PropertyBag["buyertype"] = typeof(BuyerInfo); BuyerInfo defaultBuyer = new BuyerInfo(); defaultBuyer.Name = "Louis DeJardin"; defaultBuyer.Card = "abcdefg"; defaultBuyer.ExpiresYear = 2018; defaultBuyer.ExpiresMonth = 12; PropertyBag["buyer"] = defaultBuyer; PropertyBag["price"] = 23.95; }
// DELETE: odata/BuyerInfoes(5) public IHttpActionResult Delete([FromODataUri] int key) { BuyerInfo buyerInfo = db.BuyerInfos.Find(key); if (buyerInfo == null) { return(NotFound()); } db.BuyerInfos.Remove(buyerInfo); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "Id,Name,NameShort,Address,ContactPerson,ContactPhone,CountryInfoId,MerchandiserId,MiddlePartyId,BankBranchId,PaymentTypeId,Tenor,PaymentTerm,BuyerGroup,OpeningBalance,BalanceDate")] BuyerInfo buyerInfo) { if (ModelState.IsValid) { if (db.BuyerInfo.Where(x => x.Name == buyerInfo.Name).Count() > 0) { Danger("Same name exists!! Try different.", true); } else { buyerInfo.OpBy = 1; buyerInfo.OpOn = DateTime.Now; db.BuyerInfo.Add(buyerInfo); db.SaveChanges(); Success("Saved successfully !!", true); return(RedirectToAction("Index")); } } ViewBag.BankBranchId = new SelectList(db.BankBranch.Where(x => x.IsForeign == true).Select(x => new { Id = x.Id, Name = x.Name + " - " + x.BranchName }), "Id", "Name", buyerInfo.BankBranchId); ViewBag.MerchandiserId = new SelectList(db.CompanyResources, "Id", "Name", buyerInfo.MerchandiserId); ViewBag.CountryInfoId = new SelectList(db.CountryInfo, "Id", "Name", buyerInfo.CountryInfoId); ViewBag.MiddlePartyId = new SelectList(db.MiddleParty, "Id", "Name", buyerInfo.MiddlePartyId); var paymentType = new SelectList(new List <SelectListItem> { new SelectListItem { Text = "LC", Value = "0" }, new SelectListItem { Text = "TT", Value = "1" }, }, "Value", "Text", buyerInfo.PaymentTypeId); ViewBag.PaymentTypeId = paymentType; var paymentTerm = new SelectList(new List <SelectListItem> { new SelectListItem { Text = "At Sight", Value = "0" }, new SelectListItem { Text = "From BL", Value = "1" }, }, "Value", "Text", buyerInfo.PaymentTerm); ViewBag.PaymentTerm = paymentTerm; return(View(buyerInfo)); }
public static void BuyerInfo2Buyer(BuyerInfo source, Buyer target) { if (source == null) { throw new ArgumentNullException("source can not null."); } if (target == null) { target = new Buyer(); } target.Id = source.BuyerId.ToString(); target.Tin = source.BuyerTin; target.Name = source.BuyerName; target.Address = source.BuyerAddress; target.TelPhone = source.BuyerTel; }
public ActionResult BuyerEntry() { var Product = _db.Product.ToList(); // ViewBag.Product = new SelectList(Product); BuyerInfo buyerinfo = new BuyerInfo(); Product product = new Product(); CommunicationMedium medium = new CommunicationMedium(); CommunicationFrom communicator = new CommunicationFrom(); website web = new website(); Source source = new Source(); Communication communication = new Communication(); return(View(buyerinfo)); }
internal static string DeletBuyerInfoItem(int QIDnow, int OIDnow, int BuyerInfoID, string userId) { BuyerInfo buyerInfo = new BuyerInfo(); buyerInfo.ID = BuyerInfoID; int result = buyerInfo.DeletByBuyerInfoID(); if (result > 0) { return("刪除成功"); } else { return("刪除失敗"); } }
public PaymentReceipt(decimal amount, Currencies currency, PaymentMethods method, string referenceCode, DocumentRegistrationInfo invoiceInfo, string accommodationName, DateTime checkInDate, DateTime checkOutDate, List <ReceiptItemInfo> receiptItems, BuyerInfo buyerDetails, string clientName = default) { Amount = amount; Currency = currency; Method = method; ReferenceCode = referenceCode; InvoiceInfo = invoiceInfo; CustomerName = clientName ?? string.Empty; BuyerDetails = buyerDetails; AccommodationName = accommodationName; CheckInDate = checkInDate; CheckOutDate = checkOutDate; ReceiptItems = receiptItems; }
public IHttpActionResult SaveBuyers(BuyerInfo buyer) { //if(!ModelState.IsValid) //{ // return Ok(); //} try { if (buyer.BuyerId > 0) { var existBuyer = _db.BuyerInfos.FirstOrDefault(x => x.BuyerId == buyer.BuyerId); existBuyer.AlternativeNumber = buyer.AlternativeNumber; existBuyer.BuyerCompany = buyer.BuyerCompany; existBuyer.ContactPersonDesignation = buyer.ContactPersonDesignation; existBuyer.BuyerPriority = buyer.BuyerPriority; existBuyer.BuyerSource = buyer.BuyerSource; existBuyer.IsBuyerInterested = buyer.IsBuyerInterested; existBuyer.BuyerWebsiteName = buyer.BuyerWebsiteName; existBuyer.ContactNumber = buyer.ContactNumber; existBuyer.ContactPerson = buyer.ContactPerson; existBuyer.Date = buyer.Date; existBuyer.Email = buyer.Email; existBuyer.Extension = buyer.Extension; existBuyer.SourceWebLink = buyer.SourceWebLink; existBuyer.Website = buyer.Website; existBuyer.ProductLookingFor = buyer.ProductLookingFor; _db.SaveChanges(); // existBuyer.IsBuyerSubmitted = true; return(Ok(existBuyer)); } else { buyer.BuyerId = Id++; buyer.Date = DateTime.Now; _db.BuyerInfos.Add(buyer); _db.SaveChanges(); // buyer.IsBuyerSubmitted = true; } return(Ok(buyer)); } catch (Exception exception) { return(InternalServerError(exception)); } }
public BuyerInfo GetModelByLoginName(string loginName, string connectionString, out string errMsg) { BuyerInfo model = null; errMsg = string.Empty; try { PredicateGroup pdg = new PredicateGroup(); pdg.Predicates = new List <IPredicate>(); pdg.Predicates.Add(Predicates.Field <BuyerInfo>(o => o.LoginName, Operator.Eq, loginName)); model = GetModel(pdg, connectionString, out errMsg); } catch (Exception ex) { Logger.LogError4Exception(ex, "AppLogger"); } return(model); }
public async Task <IEnumerable <AmortizationSchedule> > CreateSchedule(BuyerInfo buyerInfo) { if (buyerInfo.Id == Guid.Empty) { return(null); } var amortizationSchedule = BuildSchedule(buyerInfo); if (amortizationSchedule == null) { return(null); } await _amortizationScheduleRepository.InsertSet(amortizationSchedule); return(amortizationSchedule); }
internal static int Save(BuyerInfo buyer) { using (OleDbCommand cmd = new OleDbCommand()) { try { string SaveString = "INSERT INTO Buyer ( Name, Email, Address, CreatedDate, IsonlinePayment, IsSuccessful) VALUES (Name,@Email,@Address,@CreatedDate,@IsonlinePayment,@IsSuccessful)"; // string UpdateString = "UPDATE Catagory SET CatagoryName =@CatagoryName, Description =@Description where CatagoryID=" + catagory.CatagoryID + ";"; cmd.Parameters.Add(new OleDbParameter("@Name", OleDbType.VarChar, 250)); cmd.Parameters.Add(new OleDbParameter("@Email", OleDbType.VarChar, 2500)); cmd.Parameters.Add(new OleDbParameter("@Address", OleDbType.VarChar, 2500)); cmd.Parameters.Add(new OleDbParameter("@CreatedDate", OleDbType.Date, 25000)); cmd.Parameters.Add(new OleDbParameter("@IsonlinePayment", OleDbType.Boolean, 2500)); cmd.Parameters.Add(new OleDbParameter("@IsSuccessful", OleDbType.Boolean, 25000)); cmd.Parameters["@Name"].Value = buyer.Name; cmd.Parameters["@Email"].Value = buyer.Email; cmd.Parameters["@Address"].Value = buyer.Address; cmd.Parameters["@CreatedDate"].Value = buyer.CreatedDate; cmd.Parameters["@IsonlinePayment"].Value = buyer.IsonlinePayment; cmd.Parameters["@IsSuccessful"].Value = buyer.IsSuccessful; if (buyer.BuyerID == 0) { cmd.CommandText = SaveString; } // else { cmd.CommandText = UpdateString; } int a = BaseDB.ExecuteNonQuery(cmd); return a; } catch (Exception e) { throw e; } } }
public static void Save(BuyerInfo buyer) { BuyerInfoData.Save(buyer); }