Exemple #1
0
        public int SignUp(SignUpBO obj)
        {
            string connection = ConfigurationManager.ConnectionStrings["TSConnect"].ConnectionString;

            using (SqlConnection con = new SqlConnection(connection))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("TS_signUp", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@userId", obj.UserId);
                cmd.Parameters.AddWithValue("@password", Encrypt(obj.Password.Trim()));
                cmd.Parameters.AddWithValue("@firstName", obj.FirstName);
                cmd.Parameters.AddWithValue("@lastName", obj.LastName);
                cmd.Parameters.AddWithValue("@roleId", obj.CategoryId);
                cmd.Parameters.AddWithValue("@type", obj.Category);
                cmd.Parameters.AddWithValue("@age", obj.Age);
                cmd.Parameters.AddWithValue("@gender", obj.Gender);
                cmd.Parameters.AddWithValue("@contact", obj.ContactNumber);
                //cmd.Parameters.AddWithValue("@img", obj.userImage);
                cmd.Parameters.AddWithValue("@image", obj.Image);
                cmd.Parameters.AddWithValue("@securityId", obj.SecurityQuestionId);
                cmd.Parameters.AddWithValue("@securityAnswer", obj.SecurityAnswer);
                cmd.Parameters.AddWithValue("@updatedOn", obj.UpdatedOn);
                cmd.Parameters.AddWithValue("@isActive", obj.IsActive);
                cmd.Parameters.AddWithValue("@dob", obj.DOB);
                cmd.Parameters.AddWithValue("@emailId", obj.Email);
                int result = cmd.ExecuteNonQuery();
                con.Close();
                return(result);
            }
        }
Exemple #2
0
 public int Register(SignUpBO signup_BO_Object)
 {
     return(_signup.SignUp(signup_BO_Object));
 }
 protected void testBtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (ImageUpload.HasFile)
         {
             string strExtension = System.IO.Path.GetExtension(ImageUpload.FileName);
             if (strExtension == ".jpg" || strExtension == ".jepg" || strExtension == ".jpg" || strExtension == ".png" || strExtension == ".bmp")
             {
                 string strname  = ImageUpload.FileName.ToString();
                 string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
                 ImageUpload.SaveAs(Server.MapPath("~/Images/") + fileName + strname);
                 string filename = System.IO.Path.GetFileName(ImageUpload.FileName);
                 lblUploaded.Text = "Image Uploaded successfully";
                 string gender;
                 string category;
                 int    categoryId;
                 bool   active = true;
                 if (RoleList.SelectedValue == "Customer")
                 {
                     category   = DropDownCategory.SelectedValue;
                     categoryId = DropDownCategory.SelectedIndex;
                     active     = true;;
                 }
                 else
                 {
                     category   = "Admin";
                     categoryId = 2;
                     active     = false;
                 }
                 if (radioBtnFemale.Checked)
                 {
                     gender = "Female";
                 }
                 else
                 {
                     gender = "Male";
                 }
                 SignUpBO _signup = new SignUpBO
                 {
                     UserId             = txtBoxUserid.Text,
                     Password           = txtBoxPassword.Text,
                     FirstName          = txtBoxFirstName.Text,
                     LastName           = txtBoxLastName.Text,
                     Age                = int.Parse(txtBoxAge.Text),
                     ContactNumber      = txtBoxContact.Text,
                     Category           = category,
                     CategoryId         = categoryId,
                     SecurityQuestionId = DropDownListQuestion.SelectedIndex,
                     SecurityAnswer     = txtBoxAns.Text,
                     Gender             = gender,
                     UpdatedOn          = DateTime.Now,
                     IsActive           = active,
                     DOB                = DateTime.Parse(txtBoxDOB.Text),
                     Email              = txtBoxEmail.Text,
                     Image              = "~/Images/" + fileName + strname
                 };
                 SignUpBAL signUpBAL = new SignUpBAL();
                 int       result    = signUpBAL.Register(_signup);
                 if (result > 1)
                 {
                     if (RoleList.SelectedValue == "Admin")
                     {
                         ClientScript.RegisterStartupScript(this.GetType(), "Popup", "SignUpAdminAlert();", true);
                         lblStatus.Text = "";
                     }
                     else if (RoleList.SelectedValue == "Customer")
                     {
                         ClientScript.RegisterStartupScript(this.GetType(), "Popup", "SignUpUserAlert();", true);
                         lblStatus.Text = "";
                     }
                 }
                 else
                 {
                     lblStatus.Text = "User Name already exist";
                 }
             }
             else
             {
                 lblUploaded.Text = "Plz Upload Valid image!!";
             }
         }
         else
         {
             lblUploaded.Text = "Plz upload the image!!!!";
         }
     }
     catch (Exception ex)
     {
         lblStatus.Text = ex.Message;
     }
 }