private void SaveBooking() { string reason = txtCancelReason.Text.Trim(); if (string.IsNullOrEmpty(reason)) { reason = "XXX"; //ENUtils.ShowMessage("Please enter Cancel Reason..."); //return; } if (objMaster == null || objMaster.Current == null) { objMaster.GetByPrimaryKey(BookingId); } if (objMaster.Current == null) { Close(); return; } bool cancelReturnJob = false; long?returnBookingId = null; if (objMaster.Current.JourneyTypeId.ToInt() == Enums.JOURNEY_TYPES.RETURN) { DialogResult dialog = MessageBox.Show("Do you want to cancel Return Booking as well ?", "", MessageBoxButtons.YesNoCancel); if (dialog == System.Windows.Forms.DialogResult.Yes) { cancelReturnJob = true; } else if (dialog == System.Windows.Forms.DialogResult.Cancel) { return; } } this._onlineBookingId = objMaster.Current.OnlineBookingId.ToLong(); using (TaxiDataContext db = new TaxiDataContext()) { //db.stp_CancelBooking(BookingId, reason,AppVars.LoginObj.UserName.ToStr()); db.stp_CancelBookingWithUserLog(BookingId, reason, AppVars.LoginObj.UserName.ToStr(), AppVars.LoginObj.LuserId.ToInt()); jobIds = objMaster.Current.Id.ToStr(); if (cancelReturnJob && objMaster.Current.BookingReturns.Count > 0) { returnBookingId = objMaster.Current.BookingReturns[0].Id; db.stp_CancelBookingWithUserLog(returnBookingId, reason, AppVars.LoginObj.UserName.ToStr(), AppVars.LoginObj.LuserId.ToInt()); jobIds += "," + returnBookingId.ToStr(); } //db.stp_AddUserLogs(AppVars.LoginObj.LuserId.ToInt(),"JOB CANCELLED",3); // db.stp_BookingLog(BookingId, AppVars.LoginObj.UserName.ToStr(), "Job is Cancelled ! Reason : " + reason); } IsSaved = true; try { int driverId = objMaster.Current.DriverId.ToInt(); if (objMaster.Current.BookingStatusId.ToInt() != Enums.BOOKINGSTATUS.WAITING && driverId > 0) { if (objMaster.Current.JobCode.ToStr().Length > 0 && AppVars.objPolicyConfiguration.EnableGhostJob.ToBool()) { // new BroadcasterData().BroadCastToAll(RefreshTypes.REFRESH_ACTIVE_DASHBOARD); General.SendMessageToPDA("request broadcast=" + RefreshTypes.REFRESH_ACTIVE_DASHBOARD); } else { if (General.GetQueryable <Fleet_DriverQueueList>(c => c.DriverId == driverId && c.CurrentJobId == BookingId).Count() > 0) { new Thread(delegate() { CancelCurrentBookingFromPDA(BookingId, driverId); }).Start(); // RefreshBookingListOnActive(); // new BroadcasterData().BroadCastToAll(RefreshTypes.REFRESH_ACTIVE_DASHBOARD); General.SendMessageToPDA("request broadcast=" + RefreshTypes.REFRESH_ACTIVE_DASHBOARD); } else { if (objMaster.Current.BookingStatusId.ToInt() == Enums.BOOKINGSTATUS.PENDING_START) { new Thread(delegate() { General.ReCallPreBooking(BookingId, driverId); }).Start(); } else { new Thread(delegate() { ReCallFOJBookingFromPDA(BookingId, driverId); }).Start(); } // new BroadcasterData().BroadCastToAll(RefreshTypes.REFRESH_ACTIVE_DASHBOARD); General.SendMessageToPDA("request broadcast=" + RefreshTypes.REFRESH_ACTIVE_DASHBOARD); // RefreshActiveData(); } } this.IsRefresh = true; Thread.Sleep(500); } if (objMaster.Current.BookingTypeId.ToInt() == Enums.BOOKING_TYPES.THIRDPARTY) { General.UpdateThirdPartyJobStatus(objMaster.Current, objMaster.Current.Id, "declined"); } if (chkCancellationSMS.Checked && objMaster.Current != null && objMaster.Current.CustomerMobileNo.ToStr().Length >= 9 && AppVars.objPolicyConfiguration.SMSCancelJob.ToStr().Trim().Length > 0) { string rtnMsg = string.Empty; EuroSMS sms = new EuroSMS(); sms.Message = GetMessage(AppVars.objPolicyConfiguration.SMSCancelJob.ToStr(), objMaster.Current, objMaster.Current.Id); sms.ToNumber = objMaster.Current.CustomerMobileNo.ToStr().Trim(); sms.Send(ref rtnMsg); } } catch { } SendCancelEmail(); this.Close(); }