private void AddOrderFromMe() { try { OA = new OrderToAloha.OrderToAloha(); OA.ResponseEvent += new OrderToAloha.OrderToAloha.ResponseEventHandler(OA_ResponseEvent); DataReciver.SendOrderToAlohaRequest req = new DataReciver.SendOrderToAlohaRequest() { OrderId = int.Parse(textBox5.Text), // Items = DGToOrderItms, CompanyId = int.Parse(textBox6.Text), CompanyName = textBox7.Text, BortName = textBox8.Text, DiscountId = comboBox1.SelectedIndex, Margin = comboBox2.SelectedIndex, TimeOfShipping = DateTime.Now, RemoteCompName = "Colstend4", port = 64788 }; req.Items = new List <OrderToAloha.Item>(); OrderToAloha.Item it = new OrderToAloha.Item() { BarCode = int.Parse(textBox1.Text), Count = int.Parse(textBox4.Text), Price = decimal.Parse(textBox3.Text), }; req.Items.Add(it); OA.SendOrderToAloha(req); } catch (Exception e) { MessageBox.Show(e.Message); } }
private void AddFreeItm() { try { OrderToAloha.Item itm = new OrderToAloha.Item() { BarCode = int.Parse(textBox1.Text), Count = int.Parse(textBox4.Text), Price = int.Parse(textBox3.Text), }; DGToOrderItms.Add(itm); bindingSource2.ResetBindings(true); } catch { } }
internal static AlohaCheck GetChk(int StOrderId) { OrdersDbDataContext db = new OrdersDbDataContext(ConnectionString); Order order; var res = (from o in db.Orders where (o.StNum == StOrderId) select o).FirstOrDefault(); if (res == null) { return(null); } else { AlohaCheck AChk = new AlohaCheck() { AlohaId = res.AlohaNumber.GetValueOrDefault(), DiscId = res.OrderDiscId.GetValueOrDefault(), DiscTypeId = res.OrderDiscId.GetValueOrDefault(), STId = res.StNum.GetValueOrDefault(), Summ = res.Summ.GetValueOrDefault(), TableNumber = int.Parse(res.AlohaTable) }; AChk.items = new List <OrderToAloha.Item> (); foreach (OrderItem Oi in res.OrderItems.Where(a => !a.Deleted.Value)) { OrderToAloha.Item it = new OrderToAloha.Item() { BarCode = Oi.Barcode.GetValueOrDefault(), Count = Oi.Quantity.GetValueOrDefault(), EntryId = Oi.EntryId.GetValueOrDefault(), Price = Oi.Price.GetValueOrDefault(), }; AChk.items.Add(it); } return(AChk); } }