예제 #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtMsgBox.Text))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','Please type some message','" + icon.CANCEL_ICON + "')", true);

                return;
            }
            if (String.IsNullOrEmpty(txtNumber.Text))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','Please type one phone number','" + icon.CANCEL_ICON + "')", true);

                return;
            }
            var Send    = new SMSON_SEND_BOX();
            var message = "";

            Send.MOBILE_NUMBER = txtNumber.Text;
            Send.SMS_TEXT      = txtMsgBox.Text;
            Send.USER_IDS      = Session["USER_IDS"].ToString();
            Send.SMS_STATUS    = 0;
            try
            {
                message = USER_Acitivity.Send_SMS(Send);
                if (!message.ToLower().Contains("enough"))
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Success','" + message + "','" + icon.OK_ICON + "')", true);
                }

                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','" + message + "','" + icon.CANCEL_ICON + "')", true);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                Clear();
            }
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            var SMSON_USER = new SMSON_USER();

            if (String.IsNullOrEmpty(txtName.Text))
            {
                Show("User name is empty");
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','User name is empty')", true);
                return;
            }
            if (String.IsNullOrEmpty(txtPass.Text))
            {
                Show("Password is empty");
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','Password is empty')", true);

                return;
            }
            SMSON_USER.USER_IDS = txtName.Text;
            SMSON_USER.PASSWORD = fetch.PasswordEncrypt(txtPass.Text);
            try
            {
                var data = USER_Acitivity.Check_Login(SMSON_USER);
                if (data.Count > 0)
                {
                    Session.Add("USER_IDS", data.First().USER_IDS);
                    Session.Add("USER_FULL_NAME", data.First().USER_FULL_NAME);
                    Session.Add("Login_Status", 1);
                    Response.Redirect("HomePanel.aspx");
                }
                else
                {
                    // ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:popup('Error','Invalid Username or Password')", true);
                    Show("Invalid Username or Password");
                }
            }
            catch (Exception ex)
            {
                Show(ex.Message);
            }
        }