//Inserted ordered dishes public Boolean InsertOrdered(List<OrderDetailDTO> lst, short table_code) { try { ORDER order; OrderDTO query = (from p in Context.ORDER where p.TABLES_INFO.CODE == table_code select new OrderDTO() { ID=p.Id, STATUS=p.STATUS }).SingleOrDefault(); if (query == null) { order = new ORDER(); query = new OrderDTO(); order.Id = Guid.NewGuid(); query.ID = order.Id; Guid table_id = (from p in Context.TABLES_INFO where p.CODE == table_code select p.Id).SingleOrDefault(); order.TABLE_ID = table_id; order.ADD_TIME = DateTime.Now; order.STATUS = "Chờ xác nhận"; query.STATUS = order.STATUS; Context.ORDER.AddObject(order); } foreach (OrderDetailDTO item in lst) { ORDER_DETAIL orderdtl = new ORDER_DETAIL(); orderdtl.Id = Guid.NewGuid(); ChefDTO chef = GetChefFree(); if (chef != null) orderdtl.CHEF_ID = chef.ID; orderdtl.AMOUNT = item.AMOUNT; orderdtl.DISH_ID = item.DISH_ID; orderdtl.ORDER_ID = query.ID; orderdtl.STATUS = "Chờ làm"; Context.ORDER_DETAIL.AddObject(orderdtl); } Context.SaveChanges(); if (query.STATUS == "Đang làm") { ProccessRepostitory rep = new ProccessRepostitory(); rep.SendToChicken(query.ID); } return true; } catch (Exception ex) { throw ex; } }
private void rbtSendToKitchen_Click(object sender, EventArgs e) { ProccessRepostitory repP = new ProccessRepostitory(); Form frm = ((HostWindow)this.radDock1.DocumentManager.ActiveDocument).MdiChild; DataGridView grv = ((frmOrder)frm).grvOrder; foreach (DataGridViewRow row in grv.SelectedRows) { repP.SendToChicken(Guid.Parse(row.Cells["grvOrder_ID"].Value.ToString())); } ((FormBase)frm).RefreshData(); }
private void button3_Click(object sender, EventArgs e) { ProccessRepostitory repP = new ProccessRepostitory(); foreach (DataGridViewRow row in grvOrder.SelectedRows) { repP.SendToChicken(Guid.Parse(row.Cells["grvOrder_ID"].Value.ToString())); } refreshgrvOrder(); // }