protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                BusinessObjects bo = new BusinessObjects();
                if (Page.IsValid)
                {
                    //check whether user id already exists
                    int retValue = bo.CheckDupUser(txtUserID.Text);
                    if (retValue > 0)
                    {
                        ViewState["UserState"] = "User ID already exists";
                        Page.Validate();
                    }
                    else
                    {
                        //Add user
                        string strSex = "";
                        if (chkMale.Checked == true)
                        {
                            strSex = "M";
                        }
                        else if (chkFemale.Checked == true)
                        {
                            strSex = "F";
                        }
                        else if (chkOther.Checked == true)
                        {
                            strSex = "O";
                        }
                        string strName = txtFirstName.Text + " " + txtLastName.Text;
                        //EncryptDecrypt crypt = new EncryptDecrypt();

                        string strEncryptedPwd = EncryptDecrypt.Encrypt(txtPwd.Text);
                        bool   blRetval        = bo.CreateInst(txtUserID.Text, strEncryptedPwd, strName, "Student", "Student", txtPhone.Text, txtEmail.Text, strSex);

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox()", true);
                        //Response.Redirect("Login.aspx");
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                BusinessObjects bo = new BusinessObjects();

                int retValue = bo.CheckDupUser(txtUserID.Text);
                if (retValue > 0)
                {
                    ViewState["UserState"] = "Instructor ID already exists";
                    Page.Validate();
                }
                else
                {
                    //Add user
                    //ViewState["blIsSearch"] = false;
                    ODS_Inst.Insert();
                    ODS_Inst.Select();
                    ResetFields();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Instructor Created Successfully')", true);
                }
            }
        }