Exemplo n.º 1
0
    private void BindSmsTemplateFields()
    {
        smsnotifactionManager objemailnot = new smsnotifactionManager();
        string strtabbindtemplate         = "";

        try
        {
            Array tabname = Enum.GetValues(typeof(EmailNotificationManager.EmailTemplate));
            strtabbindtemplate += "<div class='tab-content'>";
            foreach (smsnotifactionManager.smsTemplate tab in tabname)
            {
                DataTable dtcontent = new DataTable();
                objemailnot.smstype = Convert.ToInt32(((int)tab).ToString());

                dtcontent = objemailnot.SelectSingleItem();
                if (dtcontent.Rows.Count > 0)
                {
                    if (((int)tab) == 1)
                    {
                        strtabbindtemplate += "<div class='active tab-pane' id=" + tab.ToString() + ">";

                        strtabbindtemplate += "<div class='form-group'>";
                        strtabbindtemplate += "<div class='col-sm-9'>";
                        strtabbindtemplate += "<textarea class='form-control ckeditor' id='txtdescription" + ((int)tab).ToString() + "'  maxlength='500' name='txtdescription" + ((int)tab).ToString() + "' >" + dtcontent.Rows[0]["Descp"].ToString() + "</textarea>";
                        strtabbindtemplate += "</div>";
                        strtabbindtemplate += "</div>";
                        strtabbindtemplate += "</div>";
                    }
                    else
                    {
                        strtabbindtemplate += "<div class='tab-pane' id=" + tab.ToString() + ">";

                        strtabbindtemplate += "<div class='form-group'>";
                        strtabbindtemplate += "<div class='col-sm-9'>";
                        strtabbindtemplate += "<textarea class='form-control ckeditor' id='txtdescription" + ((int)tab).ToString() + "'  maxlength='500' name='txtdescription" + ((int)tab).ToString() + "' >" + dtcontent.Rows[0]["Descp"].ToString() + "</textarea>";
                        strtabbindtemplate += "</div>";
                        strtabbindtemplate += "</div>";
                        strtabbindtemplate += "</div>";
                    }
                }
            }
            strtabbindtemplate += "</div>";

            ltrtabbinddata.Text = strtabbindtemplate.ToString();
        }
        catch (Exception ex) { throw ex; }
    }
Exemplo n.º 2
0
    public void testsendSms(int smsType)
    {
        DataTable             dtData         = null;
        smsnotifactionManager objCustomerMgr = new smsnotifactionManager();
        TwilioApiManager      objTWApi       = new TwilioApiManager();

        try
        {
            objCustomerMgr.smstype = smsType;


            dtData = objCustomerMgr.SelectSingleItem();

            if (dtData.Rows.Count > 0)
            {
                //string isdCode = Convert.ToString(dsData.Tables[0].Rows[0]["isdCode"]);
                //string phoneNo = Convert.ToString(dsData.Tables[0].Rows[0]["phone"]).StartsWith(isdCode) == true ? Convert.ToString(dsData.Tables[0].Rows[0]["phone"]) : isdCode + Convert.ToString(dsData.Tables[0].Rows[0]["phone"]);

                //objTWApi.sendsms(Convert.ToString(dtData.Rows[0]["pass"]), "8401325282", TwilioApiManager.SmsType.ForgotPassword);
                string test = objTWApi.sendsms(Convert.ToString("Test message"), "+918401325282", TwilioApiManager.SmsType.ForgotPassword);


                //var client = new TwilioRestClient(Environment.GetEnvironmentVariable("SK73966f2606d7bdfa353e87c19d029024"), Environment.GetEnvironmentVariable("5p4EekmAELZJOJapr15xgVzserG3J3Vs"));
                //var message = client.SendSmsMessage("+918401325282", "+918866242261", "test sms");
                //if (message.RestException != null)
                //{
                //    //Debug.Writeline(message.RestException.Message);
                //    Response.Write(message.RestException.Message);
                //}
            }
        }
        catch (Exception ex)
        {
            //throw;
        }
        finally
        {
            dtData         = null;
            objTWApi       = null;
            objCustomerMgr = null;
        }
    }
Exemplo n.º 3
0
    protected void btnsmsnotification_Click(object sender, EventArgs e)
    {
        smsnotifactionManager objsmsnotification = new smsnotifactionManager();

        try
        {
            Array tabname = Enum.GetValues(typeof(smsnotifactionManager.smsTemplate));
            foreach (smsnotifactionManager.smsTemplate tab in tabname)
            {
                objsmsnotification.smstype         = Convert.ToInt32(((int)tab));
                objsmsnotification.TwilioSid       = Convert.ToString(txtSid.Text);
                objsmsnotification.TwilioAuthToken = Convert.ToString(txtToken.Text);

                objsmsnotification.Descp = Convert.ToString(Request.Form["txtdescription" + ((int)tab)]);
                objsmsnotification.UpdateItem();
            }
            //Response.Redirect("setup.aspx");
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Sms notification updated successfully');", true);
        }
        catch (Exception ex) { throw ex; }
        finally { }
    }