public UserOrderHistoryDetail(Entity.Order order) { this.OrderId = order.OrderId; this.TimeSubmitted = order.TimeSubmitted; this.AmountPaid = order.AmountPaid; this.StoreName = order.Location.Name; }
public int CreateOrder(Entity.Order order, string shoppingCartId) { decimal orderTotal = 0; var cartItems = GetCartItems(shoppingCartId); foreach (var item in cartItems) { var orderDetails = new OrderDetail { Album = item.Album, Order = order, UnitPrice = item.Album.Price, Quantity = item.Count }; new OrderDetailsManager().Save(orderDetails); orderTotal += (item.Count * item.Album.Price); } order.Total = orderTotal; new OrderManager().Save(order); EmptyCart(shoppingCartId); return(order.Id); }
public int CreateOrder(Entity.Order order) { if (order.TaxRate == null) { order.TaxRate = order.DefaultTaxRate; } int idOrder = orderRepository.InsertWithIdReturn(order); return(idOrder); }
public int Create(OrderView item) { Models.Entity.Order order = new Entity.Order() { id = item.id, email_order = item.email_order, address_order = item.address_order, phone_order = item.phone_order, id_customer = item.id_customer, order_date = item.order_date, total = item.total, status = item.status }; database.Orders.Add(order); database.SaveChanges(); return(order.id); }
/// <summary> /// Adds a new item to the order list. /// </summary> /// <param name="order">The order to be added.</param> /// <param name="itemQuantity">The quantity of items in the order.</param> public void AddSummaryItem(Entity.Order order, int itemQuantity) { var summaryItem = new StoreOrderSummaryItem(); summaryItem.ItemQuantity = itemQuantity; summaryItem.Price = order.AmountPaid; summaryItem.TimeSubmitted = order.TimeSubmitted; summaryItem.OrderId = order.OrderId; this.Items.Add(summaryItem); }
public void AddHistoryItem(Entity.Order order, int itemQuantity) { // TODO: handle cast error var historyItem = new UserOrderHistoryItem(); historyItem.OrderId = order.OrderId; historyItem.TimeSubmitted = order.TimeSubmitted; historyItem.AmountPaid = order.AmountPaid; historyItem.ItemQuantity = itemQuantity; this.orders.Add(historyItem); }
public TOut MapTo <TOut>(Entity.Order value) where TOut : class, new() { // All of the mappings with `NotifyGenerator.Tests.Concept.Entity` as input, // which output should we choose? if (typeof(TOut) == typeof(NotifyGenerator.Tests.Concept.ViewModel.Order)) { // Map this sucka! return(new TOut()); } return(default);
public bool CreateOrder(List <OrderDetail> details, Entity.Order order) { db.Orders.Add(order); db.SaveChanges(); int orderId = order.OrderId; if (orderId > 0) { foreach (var item in details) { item.OrderId = orderId; db.OrderDetails.Add(item); } var isOk = db.SaveChanges(); if (isOk > 0) { return(true); } } return(false); }
/// <summary> /// Retrieves the customer's currently open order for a location. /// <remarks> /// If the customer has no open order for the location, a new one will be /// created, so this method will always return an order object. /// </remarks> /// </summary> /// <param name="user">User to get order from.</param> /// <param name="location">Location to check.</param> /// <returns>Order for the location.</returns> public async Task <Order> GetOpenOrder(User user, Location location) { var currentOrder = await _context.Orders .Include(o => o.Location) .Where(o => o.User.UserId == user.UserId) .Where(o => o.TimeSubmitted == null) .Where(o => o.Location.LocationId == location.LocationId) .Select(o => o) .SingleOrDefaultAsync(); if (currentOrder == null) { var newOrder = new Entity.Order(user, location); _context.Add(newOrder); await _context.SaveChangesAsync(); return(newOrder); } else { return(currentOrder); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Charset = "utf-8"; string Action = context.Request["Action"].ToString(); string result = "{\"result\":\"failed\"}"; string openid = ""; if (!string.IsNullOrEmpty(Action)) { switch (Action) { case "order": var orderdata = context.Request["orderdata"].ToString(); string _statusid = "1"; string _statusStr = "NotPaid"; AllTrustUs.SquirrelPocket.Entity.Order _o = JsonUtility.Deserialize <AllTrustUs.SquirrelPocket.Entity.Order>(orderdata); if (Convert.ToDecimal(_o.actualprice) == 0) { _statusid = "2"; _statusStr = "PaidSuccessed"; } string insjson = @"insert into t_order(openid,outtradeno,fruittype,unitprice,startdate,enddate,days, count,deliveryaddr,user,mp,totalprice,status,createdate,statusid,deliverystatus,otheraddr,GiftCardCode,deduction,actualprice,agencylevel,discount) values({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21});select @@IDENTITY;"; insjson = string.Format(insjson, UtilityFn.formatstring(_o.openid), UtilityFn.formatstring(UtilityFn.GenerateOutTradeNo()), UtilityFn.formatstring(_o.fruittype), UtilityFn.formatstring(_o.unitprice), UtilityFn.formatstring(_o.startdate), UtilityFn.formatstring(_o.enddate), UtilityFn.formatstring(_o.days), UtilityFn.formatstring(_o.count), UtilityFn.formatstring(_o.deliveryaddr), UtilityFn.formatstring(_o.user), UtilityFn.formatstring(_o.mp), UtilityFn.formatstring(_o.totalprice), UtilityFn.formatstring(_statusStr), UtilityFn.formatstring(DateTime.Now.ToString("yyyy/MM/dd HH:mm")), UtilityFn.formatstring(_statusid), UtilityFn.formatstring("未配送"), UtilityFn.formatstring(_o.otheraddr), UtilityFn.formatstring(_o.GiftCardCode), UtilityFn.formatstring(_o.deduction), UtilityFn.formatstring(_o.actualprice), UtilityFn.formatstring(_o.agencylevel), UtilityFn.formatstring(_o.discount) ); DataTable order = MySqlHelp.ExecuteDataTable(insjson); if (order.Rows.Count > 0 && int.Parse(order.Rows[0][0].ToString()) > 0) { var orderid = order.Rows[0][0].ToString(); if (!string.IsNullOrEmpty(_o.GiftCardCode)) { var updatecard = "update giftcard set isused='1',usedorderid='" + orderid + "',useddate='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where giftcardcode='" + _o.GiftCardCode.Replace("-", "") + "'"; MySqlHelp.ExecuteNonQuery(updatecard); } foreach (AllTrustUs.SquirrelPocket.Entity.OrderFruit of in _o.fruits) { string insof = @"insert into t_orderfruts(orderid,fruitid,name,unit,unitprice,count,price,fruitNum,cost) values({0},{1},{2},{3},{4},{5},{6},{7},{8});"; insof = string.Format(insof, UtilityFn.formatstring(orderid), UtilityFn.formatstring(of.FruitID), UtilityFn.formatstring(of.Name), UtilityFn.formatstring(string.IsNullOrEmpty(of.unit) ? "个" : of.unit), UtilityFn.formatstring(of.unitprice), UtilityFn.formatstring(string.IsNullOrEmpty(of.count) ? "1" : of.count), UtilityFn.formatstring(of.price), UtilityFn.formatstring(of.fruitNum), UtilityFn.formatstring(of.cost) ); MySqlHelp.ExecuteNonQuery(insof); } foreach (Entity.Delivery de in _o.deliverys) { string insdeli = @"insert into t_delivery(orderid,date,count,status) values({0},{1},{2},{3});select @@IDENTITY;"; insdeli = string.Format(insdeli, UtilityFn.formatstring(orderid), UtilityFn.formatstring(de.Date), UtilityFn.formatstring(de.Count), UtilityFn.formatstring("未配送")); DataTable deliDT = MySqlHelp.ExecuteDataTable(insdeli); if (deliDT.Rows.Count > 0 && int.Parse(deliDT.Rows[0][0].ToString()) > 0) { var deliID = deliDT.Rows[0][0].ToString(); foreach (Entity.Deliveryfruits def in de.Deliveryfruits) { string insdelif = @"insert into t_deliveryfruits(deliveryid,fruitid,name) values({0},{1},{2});"; insdelif = string.Format(insdelif, UtilityFn.formatstring(deliID), UtilityFn.formatstring(def.FruitID), UtilityFn.formatstring(def.Name)); MySqlHelp.ExecuteNonQuery(insdelif); } } } EmailHelper eh = new EmailHelper(); eh.SendMail("Squirel New Order Create", UtilityFn.JsonToHTMLTable(_o.ToJSONString())); result = "{\"result\":\"successed\",\"orderid\":\"" + orderid + "\"}"; } break; case "getorder": openid = context.Request["openid"].ToString(); var status = context.Request["status"].ToString(); List <Entity.Order> _Orders = new List <Entity.Order>(); string getsql = "select * from t_order where openid=" + UtilityFn.formatstring(openid) + " and status=" + UtilityFn.formatstring(status) + " and status<>'deleted' order by statusid asc, createdate desc"; DataTable odDT = MySqlHelp.ExecuteDataTable(getsql); for (int i = 0; i < odDT.Rows.Count; i++) { Entity.Order orderentity = new Entity.Order(); orderentity.openid = odDT.Rows[i]["openid"].ToString(); orderentity.fruittype = odDT.Rows[i]["fruittype"].ToString(); orderentity.startdate = odDT.Rows[i]["startdate"].ToString(); orderentity.enddate = odDT.Rows[i]["enddate"].ToString(); orderentity.days = odDT.Rows[i]["days"].ToString(); orderentity.count = odDT.Rows[i]["count"].ToString(); orderentity.deliveryaddr = odDT.Rows[i]["deliveryaddr"].ToString(); orderentity.user = odDT.Rows[i]["user"].ToString(); orderentity.mp = odDT.Rows[i]["mp"].ToString(); orderentity.totalprice = odDT.Rows[i]["totalprice"].ToString(); orderentity.outtradeno = odDT.Rows[i]["outtradeno"].ToString(); orderentity.status = odDT.Rows[i]["status"].ToString(); orderentity.orderid = odDT.Rows[i]["orderid"].ToString(); orderentity.createdate = odDT.Rows[i]["createdate"].ToString(); orderentity.unitprice = odDT.Rows[i]["unitprice"].ToString(); orderentity.otheraddr = odDT.Rows[i]["otheraddr"].ToString(); orderentity.deduction = odDT.Rows[i]["deduction"].ToString(); orderentity.actualprice = odDT.Rows[i]["actualprice"].ToString(); string getfruitssql = "select * from t_orderfruts where orderid=" + UtilityFn.formatstring(orderentity.orderid); DataTable frDT = MySqlHelp.ExecuteDataTable(getfruitssql); orderentity.fruits = new List <Entity.OrderFruit>(); for (int j = 0; j < frDT.Rows.Count; j++) { Entity.OrderFruit ordereFruitntity = new Entity.OrderFruit(); ordereFruitntity.FruitID = frDT.Rows[j]["fruitid"].ToString(); ordereFruitntity.Name = frDT.Rows[j]["name"].ToString(); orderentity.fruits.Add(ordereFruitntity); } _Orders.Add(orderentity); } result = "{\"result\":\"successed\",\"orders\":" + JsonUtility.ToJSONString(_Orders) + "}"; break; case "cancelorder": string cancelorderid = context.Request["orderid"].ToString(); MySqlHelp.ExecuteNonQuery("update t_order set status='Canceled',statusid='5' where orderid=" + UtilityFn.formatstring(cancelorderid)); result = "{\"result\":\"successed\"}"; break; case "deleteorder": string deleteorderorderid = context.Request["orderid"].ToString(); MySqlHelp.ExecuteNonQuery("update t_order set status='Deleted',statusid='4' where orderid=" + UtilityFn.formatstring(deleteorderorderid)); result = "{\"result\":\"successed\"}"; break; case "saveuserinfo": string userdata = context.Request["userdata"].ToString(); openid = context.Request["openid"].ToString(); Dictionary <string, object> Dic = JsonUtility.ToDictionary(userdata); var nickname = Dic["nickname"].ToString(); var country = Dic["country"].ToString(); var province = Dic["province"].ToString(); var city = Dic["city"].ToString(); var sex = ""; if (!string.IsNullOrEmpty(Dic["sex"].ToString())) { if (Dic["sex"].ToString().Contains("男")) { sex = "1"; } else { sex = "2"; } } else { sex = "1"; } var mp = Dic["mp"].ToString(); ((WeXUser)context.Session["CurrentWeXUser"]).MP = mp; ((WeXUser)context.Session["CurrentWeXUser"]).city = city; ((WeXUser)context.Session["CurrentWeXUser"]).country = country; ((WeXUser)context.Session["CurrentWeXUser"]).nickname = nickname; ((WeXUser)context.Session["CurrentWeXUser"]).sex = sex; ((WeXUser)context.Session["CurrentWeXUser"]).province = province; MySqlHelp.ExecuteNonQuery("update t_user set mp=" + UtilityFn.formatstring(mp) + ",nickname=" + UtilityFn.formatstring(nickname) + ",country=" + UtilityFn.formatstring(country) + ",province=" + UtilityFn.formatstring(province) + ",city=" + UtilityFn.formatstring(city) + ",sex=" + UtilityFn.formatstring(sex) + " where openid=" + UtilityFn.formatstring(openid)); //((WeXUser)context.Session["CurrentWeXUser"]).MP = mp; result = "{\"result\":\"successed\"}"; break; case "getDeliveryDetail": var Deliveryorderid = context.Request["orderid"].ToString(); List <Entity.Delivery> deli = new List <Entity.Delivery>(); string Deligetsql = "select * from t_delivery where orderid=" + UtilityFn.formatstring(Deliveryorderid); DataTable DeliDT = MySqlHelp.ExecuteDataTable(Deligetsql); for (int i = 0; i < DeliDT.Rows.Count; i++) { Entity.Delivery ent = new Entity.Delivery(); ent.ID = DeliDT.Rows[i]["ID"].ToString(); ent.OrderID = Deliveryorderid; ent.Date = DeliDT.Rows[i]["Date"].ToString(); ent.Count = DeliDT.Rows[i]["Count"].ToString(); ent.deliverystatus = DeliDT.Rows[i]["status"].ToString(); deli.Add(ent); } result = "{\"result\":\"successed\",\"deliverys\":" + JsonUtility.ToJSONString(deli) + "}"; break; case "orderRefund": string orderRefundorderid = context.Request["orderid"].ToString(); DataTable orderDT = MySqlHelp.ExecuteDataTable(string.Format("select * from t_order where orderid={0}", orderRefundorderid)); var outtradeno = orderDT.Rows[0]["outtradeno"].ToString(); var transaction_id = orderDT.Rows[0]["transaction_id"].ToString(); var totalprice = orderDT.Rows[0]["totalprice"].ToString(); var actualprice = orderDT.Rows[0]["actualprice"].ToString(); try { string Refundresult = Refund.Run(transaction_id, outtradeno, (int.Parse(actualprice) * 100).ToString(), (int.Parse(actualprice) * 100).ToString()); Dictionary <string, object> di = JsonUtility.ToDictionary(Refundresult); EmailHelper eh = new EmailHelper(); if (di["result_code"].ToString().ToUpper() == "FAIL") { result = "{\"result\":\"failed\"}"; eh.SendMail("Squirel Refunded Order failed[" + orderRefundorderid + "]", UtilityFn.JsonToHTMLTable(Refundresult)); } else { result = "{\"result\":\"successed\"}"; MySqlHelp.ExecuteNonQuery(string.Format("update t_order set status='Refunded',statusid='100' where orderid={0}", orderRefundorderid)); eh.SendMail("Squirel Refunded Order Successed[" + orderRefundorderid + "]", UtilityFn.JsonToHTMLTable(Refundresult)); } Log.Info(this.GetType().ToString(), Refundresult); //Response.Write("<span style='color:#00CD00;font-size:20px'>" + result + "</span>"); } catch (WxPayException ex) { result = "{\"result\":\"failed\"}"; //Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>"); } catch (Exception ex) { result = "{\"result\":\"failed\"}"; //Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>"); } break; case "getgiftcode": string giftcode = context.Request["giftcode"].ToString().Replace("-", ""); DataTable giftcodeDT = MySqlHelp.ExecuteDataTable(string.Format("select * from giftcard where isused='0' and giftcardcode='{0}'", giftcode)); if (giftcodeDT.Rows.Count > 0) { Giftcard gc = new Giftcard(); gc.id = Convert.ToInt32(giftcodeDT.Rows[0]["id"]); gc.giftcardcode = giftcodeDT.Rows[0]["giftcardcode"].ToString(); gc.amount = giftcodeDT.Rows[0]["amount"].ToString(); gc.generatedate = giftcodeDT.Rows[0]["generatedate"].ToString(); gc.isused = giftcodeDT.Rows[0]["isused"].ToString(); gc.usedorderid = giftcodeDT.Rows[0]["usedorderid"].ToString(); gc.useddate = giftcodeDT.Rows[0]["useddate"].ToString(); gc.forcompany = giftcodeDT.Rows[0]["forcompany"].ToString(); gc.expireddate = giftcodeDT.Rows[0]["expireddate"].ToString(); result = "{\"result\":\"successed\",\"giftcard\":" + JsonUtility.ToJSONString(gc) + "}"; } else { result = "{\"result\":\"failed\"}"; } break; default: break; } } context.Response.Write(result); }
private void btnSaveandPrint_Click(object sender, EventArgs e) { Entity.Order order = new Entity.Order(); List <Entity.OrderItems> listOrderItems = new List <Entity.OrderItems>(); try { order.OrderDate = Convert.ToDateTime(dtpInvoiceDate.Text); } catch { } try { order.BillToContact = cbCustomer.Text.ToString(); } catch { } try { order.BillToEmail = txtEmailId.Text.ToString(); } catch { } try { order.BillToPhone = txtContactNo.Text.ToString(); } catch { } try { order.BillToGSTN = txtGSTN.Text.ToString(); } catch { } try { order.BillToAddress1 = txtAddressLine1.Text.ToString(); } catch { } try { order.BillToAddress2 = txtAddressLine2.Text.ToString(); } catch { } try { order.BillToCity = txtCity.Text.ToString(); } catch { } try { order.BillToState = txtState.Text.ToString(); } catch { } try { order.BillToZip = Convert.ToInt32(txtZip.Text.ToString()); } catch { } try { order.Discount = Convert.ToInt32(txtDiscount.Text.ToString()); } catch { } try { order.CGSTRate = Convert.ToInt32(txtCGST.Text.ToString()); } catch { } try { order.SGSTRate = Convert.ToInt32(txtSGST.Text.ToString()); } catch { } try { order.IGSTRate = Convert.ToInt32(txtIGST.Text.ToString()); } catch { } try { order.TaxablePrice = Convert.ToDouble(lblDiscountedPrice.Text.ToString()); } catch { } double _totalProductPrice = 0; foreach (DataGridViewRow dr in dgvProducts.Rows) { Entity.OrderItems orderItem = new Entity.OrderItems(); try { orderItem.MaterialId = Convert.ToInt32(dr.Cells["Id"].Value.ToString()); } catch { } try { orderItem.MaterialName = dr.Cells["Product Name"].Value.ToString(); } catch { } try { orderItem.HSNCode = dr.Cells["HSNCode"].Value.ToString(); } catch { } try { string val = dr.Cells["Qty"].Value.ToString(); orderItem.Quantity = Convert.ToInt32(val); } catch { } try { orderItem.UnitPrice = Convert.ToDouble(dr.Cells["Rate"].Value.ToString()); } catch { } try { orderItem.TotalPrice = Convert.ToDouble(dr.Cells["Total"].Value.ToString()); } catch { } _totalProductPrice += orderItem.TotalPrice; listOrderItems.Add(orderItem); } try { order.TotalProductPrice = Convert.ToDouble(_totalProductPrice); } catch { } try { if (!String.IsNullOrEmpty(lblGrandTotal.Text.ToString())) { order.Grandtotal = Convert.ToDouble(lblGrandTotal.Text.ToString()); } else { order.Grandtotal = Convert.ToDouble(lblDiscountedPrice.Text.ToString()); } } catch { } int response = orderBAL.addOrder(order, listOrderItems); using (Report rpt = new Report(response)) { rpt.ShowDialog(); } if (response != null && response != 0) { MessageBox.Show("Invoice saved successfully."); } else { MessageBox.Show("Something Went Wrong."); } }
private void btnSave_Click(object sender, EventArgs e) { Entity.Order order = new Entity.Order(); List <Entity.OrderItems> listOrderItems = new List <Entity.OrderItems>(); try { order.OrderDate = Convert.ToDateTime(dtpInvoiceDate.Text); } catch { } try { order.BillToContact = cbCustomer.Text.ToString(); } catch { } try { order.BillToEmail = txtEmailId.Text.ToString(); } catch { } try { order.BillToPhone = txtContactNo.Text.ToString(); } catch { } try { order.BillToGSTN = txtGSTN.Text.ToString(); } catch { } try { order.BillToAddress1 = txtAddressLine1.Text.ToString(); } catch { } try { order.BillToAddress2 = txtAddressLine2.Text.ToString(); } catch { } try { order.BillToCity = txtCity.Text.ToString(); } catch { } try { order.BillToState = txtState.Text.ToString(); } catch { } try { order.BillToZip = Convert.ToInt32(txtZip.Text.ToString()); } catch { } try { order.Discount = Convert.ToInt32(txtDiscount.Text.ToString()); } catch { } try { order.CGSTRate = Convert.ToInt32(txtCGST.Text.ToString()); } catch { } try { order.SGSTRate = Convert.ToInt32(txtSGST.Text.ToString()); } catch { } try { order.IGSTRate = Convert.ToInt32(txtIGST.Text.ToString()); } catch { } try { order.TaxablePrice = Convert.ToDouble(lblDiscountedPrice.Text.ToString()); } catch { } double _totalProductPrice = 0; foreach (DataGridViewRow dr in dgvProducts.Rows) { Entity.OrderItems orderItem = new Entity.OrderItems(); try { orderItem.MaterialId = Convert.ToInt32(dr.Cells["Id"].Value.ToString()); } catch { } try { orderItem.MaterialName = dr.Cells["Product Name"].Value.ToString(); } catch { } try { orderItem.HSNCode = dr.Cells["HSNCode"].Value.ToString(); } catch { } try { string val = dr.Cells["Qty"].Value.ToString(); orderItem.Quantity = Convert.ToInt32(val); } catch { } try { orderItem.UnitPrice = Convert.ToDouble(dr.Cells["Rate"].Value.ToString()); } catch { } try { orderItem.TotalPrice = Convert.ToDouble(dr.Cells["Total"].Value.ToString()); } catch { } _totalProductPrice += orderItem.TotalPrice; listOrderItems.Add(orderItem); } try { order.TotalProductPrice = Convert.ToDouble(_totalProductPrice); } catch { } try { if (!String.IsNullOrEmpty(lblGrandTotal.Text.ToString())) { order.Grandtotal = Convert.ToDouble(lblGrandTotal.Text.ToString()); } else { order.Grandtotal = Convert.ToDouble(lblDiscountedPrice.Text.ToString()); } } catch { } try { string s = order.Grandtotal.ToString("0.00", CultureInfo.InvariantCulture); string[] parts = s.Split('.'); int i1 = int.Parse(parts[0]); int i2 = int.Parse(parts[1]); long l1 = (long)i1; long l2 = (long)i2; string s1 = ConvertNumbertoWords(l1); string s2 = ConvertNumbertoWords(l2); string s3 = s1 + " And " + s2 + " Paise Only."; order.GrandtotalInWords = s3; } catch { } int response = orderBAL.addOrder(order, listOrderItems); //using (Report rpt = new Report(response)) //{ // rpt.ShowDialog(); //} if (response != null && response != 0) { MessageBox.Show("Invoice saved successfully."); } else { MessageBox.Show("Something Went Wrong."); } }
private void submit_Click(object sender, RoutedEventArgs e) { if (((customId.Text == string.Empty) || (firstName.Text == string.Empty) || (lastName.Text == string.Empty) || (street.Text == string.Empty) || (city.Text == string.Empty) || (zip.Text == string.Empty) || (email.Text == string.Empty) || (name.Text == string.Empty) || (country.SelectedValue == null) || !this.marked) || (this.c != "FO" && (this.ico.Text == string.Empty || this.icDph.Text == string.Empty || this.dic.Text == string.Empty || this.name.Text == string.Empty))) { System.Windows.MessageBox.Show("Musia byť vyplnené poviné údaje"); return; } if ((customId.Text.Contains(";")) || (titlePrefix.Text.Contains(";")) || (firstName.Text.Contains(";")) || (lastName.Text.Contains(";")) || (titleSuffix.Text.Contains(";")) || (street.Text.Contains(";")) || (city.Text.Contains(";")) || (zip.Text.Contains(";")) || (email.Text.Contains(";")) || (name.Text.Contains(";")) || (mobile.Text.Contains(";")) || (ico.Text.Contains(";")) || (dic.Text.Contains(";")) || (icDph.Text.Contains(";"))) { System.Windows.MessageBox.Show("Znak ; je vyhradeni, prosím zmente vstup tak aby neobsahoval znak ; "); return; } Entity.Order order = new Entity.Order(); order.products = new List<Interface.IOrderItem>(); Entity.Company company = new Entity.Company(); company.custom_id = customId.Text.ToString(); Entity.Person person = new Entity.Person(); person.titlePrefix = titlePrefix.Text.ToString(); person.firstName = firstName.Text.ToString(); person.lastName = lastName.Text.ToString(); person.titleSuffix = titleSuffix.Text.ToString(); Entity.Address address = new Entity.Address(); address.street = street.Text.ToString(); address.city = city.Text.ToString(); address.zip = zip.Text.ToString(); address.country = country.Text.ToString() == "Vyberte krajinu" ? "SVK" : country.Text.ToString(); Entity.Contact contact = new Entity.Contact(); contact.email = email.Text.ToString(); contact.mobile = mobile.Text.ToString(); company.person = person; company.address = address; company.contact = contact; switch (this.c.ToUpper()) { case "PO": { company.corporatePerson = Interface.CorporatePerson.PO; break; } default: { company.corporatePerson = Interface.CorporatePerson.FO; break; } } if (this.c.ToUpper() != "FO") { company.name = name.Text.ToString(); company.ico = ico.Text.ToString(); company.dic = dic.Text.ToString(); company.icDph = icDph.Text.ToString(); } else company.name = company.person.getFullName(); //company.id = 1; //if (Settings.Config.getCompanies().Count > 0) // company.id = Settings.Config.getCompanies().LastOrDefault(x => x.id > 0).id + 1; //order.id = 1; //if (Settings.Config.getOrders().Count > 0) // order.id = Settings.Config.getOrders().LastOrDefault(x => x.id > 0).id + 1; order.company = company; //Settings.Config.getCompanies().Add(company); //Settings.Config.getOrders().Add(order); Settings.Config.setTempOrder(order); onCreatedOrder(new EventArgs()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string openid = Request.QueryString["openid"]; string total_fee = Request.QueryString["total_fee"]; order_id = Request.QueryString["order_id"]; string ActualPay = ConfigurationManager.AppSettings["ActualPay"].ToString(); OrderPay = new Entity.Order(); DataSet orderDS = MySqlHelp.ExecuteDataSet(string.Format("select * from t_order where orderid={0};select * from t_orderfruts where orderid={0};", order_id)); if (orderDS.Tables.Count == 2) { if (orderDS.Tables[0].Rows[0]["status"].ToString() != "NotPaid") { return; } OrderPay.fruittype = orderDS.Tables[0].Rows[0]["fruittype"].ToString(); OrderPay.startdate = orderDS.Tables[0].Rows[0]["startdate"].ToString(); OrderPay.enddate = orderDS.Tables[0].Rows[0]["enddate"].ToString(); OrderPay.days = orderDS.Tables[0].Rows[0]["days"].ToString(); OrderPay.count = orderDS.Tables[0].Rows[0]["count"].ToString(); OrderPay.deliveryaddr = orderDS.Tables[0].Rows[0]["deliveryaddr"].ToString(); OrderPay.user = orderDS.Tables[0].Rows[0]["user"].ToString(); OrderPay.mp = orderDS.Tables[0].Rows[0]["mp"].ToString(); OrderPay.totalprice = orderDS.Tables[0].Rows[0]["totalprice"].ToString(); OrderPay.outtradeno = orderDS.Tables[0].Rows[0]["outtradeno"].ToString(); OrderPay.createdate = orderDS.Tables[0].Rows[0]["createdate"].ToString(); OrderPay.unitprice = orderDS.Tables[0].Rows[0]["unitprice"].ToString(); OrderPay.deduction = orderDS.Tables[0].Rows[0]["deduction"].ToString(); OrderPay.actualprice = orderDS.Tables[0].Rows[0]["actualprice"].ToString(); for (int i = 0; i < orderDS.Tables[1].Rows.Count; i++) { if (OrderPay.fruittype.Contains("社区预定")) //{ // Fruitslist += orderDS.Tables[1].Rows[i]["name"].ToString() + ";"; //} //else { Fruitslist += orderDS.Tables[1].Rows[i]["name"].ToString() + (Convert.ToInt32(orderDS.Tables[1].Rows[i]["fruitNum"]) * Convert.ToInt32(orderDS.Tables[1].Rows[i]["count"])).ToString() + orderDS.Tables[1].Rows[i]["unit"] + ";"; divunit.Visible = false; divdelivery.Visible = false; } } } else { return; } //return; //检测是否给当前页面传递了相关参数 if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(total_fee) || string.IsNullOrEmpty(order_id)) { Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面传参出错,请返回重试" + "</span>"); Log.Error(this.GetType().ToString(), "This page have not get params, cannot be inited, exit..."); //submit.Visible = false; return; } //若传递了相关参数,则调统一下单接口,获得后续相关接口的入口参数 JsApiPay jsApiPay = new JsApiPay(this); jsApiPay.openid = openid; try { if (Convert.ToBoolean(ActualPay)) { jsApiPay.total_fee = int.Parse(total_fee); } else { jsApiPay.total_fee = 1; } } catch (Exception ex) { Response.Write(ex.Message + ex.StackTrace); } //jsApiPay.total_fee = 1; //JSAPI支付预处理 WxPayData unifiedOrderResult = new WxPayData(); try { unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(OrderPay.outtradeno); wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 Log.Debug(this.GetType().ToString(), "wxJsApiParam : " + wxJsApiParam); //在页面上显示订单信息 //Response.Write("<span style='color:#00CD00;font-size:20px'>订单详情:</span><br/>"); //Response.Write("<span style='color:#00CD00;font-size:20px'>" + unifiedOrderResult.ToPrintStr() + "</span>"); } catch (Exception ex) { Response.Write("<span style='color:#FF0000;font-size:20px;margin-left:10px'>" + "初始化失败,无法支付,请返回重试。" + "</span>"); //Response.Write("<span style='color:#00CD00;font-size:20px'>" + unifiedOrderResult.ToPrintStr() + "</span>"); //Response.Write("wxJsApiParam : " + wxJsApiParam); divbutton.Visible = false; } } }
public ViewModel.Order ToOrder(Entity.Order value) { return(new ViewModel.Order { }); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { canRefund = false; order_id = Request.QueryString["order_id"]; OrderPay = new Entity.Order(); DataSet orderDS = MySqlHelp.ExecuteDataSet(string.Format("select * from t_order where orderid={0};select * from t_orderfruts where orderid={0};", order_id)); if (orderDS.Tables.Count == 2) { OrderPay.openid = orderDS.Tables[0].Rows[0]["openid"].ToString(); OrderPay.fruittype = orderDS.Tables[0].Rows[0]["fruittype"].ToString(); OrderPay.startdate = orderDS.Tables[0].Rows[0]["startdate"].ToString(); OrderPay.enddate = orderDS.Tables[0].Rows[0]["enddate"].ToString(); OrderPay.days = orderDS.Tables[0].Rows[0]["days"].ToString(); OrderPay.count = orderDS.Tables[0].Rows[0]["count"].ToString(); OrderPay.deliveryaddr = orderDS.Tables[0].Rows[0]["deliveryaddr"].ToString(); OrderPay.user = orderDS.Tables[0].Rows[0]["user"].ToString(); OrderPay.mp = orderDS.Tables[0].Rows[0]["mp"].ToString(); OrderPay.totalprice = orderDS.Tables[0].Rows[0]["totalprice"].ToString(); OrderPay.outtradeno = orderDS.Tables[0].Rows[0]["outtradeno"].ToString(); OrderPay.createdate = orderDS.Tables[0].Rows[0]["createdate"].ToString(); OrderPay.unitprice = orderDS.Tables[0].Rows[0]["unitprice"].ToString(); OrderPay.deliverystatus = orderDS.Tables[0].Rows[0]["deliverystatus"].ToString(); OrderPay.otheraddr = orderDS.Tables[0].Rows[0]["otheraddr"].ToString(); OrderPay.deduction = orderDS.Tables[0].Rows[0]["deduction"].ToString(); OrderPay.actualprice = orderDS.Tables[0].Rows[0]["actualprice"].ToString(); OrderPay.ExpressNumber = orderDS.Tables[0].Rows[0]["ExpressNumber"].ToString(); switch (orderDS.Tables[0].Rows[0]["status"].ToString()) { case "NotPaid": OrderPay.status = "未支付"; break; case "PaidSuccessed": OrderPay.status = "已支付"; if (DateTime.Compare(DateTime.Now, Convert.ToDateTime(OrderPay.startdate)) < 0) { canRefund = true; } break; case "Completed": OrderPay.status = "已完成"; break; case "Canceled": OrderPay.status = "已取消"; break; case "Expiry": OrderPay.status = "已过期"; break; case "Refunded": OrderPay.status = "已退款"; break; default: break; } for (int i = 0; i < orderDS.Tables[1].Rows.Count; i++) { if (OrderPay.fruittype.Contains("社区预定")) //{ // Fruitslist += orderDS.Tables[1].Rows[i]["name"].ToString() + ";"; //} //else { Fruitslist += orderDS.Tables[1].Rows[i]["name"].ToString() + (Convert.ToInt32(orderDS.Tables[1].Rows[i]["fruitNum"]) * Convert.ToInt32(orderDS.Tables[1].Rows[i]["count"])).ToString() + orderDS.Tables[1].Rows[i]["unit"] + ";"; divunit.Visible = false; divdelivery.Visible = false; divdeliverystatus.Visible = true; } } } } }