public OrderForm(Order _order) { order = _order; InitializeComponent(); }
public static List<Order> Orders_GetAll() { string query = "Orders_GetAll"; DataTable dt = Connection.runQuery(query, new SqlParameter[0]); List<Order> res = new List<Order>(); for (int i = 0; i < dt.Rows.Count; i++) { Order tmp = new Order(); tmp.ID = Convert.ToInt32(dt.Rows[i]["ID"].ToString()); tmp.CustomerID = Convert.ToInt32(dt.Rows[i]["CustomerID"].ToString()); tmp.PayingType = Convert.ToInt32(dt.Rows[i]["PayingType"].ToString()); tmp.Date = Convert.ToDateTime(dt.Rows[i]["Date"].ToString()); tmp.Description = dt.Rows[i]["Description"].ToString(); tmp.Show = dt.Rows[i]["Show"].ToString(); tmp.Address = dt.Rows[i]["Address"].ToString(); tmp.AddressType = Convert.ToInt32(dt.Rows[i]["AddressType"].ToString()); tmp.Telephone = dt.Rows[i]["Telephone"].ToString(); tmp.Status = Convert.ToInt32(dt.Rows[i]["Status"].ToString()); res.Add(tmp); } return res; }
private void btnGiveOrder_Click(object sender, EventArgs e) { if (this.lblTelephone.Text.Length == 0) { int num1 = (int)MessageBox.Show("Telefon seçiminde bir sorun var."); } else if (this.lblAddress.Text.Length == 0) { int num2 = (int)MessageBox.Show("Adres seçiminde bir sorun var."); } else { if (this.lbOrders.Items.Count == 0 || MessageBox.Show("Sipariş gidicek adresi doğru seçili mi?", "Uyarı", MessageBoxButtons.YesNo) == DialogResult.No) return; Order _order = new Order(); _order.Address = this.lblAddress.Text; _order.AddressType = ((AddressType)this.lbAddressTypes.SelectedItem).ID; _order.CustomerID = this.customerID; _order.Date = DateTime.Now.Date; _order.Description = Description.Description_GetByID(this.customerID).Desc.ToString(); _order.PayingType = 0; _order.Show = ""; _order.Status = 2; _order.Telephone = this.lblTelephone.Text; List<OrderDetail> list = new List<OrderDetail>(); for (int index = 0; index < this.lbOrders.Items.Count; ++index) list.Add(new OrderDetail() { Price = ((OrderUnitDetail)this.lbOrders.Items[index]).SelectedProduct.Price, ProductID = ((OrderUnitDetail)this.lbOrders.Items[index]).SelectedProduct.ID, Unit = ((OrderUnitDetail)this.lbOrders.Items[index]).Count }); _order.Details = list.ToArray(); int num3 = (int)new OrderForm(_order).ShowDialog(); } }