示例#1
0
 public static Enum_G5_Ping Ping()
 {
     try
     {
         if (Config_Common.CoDieuApp)
         {
             if (WCFServicesApp.IsOperatorClientConnecting())
             {
                 PingServer = Enum_G5_Ping.PingSu;
             }
             else
             {
                 PingServer = Enum_G5_Ping.PingFail;
             }
         }
         if (Config_Common.App_DieuXeHopDong)
         {
             if (WCFServicesAppXHD.IsOperatorClientConnecting())
             {
                 PingServer_XHD = Enum_G5_Ping.PingSu;
             }
             else
             {
                 PingServer_XHD = Enum_G5_Ping.PingFail;
             }
         }
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("G5_Ping:", ex);
         PingServer     = Enum_G5_Ping.PingNotConenct;
         PingServer_XHD = Enum_G5_Ping.PingNotConenct;
     }
     return(PingServer);
 }
示例#2
0
 /// <summary>
 /// Gửi khách lên nhầm xe cho server
 /// </summary>
 public static void SendWrongCustomer(Guid bookId, string privateCode, bool isContract)
 {
     if (isContract)
     {
         Task.Factory.StartNew(() =>
         {
             return(WCFServicesAppXHD.SendWrongCustomer(bookId, CommonBL.ConvertSangBienSo(privateCode)));
         });
     }
     else
     {
         Task.Factory.StartNew(() =>
         {
             return(WCFServicesApp.SendWrongCustomer(bookId, CommonBL.ConvertSangBienSo(privateCode)));
         });
     }
 }
示例#3
0
 /// <summary>
 /// Gửi lệnh hoãn xe đến server G5
 /// </summary>
 /// <param name="bookId">BookId</param>
 public static void SendOperatorCancel(Guid bookId, LoaiCuocKhach loaiCK, string msg = "", Taxi.Services.ServiceG5.SourceCancelType type = Taxi.Services.ServiceG5.SourceCancelType.Unknown)
 {
     if (bookId != Guid.Empty)
     {
         if (loaiCK == LoaiCuocKhach.ChoKhachHopDong)
         {
             Task.Factory.StartNew(() =>
             {
                 return(WCFServicesAppXHD.SendOperatorCancel(bookId, msg, (Taxi.Services.ServiceApp_XHD.SourceCancelType)type));
             });
         }
         else
         {
             WCFServicesApp.SendOperatorCancel(bookId, msg, (Taxi.Services.ServiceApp.SourceCancelType)type);
         }
     }
 }
示例#4
0
        private void mnuXoaCuoc_Click(object sender, EventArgs e)
        {
            if (gridView1.RowCount > 0)
            {
                if (new Taxi.MessageBox.MessageBoxBA().Show(this, "Bạn có muốn xóa những cuốc gọi đang chọn không.\nLưu ý:Đã xóa những cuốc gọi này sẽ không khôi phục lại.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.YesNo).ToLower() == "Yes".ToLower())
                {
                    string      idDelete = "";
                    List <Guid> lstGuid  = new List <Guid>();
                    for (int i = 0; i < gridView1.SelectedRowsCount; i++)
                    {
                        DataRow r = gridView1.GetDataRow(gridView1.GetSelectedRows()[i]);
                        idDelete += "," + r["ID"];
                        lstGuid.Add(Guid.Parse(r["BookID"].ToString()));
                    }
                    try
                    {
                        idDelete = idDelete.Trim(',');
                        if (idDelete.Length == 0)
                        {
                            return;
                        }
                        if (!bc_1_3_BaoCaoChiTietCuocGoiDen.DeleteMultilCuocGoi(idDelete))
                        {
                            new Taxi.MessageBox.MessageBoxBA().Show("Bạn chỉ được xóa cuốc hoa hồng loại sảnh.", "Thông báo");
                        }
                        else
                        {
                            WCFServicesApp.SendDeleteBook(lstGuid.ToArray(), ThongTinDangNhap.USER_ID);

                            btnTim.Enabled = true;
                            btnTim.PerformClick();
                        }
                    }
                    catch (Exception ex)
                    {
                        new Taxi.MessageBox.MessageBoxBA().Show("Lỗi" + ex.Message);
                    }
                }
            }
        }
示例#5
0
        /// <summary>
        /// Gửi lệnh cho lái xe bằng biển số.
        /// </summary>
        /// <param name="privateCode">Số hiệu xe</param>
        /// <param name="Text">Lệnh gửi lái xe</param>
        /// <param name="BookId">BookId</param>
        /// <param name="idCuocGoi">ID Cuộc gọi</param>
        /// <param name="userId">nhân viên gửi Lệnh</param>
        /// <param name="cmdId">Mã Lệnh</param>
        /// <param name="result">Driver Command gửi lên từ lái xe, tới điều hành là gửi ACKDriver Command
        /// Để xác nhận lệnh từ lái xe đã tới điều hành.
        /// Vì thế để biết ĐH xử lý thế nào thì gửi OperatorCmd result là true: false
        /// Ví dụ: lái xe xin số, điều hành gửi về result:false => ko được, true: có được xem số</param>
        public static void SendText(string privateCode, string Text, Guid BookId, long idCuocGoi, string userId, bool isContract, int cmdId = 0, bool result = true)
        {
            try
            {
                //LogError.WriteLogInfo(string.Format("SendText:{0}" , Text));
                var Content = new SendTextContext
                {
                    VehiclePlate = CommonBL.ConvertSangBienSo(privateCode),
                    TextCommand  = Text,
                    CmdId        = cmdId,
                    BookId       = BookId,
                    Result       = result
                };
                if (Content.VehiclePlate != "")
                {
                    //Nếu là xe Car thì gửi cho bên Car
                    if (CommonBL.DictDriver.ContainsKey(privateCode))
                    {
                        if (CommonBL.DictDriver[privateCode].SystemType == Enum_SystemType.Car)
                        {
                            isContract = true;
                        }
                    }
                    Task.Factory.StartNew(() =>
                    {
                        if (isContract)
                        {
                            if (Content.CmdId == 0)
                            {
                                return(WCFServicesAppXHD.SendText(Content.VehiclePlate, Content.TextCommand, Content.BookId));
                            }
                            else
                            {
                                return(WCFServicesAppXHD.SendOperatorCmd(Content.VehiclePlate, Content.BookId, Content.CmdId, Content.TextCommand, Content.Result));
                            }
                        }
                        else
                        {
                            if (Content.CmdId == 0)
                            {
                                return(WCFServicesApp.SendText(Content.VehiclePlate, Content.TextCommand, Content.BookId));
                            }
                            else
                            {
                                return(WCFServicesApp.SendOperatorCmd(Content.VehiclePlate, Content.BookId, Content.CmdId, Content.TextCommand, Content.Result));
                            }
                        }
                    }).ContinueWith(x =>
                    {
                        if (x.Result == false)
                        {
                            if (MessageBox.Show("Lỗi gửi lệnh cho lái xe, Vui lòng gửi lại", "Thông báo",
                                                MessageBoxButtons.RetryCancel,
                                                MessageBoxIcon.Warning,
                                                MessageBoxDefaultButton.Button1) == DialogResult.Retry)
                            {
                                SendText(privateCode, Text, BookId, idCuocGoi, userId, isContract, cmdId, Content.Result);
                            }
                        }
                    });

                    var history = new T_TaxiOperation_SendCommand()
                    {
                        BookId      = Content.BookId,
                        CommandID   = Content.CmdId,
                        CommandText = Content.TextCommand,
                        CreatedBy   = userId,
                        IdCuocGoi   = idCuocGoi,
                        PrivateCode = privateCode,
                        Result      = false
                    };
                    history.Insert();
                }
            }
            catch (Exception ex)
            {
                if (MessageBox.Show("Lỗi gửi lệnh cho lái xe, Vui lòng gửi lại", "Thông báo", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Retry)
                {
                    SendText(privateCode, Text, BookId, idCuocGoi, userId, isContract, cmdId = 0, result);
                }
                LogError.WriteLogError("SendText:", ex);
            }
        }