protected void Add_Click(object sender, EventArgs e)
 {
     try
     {
         if (acc.checkUserName(txtUsername.Text) == true)
         {
             Response.Write("<script>alert('Username has already used!')</script>");
         }
         else
         {
             int result = acc.insertUser(txtUsername.Text, txtPassword.Text, txtFullname.Text, txtPhone.Text,
                                         FileUpload1.FileName, txtEmail.Text, int.Parse(DropDownList4.SelectedValue.ToString()),
                                         int.Parse(DropDownList3.SelectedValue.ToString()), int.Parse(DropDownList2.SelectedValue.ToString()),
                                         int.Parse(DropDownList1.SelectedValue.ToString()), String.Format("{0}", Request.Form["datepicker"]));
             if (result > 0)
             {
                 Response.Write("<script>alert('Success!')</script>");
             }
             else
             {
                 Response.Write("<script>alert('Fail!')</script>");
             }
         }
     }catch (Exception ex)
     {
         Response.Write("<script>alert('Something went wrong :)')</script>");
     }
 }
Beispiel #2
0
 protected void Register_Click(object sender, EventArgs e)
 {
     try {
         if (acc.checkUserName(txtUsername.Text) == true)
         {
             Response.Write("<script>alert('Username has already used!')</script>");
             txtUsername.Text = "";
         }
         else
         {
             int result = acc.insertUser(txtUsername.Text, txtPassword.Text, txtFullname.Text, txtPhone.Text,
                                         FileUpload1.FileName, txtEmail.Text, 2,
                                         int.Parse(DropDownList3.SelectedValue.ToString()), int.Parse(DropDownList2.SelectedValue.ToString()),
                                         int.Parse(DropDownList1.SelectedValue.ToString()), String.Format("{0}", Request.Form["datepicker"]));
             if (result > 0)
             {
                 Response.Write("<script>alert('Success!')</script>");
                 Response.Redirect("/Default.aspx");
             }
             else
             {
                 Response.Write("<script>alert('Fail!')</script>");
             }
         }
     }catch (Exception ex)
     {
         Response.Write("<script>alert('Fill in carefully to meet pretty girls! <3')</script>");
     }
 }