public bool Send(ref string returnMsg) { bool rtn = true; //if (Debugger.IsAttached) // return true; try { if (AppVars.objSMSConfiguration == null) { return(false); } int accountType = AppVars.objSMSConfiguration.SMSAccountType.ToInt(); if (BookingSMSAccountType == 0 && accountType == Enums.SMSACCOUNT_TYPE.MODEMSMS) { BookingSMSAccountType = Enums.SMSACCOUNT_TYPE.MODEMSMS; } if (accountType == Enums.SMSACCOUNT_TYPE.BULKSMS) { string url = "http://www.bulksms.co.uk:5567/eapi/submission/send_sms/2/2.0"; string data = seven_bit_message(AppVars.objSMSConfiguration.BulkSMSUserName, AppVars.objSMSConfiguration.BulkSMSPassword, this.ToNumber, this.Message); int idx = -1; Hashtable result = send_sms(data, url); if ((int)result["success"] == 1) { rtn = true; returnMsg = formatted_server_response(result); } else { returnMsg = formatted_server_response(result); rtn = false; idx = returnMsg.IndexOf("|"); if (idx > 0) { returnMsg = returnMsg.Substring(idx + 1); idx = returnMsg.IndexOf("|"); if (idx > 0) { returnMsg = returnMsg.Remove(idx); } } } } else if (accountType == Enums.SMSACCOUNT_TYPE.CLICKATELL || BookingSMSAccountType == Enums.SMSACCOUNT_TYPE.CLICKATELL) { string url = "http://api.clickatell.com/http/sendmsg"; string data = seven_bit_message(AppVars.objSMSConfiguration.ClickSMSUserName, AppVars.objSMSConfiguration.ClickSMSPassword, AppVars.objSMSConfiguration.ClickSMSApiKey, AppVars.objSMSConfiguration.ClickSMSSenderName.ToStr().Trim(), this._ToNumber, this._Message); string postMsg = Post(url, data); if (postMsg.StartsWith("ERR")) { if (postMsg.StartsWith("ERR: 001") == true) { returnMsg = postMsg; rtn = false; } else { General.AddLog(postMsg, "SMS : Click A Tell"); } } } else if (accountType == Enums.SMSACCOUNT_TYPE.MODEMSMS || BookingSMSAccountType == Enums.SMSACCOUNT_TYPE.MODEMSMS) { //try //{ // File.AppendAllText(Application.StartupPath + "\\remotesmsentry.txt", DateTime.Now.ToStr() + ":" + this._ToNumber.ToStr()+ ":" +Message); //} //catch //{ //} if (Message.Length > 450) { Message = Message.Substring(0, 447); Message += "..."; } General.SendMessageToPDA("request dispatchsms=" + this._ToNumber.ToStr() + "=" + this.Message); // File.WriteAllText(Application.StartupPath + "\\SMSFiles\\" + this._ToNumber.ToStr() + "_" + string.Format("{0:ddMMyyhhmmssfff}", DateTime.Now), this.Message); } } catch (Exception ex) { returnMsg = ex.Message; //if (returnMsg.ToStr().ToLower() == "response received is incomplete") //{ // rtn = true; //} //else //{ // rtn = false; //} //try //{ // File.AppendAllText(Application.StartupPath + "\\remotesmsexception.txt", DateTime.Now.ToStr() + ":" + returnMsg); //} //catch //{ //} rtn = true; } return(rtn); }
public void GenerateReport() { try { string website = AppVars.objSubCompany.WebsiteUrl.ToStr(); reportViewer1.LocalReport.EnableExternalImages = true; Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[10]; decimal SurchargeAmount = 0.00m; string cardNumber = string.Empty; if (this.DataSource.Count > 0 && (this.DataSource[0].PaymentTypeId.ToInt() == Enums.PAYMENT_TYPES.CREDIT_CARD || this.DataSource[0].PaymentTypeId.ToInt() == Enums.PAYMENT_TYPES.BANK_ACCOUNT || this.DataSource[0].PaymentTypeId.ToInt() == Enums.PAYMENT_TYPES.CREDIT_CARD_PAID) && this.DataSource[0].AuthCode.ToStr().Trim().Length > 0) { Booking_Payment objPayment = General.GetObject <Booking_Payment>(c => c.BookingId == this.DataSource.FirstOrDefault().Id).DefaultIfEmpty(); if (objPayment != null) { SurchargeAmount = objPayment.SurchargeAmount.ToDecimal(); if (objPayment.CardNumber.ToStr().Length >= 16) { cardNumber = "**************" + objPayment.CardNumber.Substring(14).ToStr(); } } this.reportViewer1.LocalReport.ReportEmbeddedResource = "Taxi_AppMain.ReportDesigns.rptJobDetails4_acc.rdlc"; //this.reportViewer1.LocalReport.ReportPath = "Taxi_AppMain.ReportDesigns.rptJobDetails4_acc.rdlc"; } if (this.DataSource.Count(c => c.CompanyId != null) > 0) { this.reportViewer1.LocalReport.ReportEmbeddedResource = "Taxi_AppMain.ReportDesigns.rptJobDetails4_acc.rdlc"; // this.reportViewer1.LocalReport.ReportPath = "Taxi_AppMain.ReportDesigns.rptJobDetails4_acc.rdlc"; } List <ClsLogo> objLogo = new List <ClsLogo>(); objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); string path = @"File:"; param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyLogo", path); string header = " " + AppVars.objSubCompany.Address.ToStr() + ",\n" + " Telephone No:" + AppVars.objSubCompany.TelephoneNo; // header += ", Fax:" + AppVars.objSubCompany.Fax.ToStr(); header += "\n Email:" + AppVars.objSubCompany.EmailAddress.ToStr() + ", Website:" + AppVars.objSubCompany.WebsiteUrl; // DateTime ? dtPrintDate=DateTime.Now.ToDate(); string PrintDate = "Print date : " + string.Format("{0:dd-MMMM-yy HH:MM}", DateTime.Now.ToDateTime()); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Header", header); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeader", AppVars.objSubCompany.CompanyName.ToStr()); param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Website", website); param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyPhone", AppVars.objSubCompany.TelephoneNo.ToStr()); param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_PrintDate", PrintDate); param[6] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CreditCardExtraCharges", SurchargeAmount.ToStr()); //AppVars.objPolicyConfiguration.CreditCardExtraCharges.ToStr()); //Report_Parameter_CreditCardExtraCharges param[7] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CardNumber", cardNumber); param[8] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VatNumber", AppVars.objSubCompany.CompanyVatNumber.ToStr()); decimal fullTotal = Math.Round(SurchargeAmount + this.DataSource.FirstOrDefault().DefaultIfEmpty().TotalCharges.ToDecimal(), 2); param[9] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_OverallTotal", fullTotal.ToStr()); reportViewer1.LocalReport.SetParameters(param); this.Vu_BookingDetailBindingSource.DataSource = this.DataSource; this.reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local; this.reportViewer1.ZoomPercent = 100; this.reportViewer1.SetDisplayMode(DisplayMode.Normal); this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); //if (retrycnt == 0) //{ // retrycnt = 1; // GenerateReport(); //} //else General.AddLog(ex.Message + ",Target : " + ex.TargetSite + ",Source : " + ex.Source + ",Stack Trace :" + ex.StackTrace, Environment.MachineName.ToStr()); } }