/// <summary> /// Mời khách /// </summary> /// <param name="BookId">BookId</param> /// <param name="vehicle">Biển Số</param> /// <param name="result">Kết quả</param> /// <param name="msg">Thông báo</param> /// <param name="isContract">Xe hợp đồng</param> public static void SendACKInvite(Guid BookId, string vehicle, bool result, string msg, bool isContract) { if (isContract) { Task.Factory.StartNew(() => { return(WCFServicesAppXHD.SendText(CommonBL.ConvertSangBienSo(vehicle), msg, BookId)); }); } else { BackgroupActionServer(p => { var Content = new SendTextContext { BookId = BookId, VehiclePlate = CommonBL.ConvertSangBienSo(vehicle), TextCommand = msg, Result = result }; p.SendACKInvite(Content); }, "Mời khách"); } }
/// <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); } }