private void comConnection1_DataReceived(string data)
        {
                OrderRepostitory repO = new OrderRepostitory();
                ProccessRepostitory repP = new ProccessRepostitory();
                OrderDetailDTO item;
                short table_code;
                string table_name;

                switch (data[0])
                {
                    case '1':
                        if (data.Length == 8)
                        {
                            //Lấy thông tin món ăn vừa order
                            item = repO.GetOrderDetailFromCode(data);
                            if (item != null)
                            {
                                if (lstOrderDetail.ContainsKey(item.TABLE_CODE))
                                {
                                    lstOrderDetail[item.TABLE_CODE].Add(item);
                                }else{
                                    lstOrderDetail.Add(item.TABLE_CODE,new List<OrderDetailDTO>());
                                    lstOrderDetail[item.TABLE_CODE].Add(item);
                                }
                            }
                        }
                        break;
                    case '9': //Xác nhận hoàn thành gọi món
                        if (data.Length==3)
                        {
                            table_code = Convert.ToInt16(data.Substring(1, 2));
                            if (lstOrderDetail.ContainsKey(table_code))
                            {
                                repO.InsertOrdered(lstOrderDetail[table_code],table_code);
                                lstOrderDetail.Remove(table_code);
                            }
                        }
                        break;
                    case '2': //Hủy món
                        if (data.Length == 8)
                        {
                            item = repO.GetOrderDetailFromCode(data);
                            if (item != null)
                            {
                                repO.CancelOrdered(item);
                            }
                            break;
                        }
                        break;
                    case '3': //Gọi bồi bàn
                        if (data.Length == 3)
                        {
                            table_code = Convert.ToInt16(data.Substring(1, 2));
                            table_name = repO.GetTableName(table_code);
                            ShowMessage(table_name + ": gọi nhân viên phục vụ", "Gọi nhân viên");
                        }
                        break;
                    case '4': //Thanh toán
                        if (data.Length == 3)
                        {
                            table_code = Convert.ToInt16(data.Substring(1, 2));
                            table_name = repO.GetTableName(table_code);

                            PayRepostitory repPa = new PayRepostitory();
                            repPa.SendToPayment(table_code);

                            ShowMessage(table_name + ": tính tiền", "Thanh toán");
                        }
                        break;
                    case '5':
                        if (data.Length == 2)
                        {
                            int p = int.Parse(data[1].ToString());
                            repP.FinishProcessing(p);
                        }
                        break;
                    case '6':
                        if (data.Length == 2)
                        {
                            int p = int.Parse(data[1].ToString());
                            repP.CancelProcessing(p);
                        }
                        break;
                }
                    Form frm = ((HostWindow)this.radDock1.DocumentManager.ActiveDocument).MdiChild;
                    ((FormBase)frm).RefreshData();
        }
 private void comConnection1_DataReceived(string data)
 {
     if (data.Length == 8)
     {
         //Lấy thông tin món ăn vừa order
         OrderRepostitory repO = new OrderRepostitory();
         OrderDetailDTO item;
         item = repO.GetOrderDetailFromCode(data);
         if (item != null)
         {
             //repO.InsertOrdered(item);
             refreshgrvOrder();
         }
     }
     else if (data.Length == 2)
     {
         int p = int.Parse(data[1].ToString());
         ProccessRepostitory repP = new ProccessRepostitory();
         //Finish
         if (data[0] == '5')
         {
             repP.FinishProcessing(p);
             refreshgrvProccessing();
             refreshgrvProccessFinish();
         }
         else if (data[0] == '6')
         {
             repP.CancelProcessing(p);
             refreshgrvProccessing();
             refreshgrvProccessFinish();
         }
     }
     data_recieve = true;
 }