Exemplo n.º 1
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;
 }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
 //sends the message.
 public bool send_email(int booking_id, string to_email_ids, string cc_email_ids, string bcc_email_ids)
 {
     Utils.clsLogger logger = new Utils.clsLogger();
     if (to_email_ids == null)
         to_email_ids = "";
     if (cc_email_ids == null)
         cc_email_ids = "";
     if (bcc_email_ids == null)
         bcc_email_ids = "";
     MailMessage message = new MailMessage();
     try
     {
         string smtpServer = ConfigurationManager.AppSettings["SMTPServer"].ToString();
         string smtpPort = ConfigurationManager.AppSettings["SMTPPort"].ToString();
         string fromEmailId = ConfigurationManager.AppSettings["TYEmailID"].ToString();
         string fromEmailPassword = ConfigurationManager.AppSettings["TYEmailPassword"].ToString();
         SmtpClient smtp = new SmtpClient(smtpServer, Convert.ToInt32(smtpPort));
         smtp.UseDefaultCredentials = false;
         smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
         smtp.Timeout = 100000;
         smtp.EnableSsl = true;
         smtp.Credentials = new System.Net.NetworkCredential(fromEmailId, fromEmailPassword);
         message.From = new MailAddress(this.config["from_email_id"].ToString());
         message.Subject = this.subject;
         string[] to_email_id_list = to_email_ids.Split(',');
         foreach (string to_email_id in to_email_id_list)
             if(to_email_id.Length>0)
                 message.To.Add(new MailAddress(to_email_id));
         if (this.config["default_cc_email"].ToString().Length > 0)
         {
             if (cc_email_ids == null || cc_email_ids.Trim().Length == 0)
             {
                 cc_email_ids = this.config["default_cc_email"].ToString();
             }
             else
             {
                 cc_email_ids = cc_email_ids + "," + this.config["default_cc_email"].ToString();
             }
         }
         if (this.config["default_bcc_email"].ToString().Length > 0)
         {
             if (cc_email_ids == null || cc_email_ids.Trim().Length == 0)
             {
                 bcc_email_ids = this.config["default_bcc_email"].ToString();
             }
             else
             {
                 bcc_email_ids = bcc_email_ids + "," + this.config["default_bcc_email"].ToString();
             }
         }
         string[] cc_email_id_list = cc_email_ids.Split(',');
         foreach (string cc_email_id in cc_email_id_list)
             if(cc_email_id.Length>0)
                 message.CC.Add(new MailAddress(cc_email_id));
         string[] bcc_email_id_list = bcc_email_ids.Split(',');
         foreach (string bcc_email_id in bcc_email_id_list)
             if (bcc_email_id.Length > 0)
                 message.Bcc.Add(new MailAddress(bcc_email_id));
         message.BodyEncoding = System.Text.Encoding.UTF8;
         message.Body = this.body;
         message.IsBodyHtml = true;
         foreach (string temp_attachment in temp_attachments)
             message.Attachments.Add(new Attachment(temp_attachment));
         smtp.Send(message);
     }
     catch (Exception ex)
     {
         logger.log("error", new Dictionary<string, object>
         {   {"booking_id",booking_id},
             {"email_ids",to_email_ids},
             {"cc_email_ids",cc_email_ids},
             {"bcc_email_ids",cc_email_ids},
             {"type",type}
         }, ex.ToString());
         if (message != null)
             message.Dispose();
         return false;
     }
     finally
     {
         if (message != null)
             message.Dispose();
     }
     return true;
 }
Exemplo n.º 4
0
        //sends the message.
        public bool send_email(int booking_id, string to_email_ids, string cc_email_ids, string bcc_email_ids)
        {
            Utils.clsLogger logger = new Utils.clsLogger();
            if (to_email_ids == null)
            {
                to_email_ids = "";
            }
            if (cc_email_ids == null)
            {
                cc_email_ids = "";
            }
            if (bcc_email_ids == null)
            {
                bcc_email_ids = "";
            }
            MailMessage message = new MailMessage();

            try
            {
                string     smtpServer        = ConfigurationManager.AppSettings["SMTPServer"].ToString();
                string     smtpPort          = ConfigurationManager.AppSettings["SMTPPort"].ToString();
                string     fromEmailId       = ConfigurationManager.AppSettings["TYEmailID"].ToString();
                string     fromEmailPassword = ConfigurationManager.AppSettings["TYEmailPassword"].ToString();
                SmtpClient smtp = new SmtpClient(smtpServer, Convert.ToInt32(smtpPort));
                smtp.UseDefaultCredentials = false;
                smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
                smtp.Timeout     = 100000;
                smtp.EnableSsl   = true;
                smtp.Credentials = new System.Net.NetworkCredential(fromEmailId, fromEmailPassword);
                message.From     = new MailAddress(this.config["from_email_id"].ToString());
                message.Subject  = this.subject;
                string[] to_email_id_list = to_email_ids.Split(',');
                foreach (string to_email_id in to_email_id_list)
                {
                    if (to_email_id.Length > 0)
                    {
                        message.To.Add(new MailAddress(to_email_id));
                    }
                }
                if (this.config["default_cc_email"].ToString().Length > 0)
                {
                    if (cc_email_ids == null || cc_email_ids.Trim().Length == 0)
                    {
                        cc_email_ids = this.config["default_cc_email"].ToString();
                    }
                    else
                    {
                        cc_email_ids = cc_email_ids + "," + this.config["default_cc_email"].ToString();
                    }
                }
                if (this.config["default_bcc_email"].ToString().Length > 0)
                {
                    if (cc_email_ids == null || cc_email_ids.Trim().Length == 0)
                    {
                        bcc_email_ids = this.config["default_bcc_email"].ToString();
                    }
                    else
                    {
                        bcc_email_ids = bcc_email_ids + "," + this.config["default_bcc_email"].ToString();
                    }
                }
                string[] cc_email_id_list = cc_email_ids.Split(',');
                foreach (string cc_email_id in cc_email_id_list)
                {
                    if (cc_email_id.Length > 0)
                    {
                        message.CC.Add(new MailAddress(cc_email_id));
                    }
                }
                string[] bcc_email_id_list = bcc_email_ids.Split(',');
                foreach (string bcc_email_id in bcc_email_id_list)
                {
                    if (bcc_email_id.Length > 0)
                    {
                        message.Bcc.Add(new MailAddress(bcc_email_id));
                    }
                }
                message.BodyEncoding = System.Text.Encoding.UTF8;
                message.Body         = this.body;
                message.IsBodyHtml   = true;
                foreach (string temp_attachment in temp_attachments)
                {
                    message.Attachments.Add(new Attachment(temp_attachment));
                }
                smtp.Send(message);
            }
            catch (Exception ex)
            {
                logger.log("error", new Dictionary <string, object>
                {
                    { "booking_id", booking_id },
                    { "email_ids", to_email_ids },
                    { "cc_email_ids", cc_email_ids },
                    { "bcc_email_ids", cc_email_ids },
                    { "type", type }
                }, ex.ToString());
                if (message != null)
                {
                    message.Dispose();
                }
                return(false);
            }
            finally
            {
                if (message != null)
                {
                    message.Dispose();
                }
            }
            return(true);
        }