public IList<OrdersInfo> GetYearOrders() { SqlHelper objSqlHelper = new SqlHelper(); List<OrdersInfo> orders = new List<OrdersInfo>(); SqlDataReader reader = objSqlHelper.ExecuteReader("je_Order_GetYearOrders"); while (reader.Read()) { OrdersInfo item = new OrdersInfo(); item.Year = reader.GetInt32(reader.GetOrdinal("OrderYear")); orders.Add(item); } reader.Close(); return orders; }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { checkCount(); OrdersInfo order = new OrdersInfo(); long orderID =Convert.ToInt64(DateTime.Now.ToString("yyyyMMddhhmmss")); Response.Cookies["orderID"].Value = orderID.ToString(); Response.Cookies["orderID"].Expires = DateTime.Now.AddDays(1); AddressInfo address = Address.GetAddressByID(); //定单编号,用户,送货用户,地址,邮编,电话 order.OrderID = orderID; order.UserName = address.UserName; order.AddressName = address.AddressName; order.Address = address.Address; order.Post = address.Post; order.Telephone = address.Telephone; //省份,城市,送货方式,付款方式 order.Province = address.Province; order.City = address.City; order.SendType = address.SendType; order.PayType = address.PayType; //是否开发票,图书价格,送货费用,总价格,留言 order.EnableInvoice =Convert.ToBoolean(InvoiceList.SelectedValue); order.BookPrice = Convert.ToDecimal(Session["orderPrice"].ToString().Substring(1)); order.SendPrice = Convert.ToDecimal(sendPrice.Text.Substring(1)); order.SumPrice = Convert.ToDecimal(sumPrice.Text.Substring(1)); order.BalancePrice = Convert.ToDecimal(balancePay.Text); order.NeedPayPrice = Convert.ToDecimal(needBalancePay.Text); order.TgPrice = 0; order.IsTg = false; order.Message = messageTxt.Text; Orders.InsertOrders(order); Address.UpdateAddressBalance(order.BalancePrice); try { EmailSend es = new EmailSend(); es.sendOrderEmail(orderID.ToString(), sumPrice.Text.Substring(1)); } catch (Exception) { } finally { Response.Redirect("shoppingComplete.aspx"); } }
protected void saveOrder_ServerClick(object sender, EventArgs e) { OrderTypeCheckBoxList orderTypeList = (OrderTypeCheckBoxList)FormView2.FindControl("OrderTypeCheckBoxList1"); OrdersInfo order = new OrdersInfo(); order.IsPass = orderTypeList.Items[0].Selected; order.IsPay = orderTypeList.Items[1].Selected; order.IsSended = orderTypeList.Items[2].Selected; order.IsFinished = orderTypeList.Items[3].Selected; order.IsCancel = orderTypeList.Items[4].Selected; order.OrderID = Convert.ToInt64(Request.QueryString["orderID"]); OrdersInfo orders = Orders.GetOrdersByID(order.OrderID); for (int ChBox = 0; ChBox < orderTypeList.Items.Count; ChBox++) { if (orderTypeList.Items[ChBox].Selected == true) { order.OrderStatus = ChBox; } } if (!orders.IsSended && order.IsSended) { //库存 foreach (OrderDetailInfo detail in Orders.GetDerailByID(order.OrderID)) { Book.UpdateStockCount(detail.BookID, detail.Quantity); } } //if (!orders.IsPay && orderTypeList.Items[1].Selected) //{ // Orders.UpdateOrderPayByID(orders.NeedPayPrice, order.OrderID); // decimal BalancePrice=(orders.BookPrice-orders.TgPrice)*-1; // Address.UpdateAddressBalance(BalancePrice); //} if (!orders.IsSended && orderTypeList.Items[2].Selected) { Orders.UpdateOrderDateByID(order.OrderID); } Orders.UpdateOrderTypeByID(order); Response.Redirect("orderList.aspx"); }
public OrdersInfo GetOrdersByID(long orderID) { SqlHelper objSqlHelper = new SqlHelper(); SqlParameter[] objParams = new SqlParameter[1]; objParams[0] = new SqlParameter("@orderID", SqlDbType.BigInt); objParams[0].Value = orderID; SqlDataReader reader = objSqlHelper.ExecuteReader("je_Order_GetOrderByID", objParams); OrdersInfo item = new OrdersInfo(); while (reader.Read()) { item.OrderID = reader.GetInt64(reader.GetOrdinal("OrderID")); item.UserName = reader.GetString(reader.GetOrdinal("UserName")); item.AddDate = reader.GetDateTime(reader.GetOrdinal("addDate")); item.BookPrice = reader.GetDecimal(reader.GetOrdinal("BookPrice")); item.SendPrice = reader.GetDecimal(reader.GetOrdinal("SendPrice")); item.SumPrice = reader.GetDecimal(reader.GetOrdinal("SumPrice")); item.SendType = reader.GetInt32(reader.GetOrdinal("SendType")); item.PayType = reader.GetInt32(reader.GetOrdinal("PayType")); item.UserName = reader.GetString(reader.GetOrdinal("UserName")); item.AddressName = reader.GetString(reader.GetOrdinal("AddressName")); item.Telephone = reader.GetString(reader.GetOrdinal("Telephone")); item.IsPass = reader.GetBoolean(reader.GetOrdinal("IsPass")); item.IsPay = reader.GetBoolean(reader.GetOrdinal("IsPay")); item.IsSended = reader.GetBoolean(reader.GetOrdinal("IsSended")); item.IsCancel = reader.GetBoolean(reader.GetOrdinal("IsCancel")); item.IsFinished = reader.GetBoolean(reader.GetOrdinal("IsFinished")); item.Address = reader.GetString(reader.GetOrdinal("Address")); item.Post = reader.GetString(reader.GetOrdinal("Post")); item.OrderStatus = reader.GetInt32(reader.GetOrdinal("OrderStatus")); item.IsTg = reader.GetBoolean(reader.GetOrdinal("IsTg")); item.BalancePrice = reader.GetDecimal(reader.GetOrdinal("BalancePrice")); item.NeedPayPrice = reader.GetDecimal(reader.GetOrdinal("NeedPayPrice")); item.OtherPayPrice = reader.GetDecimal(reader.GetOrdinal("OtherPayPrice")); item.TgPrice = reader.GetDecimal(reader.GetOrdinal("TgPrice")); item.SendDate = reader.GetDateTime(reader.GetOrdinal("SendDate")); } reader.Close(); return item; }
public int UpdateOrderTypeByID(OrdersInfo order) { SqlHelper objSqlHelper = new SqlHelper(); SqlParameter[] objParams = new SqlParameter[7]; objParams[0] = new SqlParameter("@orderID", order.OrderID); objParams[1] = new SqlParameter("@IsPass", order.IsPass); objParams[2] = new SqlParameter("@IsPay", order.IsPay); objParams[3] = new SqlParameter("@IsSended", order.IsSended); objParams[4] = new SqlParameter("@IsFinished", order.IsFinished); objParams[5] = new SqlParameter("@IsCancel", order.IsCancel); objParams[6] = new SqlParameter("@OrderStatus", order.OrderStatus); return objSqlHelper.ExecuteNonQuery("je_Order_UpdateType", objParams); }
public void InsertOrders(OrdersInfo order) { SqlHelper objSqlHelper = new SqlHelper(); SqlParameter[] objParams = new SqlParameter[19]; //定单编号,用户,送货用户,地址,邮编,电话 objParams[0] = new SqlParameter("@OrderID", order.OrderID); objParams[1] = new SqlParameter("@UserName", order.UserName); objParams[2] = new SqlParameter("@AddressName", order.AddressName); objParams[3] = new SqlParameter("@Address", order.Address); objParams[4] = new SqlParameter("@Post", order.Post); objParams[5] = new SqlParameter("@Telephone", order.Telephone); //省份,城市,送货方式,付款方式, objParams[6] = new SqlParameter("@Province", order.Province); objParams[7] = new SqlParameter("@City", order.City); objParams[8] = new SqlParameter("@SendType", order.SendType); objParams[9] = new SqlParameter("@PayType", order.PayType); //是否开发票,图书价格,送货费用,总价格,留言 objParams[10] = new SqlParameter("@EnableInvoice", order.EnableInvoice); objParams[11] = new SqlParameter("@BookPrice", order.BookPrice); objParams[12] = new SqlParameter("@SendPrice", order.SendPrice); objParams[13] = new SqlParameter("@SumPrice", order.SumPrice); objParams[14] = new SqlParameter("@Message", order.Message); objParams[15] = new SqlParameter("@IsTg", order.IsTg); objParams[16] = new SqlParameter("@BalancePrice", order.BalancePrice); objParams[17] = new SqlParameter("@NeedPayPrice", order.NeedPayPrice); objParams[18] = new SqlParameter("@TgPrice", order.TgPrice); objSqlHelper.ExecuteNonQuery("je_Order_InsertOrders", objParams); }
/// <summary> /// 更新订单信息 /// </summary> /// <returns></returns> public static int UpdateOrderTypeByID(OrdersInfo order) { return orders.UpdateOrderTypeByID(order); }
/// <summary> /// 添加订单信息 /// </summary> /// <param name="link"></param> public static void InsertOrders(OrdersInfo order) { orders.InsertOrders(order); }