示例#1
0
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        AdminDataContext ad    = new AdminDataContext();
        tblLogonId       logIn = new tblLogonId();
        BusLogic         bl    = new BusLogic();

        if (txtNewUser.Text != string.Empty)
        {
            logIn.UserName = txtNewUser.Text;
        }
        if (txtPword.Text != string.Empty)
        {
            logIn.Password = bl.getMd5Hash(txtPword.Text);
        }
        if (txtRole.Text != string.Empty)
        {
            logIn.Role = int.Parse(txtRole.Text);
        }
        if (txtEmail.Text != string.Empty)
        {
            if (bl.ValidateEmail(txtEmail.Text))
            {
                logIn.emailAddress = txtEmail.Text;
            }
        }

        try
        {
            ad.tblLogonIds.InsertOnSubmit(logIn);
            ad.SubmitChanges();
            string fn = "alert('" + txtNewUser.Text + " was successfully added!');";
            ShowClientFunction(fn);
            btnView_Click(sender, e);
        }
        catch (Exception)
        {
        }

        finally
        {
            txtNewUser.Text = string.Empty;
            txtPword.Text   = string.Empty;
            txtEmail.Text   = string.Empty;
        }
    }
示例#2
0
 partial void UpdatetblLogonId(tblLogonId instance);
示例#3
0
 partial void DeletetblLogonId(tblLogonId instance);
示例#4
0
 partial void InserttblLogonId(tblLogonId instance);