Example #1
0
        public string sendmessage(int id)
        {
            try
            {
                string CN = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString;
                using (MySqlConnection cn = new MySqlConnection(CN))
                {
                    cn.Open();
                    string           checkstatus = "Select * From SuperAgentMaster Where SuperagentID = '" + id + "'";
                    MySqlCommand     cmd1        = new MySqlCommand(checkstatus, cn);
                    MySqlDataAdapter adp         = new MySqlDataAdapter(cmd1);
                    DataTable        dt          = new DataTable();
                    adp.Fill(dt);
                    string ContactNo = (dt.Rows[0]["ContactNo"]).ToString();
                    string Username  = dt.Rows[0]["Code"].ToString();
                    string Password  = dt.Rows[0]["Password"].ToString();

                    string Message = "This Is Your Username " + Username + "  And " + Password + " \nFrom Sarkar50. club";

                    sendSMS smsSender = new sendSMS();
                    return(smsSender.SendSMS(ContactNo, Message));
                }
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
Example #2
0
        protected void btnsend_Click(object sender, EventArgs e)
        {
            string ContactNowithCommaSeperate = "";

            if (CheckBox1.Checked == true)
            {
                string SuperagentContactNowithCommaSeperate = "";
                string CN = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString;
                using (MySqlConnection cn = new MySqlConnection(CN))
                {
                    cn.Open();
                    string           selectsuperagent    = "Select ContactNo  From SuperagentMaster where Status = 'Active'";
                    MySqlCommand     selectsuperagentcmd = new MySqlCommand(selectsuperagent, cn);
                    MySqlDataAdapter selectsuperagentadp = new MySqlDataAdapter(selectsuperagentcmd);
                    DataTable        selectsuperagentdt  = new DataTable();
                    selectsuperagentadp.Fill(selectsuperagentdt);

                    for (int i = 0; i < selectsuperagentdt.Rows.Count; i++)
                    {
                        string Contactno = selectsuperagentdt.Rows[i]["ContactNo"].ToString();
                        SuperagentContactNowithCommaSeperate = SuperagentContactNowithCommaSeperate + Contactno + ",";
                    }
                }
                ContactNowithCommaSeperate = ContactNowithCommaSeperate + SuperagentContactNowithCommaSeperate;
            }

            if (CheckBox2.Checked == true)
            {
                string SuperagentContactNowithCommaSeperate = "";
                string CN = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString;
                using (MySqlConnection cn = new MySqlConnection(CN))
                {
                    cn.Open();
                    string           selectsuperagent    = "Select ContactNo  From agentMaster where Status = 'Active'";
                    MySqlCommand     selectsuperagentcmd = new MySqlCommand(selectsuperagent, cn);
                    MySqlDataAdapter selectsuperagentadp = new MySqlDataAdapter(selectsuperagentcmd);
                    DataTable        selectsuperagentdt  = new DataTable();
                    selectsuperagentadp.Fill(selectsuperagentdt);

                    for (int i = 0; i < selectsuperagentdt.Rows.Count; i++)
                    {
                        string Contactno = selectsuperagentdt.Rows[i]["ContactNo"].ToString();
                        SuperagentContactNowithCommaSeperate = SuperagentContactNowithCommaSeperate + Contactno + ",";
                    }
                }
                ContactNowithCommaSeperate = ContactNowithCommaSeperate + SuperagentContactNowithCommaSeperate;
            }

            if (CheckBox3.Checked == true)
            {
                string SuperagentContactNowithCommaSeperate = "";
                string CN = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString;
                using (MySqlConnection cn = new MySqlConnection(CN))
                {
                    cn.Open();
                    string           selectsuperagent    = "Select Contact_No  From ClientMaster where Status = 'Active'";
                    MySqlCommand     selectsuperagentcmd = new MySqlCommand(selectsuperagent, cn);
                    MySqlDataAdapter selectsuperagentadp = new MySqlDataAdapter(selectsuperagentcmd);
                    DataTable        selectsuperagentdt  = new DataTable();
                    selectsuperagentadp.Fill(selectsuperagentdt);

                    for (int i = 0; i < selectsuperagentdt.Rows.Count; i++)
                    {
                        string Contactno = selectsuperagentdt.Rows[i]["Contact_No"].ToString();
                        SuperagentContactNowithCommaSeperate = SuperagentContactNowithCommaSeperate + Contactno + ",";
                    }
                }
                ContactNowithCommaSeperate = ContactNowithCommaSeperate + SuperagentContactNowithCommaSeperate;
            }
            string  message   = "Match Sechduled \n " + txtdescription.Text + " \n\nFrom Sarkar50.com";
            sendSMS smsSender = new sendSMS();

            smsSender.SendSMS(ContactNowithCommaSeperate, message);
            txtdescription.Text = "";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Sent Message SuccessFully.....');", true);
        }