public SMS_Response send_sms(string type, int booking_id, string mobile_no, string content_dict, string key)
        {
            SMS_Response response = new SMS_Response();

            response.result.type       = type;
            response.result.booking_id = booking_id;
            response.result.mobile_no  = mobile_no;
            Dictionary <string, string> content = JsonConvert.DeserializeObject <Dictionary <string, string> >(content_dict);

            SMS.SMS_Sender sms_sender;
            string         sms_template;

            SMS.SMS_Data sms_data;
            string       sms_text;
            string       sms_complete_url = "";
            string       tag = "tyaari";

            Utils.clsLogger logger = new Utils.clsLogger();
            string          default_sms_gateway = ConfigurationManager.AppSettings["DEFAULT_SMS_GATEWAY"].ToString();

            string[] valid_sms_types = ConfigurationManager.AppSettings["Valid_SMS_Types"].ToString().Split(',');
            try
            {
                if (valid_sms_types.Contains(type))
                {
                    if (type.EndsWith("gds"))
                    {
                        tag = "mantis";
                    }
                    sms_sender       = new SMS.SMS_Sender(default_sms_gateway, type, key);
                    sms_template     = SMS.SMS_Sender.get_sms_template(type);
                    sms_data         = new SMS.SMS_Data(content);
                    sms_text         = sms_data.prepare_booking_sms(sms_template);
                    sms_complete_url = sms_sender.send_sms(mobile_no, sms_text, tag);
                    response.status  = true;
                }
                else
                {
                    throw new System.Exception("Invalid SMS Type");
                }
            }
            catch (System.Exception ex)
            {
                logger.log("error", new Dictionary <string, object>
                {
                    { "booking_id", booking_id },
                    { "mobile_no", mobile_no },
                    { "type", type }
                }, ex.ToString());
                response.status = false;
                response.error  = ex.Message;
            }

            //Log sms into db for accounting purpose;
            SMS.SMS_Sender.log_sms_into_db(booking_id, mobile_no, sms_complete_url, Convert.ToInt32(response.status));
            return(response);
        }
        public SMS_Response send_sms(string type, int booking_id, string mobile_no, string content_dict, string key)
        {
            SMS_Response response = new SMS_Response();
            response.result.type = type;
            response.result.booking_id = booking_id;
            response.result.mobile_no = mobile_no;
            Dictionary<string,string> content =  JsonConvert.DeserializeObject<Dictionary<string, string>>(content_dict);

            SMS.SMS_Sender sms_sender;
            string sms_template;
            SMS.SMS_Data sms_data;
            string sms_text;
            string sms_complete_url="";
            string tag = "tyaari";
            Utils.clsLogger logger = new Utils.clsLogger();
            string default_sms_gateway=ConfigurationManager.AppSettings["DEFAULT_SMS_GATEWAY"].ToString();
            string[] valid_sms_types = ConfigurationManager.AppSettings["Valid_SMS_Types"].ToString().Split(',');
            try
            {
                if(valid_sms_types.Contains(type))
                {
                    if (type.EndsWith("gds"))
                        tag = "mantis";
                    sms_sender = new SMS.SMS_Sender(default_sms_gateway,type, key);
                    sms_template = SMS.SMS_Sender.get_sms_template(type);
                    sms_data = new SMS.SMS_Data(content);
                    sms_text = sms_data.prepare_booking_sms(sms_template);
                    sms_complete_url = sms_sender.send_sms(mobile_no, sms_text, tag);
                    response.status = true;
                }
                else
                {
                    throw new System.Exception("Invalid SMS Type");
                }

            }
            catch (System.Exception ex)
            {
                logger.log("error", new Dictionary<string, object>
                {   {"booking_id",booking_id},
                    {"mobile_no",mobile_no},
                    {"type",type}
                }, ex.ToString());
                response.status = false;
                response.error = ex.Message;
            }

            //Log sms into db for accounting purpose;
            SMS.SMS_Sender.log_sms_into_db(booking_id, mobile_no, sms_complete_url, Convert.ToInt32(response.status));
            return response;
        }
Example #3
0
 public SMS_Sender(string gateway,string type, string client_key)
 {
     this.gateway_url = SMS_Sender.get_sms_gateway(gateway,type);
     this.validate_client_key(type, client_key);
     this.logger = new Utils.clsLogger();
     this.type = type;
 }
Example #4
0
 public clsDB()
 {
     strConnString = System.Configuration.ConfigurationManager.AppSettings["GDSConnString"].ToString();
     /*
     strConnStringSlave = System.Configuration.ConfigurationManager.AppSettings["GDSSlaveConnString"].ToString();
     strConnStringCRS = System.Configuration.ConfigurationManager.AppSettings["CRSConnString"].ToString();
     strConnStringBitla = System.Configuration.ConfigurationManager.AppSettings["BitlaConnString"].ToString();
     strAbhibusConnString = System.Configuration.ConfigurationManager.AppSettings["AbhibusConnectionString"].ToString();
     strKalladaConnString = System.Configuration.ConfigurationManager.AppSettings["KalladaConnectionString"].ToString();
     strTicketGooseConnString = System.Configuration.ConfigurationManager.AppSettings["TicketGooseConnectionString"].ToString();
     strKPNConnString = System.Configuration.ConfigurationManager.AppSettings["KPNConnectionString"].ToString();
     strHindusthanConnString = System.Configuration.ConfigurationManager.AppSettings["HindusthanConnectionString"].ToString();
     strNeetaConnString = System.Configuration.ConfigurationManager.AppSettings["NeetaConnectionString"].ToString();
     strConnStringNeeta = System.Configuration.ConfigurationManager.AppSettings["NeetaConnString"].ToString();
     strConnStringMantis2011 = System.Configuration.ConfigurationManager.AppSettings["MantisConnString"].ToString();
     strHermesConnString = System.Configuration.ConfigurationManager.AppSettings["HermesConnString"].ToString();
     strConnStringPatel = System.Configuration.ConfigurationManager.AppSettings["PatelConnString"].ToString();
     strConnStringPurple = System.Configuration.ConfigurationManager.AppSettings["PurpleConnString"].ToString();
     strDurgambaConnString = System.Configuration.ConfigurationManager.AppSettings["DurgambaConnectionString"].ToString();
     strConnStringPaulo = System.Configuration.ConfigurationManager.AppSettings["PauloConnectionString"].ToString();
     strConnStringParveen = System.Configuration.ConfigurationManager.AppSettings["ParveenConnectionString"].ToString();
     strOgiveConnString = System.Configuration.ConfigurationManager.AppSettings["OgiveConnectionString"].ToString();
     strConnStringKesineni = System.Configuration.ConfigurationManager.AppSettings["KesineniConnectionString"].ToString();
     strConnStringOlivea = System.Configuration.ConfigurationManager.AppSettings["OliveaConnectionString"].ToString();
     strVishalConnString = System.Configuration.ConfigurationManager.AppSettings["VishalConnString"].ToString();
     strSriDurgambaConnString = System.Configuration.ConfigurationManager.AppSettings["SriDurgambaConnectionString"].ToString();
     strAbhibusOperatorsConnString = System.Configuration.ConfigurationManager.AppSettings["AbhibusOperatorsConnectionString"].ToString();
     strConnStringRSRTC = System.Configuration.ConfigurationManager.AppSettings["RSRTCConnString"].ToString();
     strConnStringUPSRTC = System.Configuration.ConfigurationManager.AppSettings["UPSRTCConnString"].ToString();
     strConnStringHRTC = System.Configuration.ConfigurationManager.AppSettings["HRTCConnString"].ToString();
     strConnStringMSRTC = System.Configuration.ConfigurationManager.AppSettings["MSRTCConnString"].ToString();
     // by : sWaRtHi
     strConnStringTicketEngine = System.Configuration.ConfigurationManager.AppSettings["TicketEngineConnString"].ToString();
     */
     logger = new Utils.clsLogger();
     StartNewCommand();
 }
        public Email_Response send_email(string type, int booking_id, string email_ids, string cc_email_ids, string bcc_email_ids, string subject, string content_dict, string attachments_dict)
        {
            Email_Response response = new Email_Response();
            Email.Email email;
            Utils.clsLogger logger = new Utils.clsLogger();
            Dictionary<string, object> content = new Dictionary<string, object>();
            Dictionary<string, object> attachments = new Dictionary<string, object>();

            if (type == null || type.Trim().Length == 0)
            {
                type = "blank_email";
            }

            content = JsonConvert.DeserializeObject<Dictionary<string, object>>(content_dict);

            if (attachments_dict != null)
            {
                attachments = JsonConvert.DeserializeObject<Dictionary<string, object>>(attachments_dict);
            }

            string[] valid_email_types = ConfigurationManager.AppSettings["Valid_Email_Types"].ToString().Split(',');

            int success = 1;
            try
            {
                response.result.type = type;
                response.result.booking_id = booking_id;
                response.result.email_ids = email_ids;
                response.result.cc_email_ids = cc_email_ids;
                response.result.bcc_email_ids = bcc_email_ids;
                response.status = true;

                if(valid_email_types.Contains(type))
                {
                    email = new Email.Email(type, subject, content,attachments);
                    response.status = email.send_email(booking_id, email_ids, cc_email_ids, bcc_email_ids);
                }
                else
                {
                    throw new System.Exception("Invalid Email Type");
                }
            }
            catch (System.Exception ex)
            {
                success = 0;
                logger.log("error", new Dictionary<string, object>
                {   {"booking_id",booking_id},
                    {"email_ids",email_ids},
                    {"cc_email_ids",cc_email_ids},
                    {"bcc_email_ids",bcc_email_ids},
                    {"type",type}
                }, ex.ToString());
                response.status = false;
                response.error = ex.Message;
            }

            if (success == 1)
            {
                logger.log("info", new Dictionary<string, object>
                {   {"booking_id",booking_id},
                    {"email_ids",email_ids},
                    {"cc_email_ids",cc_email_ids},
                    {"bcc_email_ids",bcc_email_ids},
                    {"type",type}
                }, "success");
            }
            //Log email into db;
            //Email.Email.log_email_into_db(type, booking_id, response.result.email_ids, response.result.cc_email_ids, response.result.bcc_email_ids, response.error, Convert.ToInt32(response.status));
            return response;
        }
Example #6
0
        public Email_Response send_email(string type, int booking_id, string email_ids, string cc_email_ids, string bcc_email_ids, string subject, string content_dict, string attachments_dict)
        {
            Email_Response response = new Email_Response();

            Email.Email                 email;
            Utils.clsLogger             logger      = new Utils.clsLogger();
            Dictionary <string, object> content     = new Dictionary <string, object>();
            Dictionary <string, object> attachments = new Dictionary <string, object>();

            if (type == null || type.Trim().Length == 0)
            {
                type = "blank_email";
            }

            content = JsonConvert.DeserializeObject <Dictionary <string, object> >(content_dict);

            if (attachments_dict != null)
            {
                attachments = JsonConvert.DeserializeObject <Dictionary <string, object> >(attachments_dict);
            }

            string[] valid_email_types = ConfigurationManager.AppSettings["Valid_Email_Types"].ToString().Split(',');

            int success = 1;

            try
            {
                response.result.type          = type;
                response.result.booking_id    = booking_id;
                response.result.email_ids     = email_ids;
                response.result.cc_email_ids  = cc_email_ids;
                response.result.bcc_email_ids = bcc_email_ids;
                response.status = true;

                if (valid_email_types.Contains(type))
                {
                    email           = new Email.Email(type, subject, content, attachments);
                    response.status = email.send_email(booking_id, email_ids, cc_email_ids, bcc_email_ids);
                }
                else
                {
                    throw new System.Exception("Invalid Email Type");
                }
            }
            catch (System.Exception ex)
            {
                success = 0;
                logger.log("error", new Dictionary <string, object>
                {
                    { "booking_id", booking_id },
                    { "email_ids", email_ids },
                    { "cc_email_ids", cc_email_ids },
                    { "bcc_email_ids", bcc_email_ids },
                    { "type", type }
                }, ex.ToString());
                response.status = false;
                response.error  = ex.Message;
            }

            if (success == 1)
            {
                logger.log("info", new Dictionary <string, object>
                {
                    { "booking_id", booking_id },
                    { "email_ids", email_ids },
                    { "cc_email_ids", cc_email_ids },
                    { "bcc_email_ids", bcc_email_ids },
                    { "type", type }
                }, "success");
            }
            //Log email into db;
            //Email.Email.log_email_into_db(type, booking_id, response.result.email_ids, response.result.cc_email_ids, response.result.bcc_email_ids, response.error, Convert.ToInt32(response.status));
            return(response);
        }