Пример #1
0
        public bool sendSMSDetails(string username)
        {
            try
            {
                //generate random string
                string        otpstr   = RandomString(6);
                SMSRequest    smsObj   = new SMSRequest();
                DatabaseLayer dbObj    = new DatabaseLayer();
                string        mobileno = getuserMobileNo(username);
                SSAErrorLog   logObj   = new SSAErrorLog();

                if (mobileno != null)
                {
                    string query = "delete from userotp where username='******'";
                    logObj.ErrorLog(ConfigurationManager.AppSettings["logfilepath"].ToString(), "query delete " + query);
                    dbObj.deleteTableData(query);

                    string str = String.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
                    dbObj.insertTableData("insert into userotp (username,otp,otpcreatedatetime,otpactivate) values ('" + QASecurity.Encryptdata(username) + "','" + otpstr + "','" + String.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now) + "' , 0) ");
                    //insert into db
                    //send SMS
                    smsObj.sendSMS(mobileno, ConfigurationManager.AppSettings["otpmessage"].ToString() + " " + otpstr);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception er)
            {
                return(false);
            }
        }
Пример #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            SMSRequest obj = new SMSRequest();

            obj.sendSMS(TextBox1.Text, TextBox2.Text);
        }