private void SendSMS(EuroSMS sms, string[] toNumbers, string msg) { // string[] toNumbers = txtTo.Text.Split(',').Where(c => c != string.Empty).Distinct().ToArray<string>(); string smsError1 = string.Empty; // EuroSMS sms = new EuroSMS(); int idx = -1; string fullMobNo = string.Empty; foreach (var mobNo in toNumbers) { fullMobNo = mobNo; if (!Debugger.IsAttached) { if (fullMobNo.ToStr().StartsWith("00") == false) { if (fullMobNo.StartsWith("044") == true) { idx = fullMobNo.IndexOf("044"); fullMobNo = fullMobNo.Substring(idx + 3); fullMobNo = fullMobNo.Insert(0, "+44"); } if (fullMobNo.StartsWith("07")) { fullMobNo = fullMobNo.Substring(1); } if (fullMobNo.StartsWith("0440") == false || fullMobNo.StartsWith("+440") == false) { fullMobNo = fullMobNo.Insert(0, "+44"); } } } sms.ToNumber = fullMobNo; sms.Message = msg; sms.BookingSMSAccountType = this.AccountSMSType; if (AppVars.enableSMSService.ToBool() == false) { System.Threading.Thread.Sleep(3000); } sms.Send(ref smsError1); } }
private void SendSMS(string mobileNo, string message, int smsType) { try { string rtnMsg = string.Empty; EuroSMS objSMS = new EuroSMS(); objSMS.Message = message; objSMS.BookingSMSAccountType = smsType; string mobNo = mobileNo; if (mobNo.ToStr().StartsWith("00") == false) { int idx = -1; if (mobNo.StartsWith("044") == true) { idx = mobNo.IndexOf("044"); mobNo = mobNo.Substring(idx + 3); mobNo = mobNo.Insert(0, "+44"); } if (mobNo.StartsWith("07")) { mobNo = mobNo.Substring(1); } if (mobNo.StartsWith("044") == false || mobNo.StartsWith("+44") == false) { mobNo = mobNo.Insert(0, "+44"); } } objSMS.ToNumber = mobNo.Trim(); objSMS.Send(ref rtnMsg); } catch { } }
private void SendSMS(string mobileNo, string message) { string rtnMsg = string.Empty; EuroSMS objSMS = new EuroSMS(); objSMS.Message = message; foreach (var item in mobileNo.Split(new char[] { ',' })) { string mobNo = item; if (item.StartsWith("+44") == false) { if (Debugger.IsAttached == false) { if (mobNo.ToStr().StartsWith("00") == false) { int idx = -1; if (mobNo.StartsWith("044") == true) { idx = mobNo.IndexOf("044"); mobNo = mobNo.Substring(idx + 3); mobNo = mobNo.Insert(0, "+44"); } if (mobNo.StartsWith("07")) { mobNo = mobNo.Substring(1); } if (mobNo.StartsWith("044") == false || mobNo.StartsWith("+44") == false) { mobNo = mobNo.Insert(0, "+44"); } } } } objSMS.ToNumber = mobNo.Trim(); objSMS.Send(ref rtnMsg); } }
public bool OnDespatching(ref List <string> listofErrors) { bool rtn = false; bool IsSuccess1 = true; bool IsSuccess2 = false; string smsError1 = string.Empty; string smsError2 = string.Empty; try { if (ObjDriver != null && objBooking != null && chkCompleteJob.Checked == false) { string customerMobileNo = txtCustomerMobNo.Text.Trim(); // For testing Purpose // customerMobileNo = "03323755646"; // string customerName = objBooking.CustomerName; string via = string.Join(",", objBooking.Booking_ViaLocations.Select(c => c.ViaLocValue.ToStr()).ToArray <string>()); if (!string.IsNullOrEmpty(via.Trim())) { via = "Via: " + via; } string specialReq = objBooking.SpecialRequirements.ToStr().Trim(); if (!string.IsNullOrEmpty(specialReq)) { specialReq = "Special Req: " + specialReq; } EuroSMS objSMS = new EuroSMS(); enablePDA = AppVars.objPolicyConfiguration.EnablePDA.ToBool(); string custNo = !string.IsNullOrEmpty(objBooking.CustomerMobileNo) ? objBooking.CustomerMobileNo : objBooking.CustomerPhoneNo; // Send To Driver IsSuccess2 = true; objSMS.ToNumber = txtDriverMobNo.Text.Trim(); objSMS.Message = GetMessage(AppVars.objPolicyConfiguration.DespatchTextForDriver.ToStr()); objSMS.BookingSMSAccountType = objBooking.SMSType.ToInt(); if (objSMS.Message.ToStr().Length > 0) { if (chkReturnDetails.Checked) { objSMS.Message += GetReturnMessage(AppVars.objPolicyConfiguration.DespatchTextForDriver.ToStr()); } new Thread(delegate() { objSMS.Send(ref smsError2); }).Start(); } // IsSuccess2 = objSMS.Send(ref smsError2); // Send To Customer //if (AppVars.objPolicyConfiguration.EnablePassengerText.ToBool() && objBooking.DisablePassengerSMS.ToBool() == false) //{ // if (!string.IsNullOrEmpty(customerMobileNo)) // { // smsThread = new Thread(delegate() // { // IsSuccess1 = SendDespatchSMS(objSMS, GetMessage(AppVars.objPolicyConfiguration.DespatchTextForCustomer.ToStr()), customerMobileNo); // }); // } //} if (IsSuccess1 && IsSuccess2) { rtn = true; } //if (IsSuccess1 == false) //{ // listofErrors.Add("[Customer] : " + smsError1); //} if (IsSuccess2 == false) { listofErrors.Add("[Driver] : " + smsError2); } } else { rtn = true; } } catch (Exception ex) { IsSuccess1 = false; listofErrors.Add(ex.Message); rtn = false; } return(rtn); }
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(); }