protected void btnSendMail_Click(object sender, EventArgs e)
    {
        try
        {
            string emailID;
            string userid;
            int    i = 0;
            foreach (GridDataItem item in RadGrid1.SelectedItems)
            {
                userid  = item.GetDataKeyValue("USER_ID").ToString();
                emailID = WebTools.GetExpr("EMAIL", "USERS", " WHERE USER_ID='" + userid + "'");
                if (emailID != "")
                {
                    string str = AmoghMail.SendEmail(emailID, userid, "$cpecc1234");
                    i++;
                }
            }

            Master.ShowSuccess("Email Sent to selected users:" + i);
        }
        catch (Exception ex)
        {
            Master.ShowMessage(ex.Message);
        }
    }
Ejemplo n.º 2
0
    protected void btnSubmit_Click1(object sender, EventArgs e)
    {
        VIEW_USERSTableAdapter users = new VIEW_USERSTableAdapter();

        try
        {
            if (txtPassword.Text.Length == 0)
            {
                Master.show_error("No Password provided!");
                return;
            }
            else if (txtPassword.Text.Length < 5)
            {
                Master.show_error("Minimum Password Length is 5!");
                return;
            }
            else if (txtPassword.Text != txtPassword2.Text)
            {
                Master.show_error("Password does not match!");
                return;
            }

            users.InsertQuery(txtUserName.Text, string.Empty, txtEmail.Text, "N",
                              decimal.Parse(Session["PROJECT_ID"].ToString()),
                              WebTools.MD5Str(txtPassword.Text), txtDesignation.Text, txtCompany.Text
                              );

            string user_id = WebTools.GetExpr("USER_ID", "USERS", " WHERE EMAIL='" + txtEmail.Text + "'");
            AmoghMail.SendEmail(txtEmail.Text, user_id, txtPassword.Text);

            Master.show_success(txtUserName.Text + " User Created & Notification Email sent to the user!");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
        finally
        {
            users.Dispose();
        }
    }