public int CreateUserInfo(UserProfile userDo) { try { dalComponent.SetParameters("@UserId", SqlDbType.Int, 4, userDo.UserId); dalComponent.SetParameters("@UserName", SqlDbType.VarChar, 100, userDo.UserName); dalComponent.SetParameters("@FirstName", SqlDbType.VarChar, 100, userDo.FirstName); dalComponent.SetParameters("@LastName", SqlDbType.VarChar, 100, userDo.LastName); dalComponent.SetParameters("@Gender", SqlDbType.Int, 4, userDo.Gender); dalComponent.SetParameters("@UserPassword", SqlDbType.VarChar, 50, userDo.UserPassword); dalComponent.SetParameters("@Email", SqlDbType.VarChar, 50, userDo.Email); dalComponent.SetParameters("@Mobile", SqlDbType.VarChar, 50, userDo.Mobile); dalComponent.SetParameters("@Address", SqlDbType.VarChar, 100, userDo.Address); dalComponent.SetParameters("@StreetName", SqlDbType.VarChar, 50, userDo.StreetName); dalComponent.SetParameters("@CityId", SqlDbType.Int, 4, userDo.CityId); dalComponent.SetParameters("@StateId", SqlDbType.Int, 4, userDo.StateId); dalComponent.SetParameters("@CountryId", SqlDbType.Int, 4, userDo.CountryId); dalComponent.SetParameters("@ZipCode", SqlDbType.VarChar, 50, userDo.ZipCode); dalComponent.SetParameters("@idvalue", SqlDbType.Int, true); dalComponent.SqlCommandText = "CreateUser"; int x = dalComponent.CreateRecord(); object y = dalComponent.GetParameters("@idvalue"); if (userDo.UserId != 0) return userDo.UserId; else return Int32.Parse(y.ToString()); } catch (System.Data.SqlClient.SqlException sqlEx) { throw; } catch (Exception ex) { throw; } }
public UserProfile UserProfile(int userId) { try { DataTable dt = new DataTable(); UserProfile userProfile = new UserProfile(); dalComponent.SetParameters("@userId", SqlDbType.Int, 4, userId); dalComponent.SqlCommandText = "SelectProfile"; dt = dalComponent.SelectRecord(); if (dt.Rows.Count > 0) { userProfile.UserId = (int)dt.Rows[0]["UserId"]; userProfile.FirstName = dt.Rows[0]["firstName"].ToString(); userProfile.LastName = dt.Rows[0]["lastName"].ToString(); userProfile.Address = dt.Rows[0]["email"].ToString(); userProfile.UserName = dt.Rows[0]["userName"].ToString(); userProfile.UserPassword = dt.Rows[0]["UserPassword"].ToString(); return userProfile; } } catch (Exception ex) { throw; } return null; }
protected void btnSave_Click(object sender, EventArgs e) { int intErrorCount = 0; if (strEmail != txtEmail.Text.Trim()) { MailCheck(txtEmail.Text.Trim()); if (intMailAvail == 1) { intErrorCount++; lblErrorEmail.Visible = true; } else lblErrorEmail.Visible = false; } if (intErrorCount == 0) { UserInfoBll userBll = new UserInfoBll(); UserProfile userProfile = new UserProfile(); try { userProfile.UserId = Convert.ToInt32(Session["UserId"].ToString()); userProfile.UserName = strUsername; if (txtNewpwd.Text.Trim() != "") userProfile.UserPassword = txtNewpwd.Text; else userProfile.UserPassword = strPassword; userProfile.FirstName = txtFirstName.Text.ToString().Trim(); userProfile.LastName = txtLastName.Text.ToString().Trim(); userProfile.Email = txtEmail.Text.ToString().Trim(); userProfile.Address = txtAddress.Text.ToString().Trim(); userProfile.Mobile = txtMobile.Text.ToString().Trim(); userProfile.StreetName = txtStreetname.Text.ToString().Trim(); userProfile.CityId = Convert.ToInt32(ddlCity.SelectedItem.Value.ToString().Trim()); userProfile.StateId = Convert.ToInt32(ddlState.SelectedItem.Value.ToString().Trim()); userProfile.ZipCode = txtZipcode.Text.ToString().Trim(); userProfile.CountryId = Convert.ToInt32(ddlCountry.SelectedItem.Value.ToString().Trim()); userProfile.Gender = int.Parse(RadioButtonList1.SelectedItem.Value.ToString().Trim()); if (intErrorCount == 0) { int x = userBll.CreateUserInfo(userProfile); //HttpContext.Current.Session.Add("UserId", x); //SendMailtoUser(x); Response.Redirect("MyProfile.aspx"); } } catch (System.Threading.ThreadAbortException th) { } catch (Exception ex) { } } }
public DataTable SelectAllProfile() { try { DataTable dt = new DataTable(); UserProfile userProfile = new UserProfile(); dalComponent.SqlCommandText = "SelectAllProfile"; return dt = dalComponent.SelectRecord(); } catch (Exception ex) { throw; } }
protected void btnRegister_Click(object sender, EventArgs e) { UserInfoBll userBll = new UserInfoBll(); UserProfile userProfile = new UserProfile(); try { string ErrorMsg = ""; userProfile.UserId = 0; userProfile.FirstName = txtFirstname.Text.ToString().Trim(); userProfile.LastName = txtLastname.Text.ToString().Trim(); userProfile.Email = txtEmail.Text.ToString().Trim(); userProfile.UserName = txtUsername.Text.ToString().Trim(); userProfile.UserPassword = txtPassword.Text.ToString().Trim(); userProfile.Address = txtAddress.Text.ToString().Trim(); userProfile.Mobile = txtMobile.Text.ToString().Trim(); userProfile.StreetName = txtStreetname.Text.ToString().Trim(); userProfile.CityId = Convert.ToInt32(ddlCity.SelectedItem.Value.ToString().Trim()); userProfile.StateId = Convert.ToInt32(ddlState.SelectedItem.Value.ToString().Trim()); userProfile.ZipCode = txtZipcode.Text.ToString().Trim(); userProfile.CountryId = Convert.ToInt32(ddlCountry.SelectedItem.Value.ToString().Trim()); userProfile.Gender = int.Parse(RadioButtonList1.SelectedItem.Value.ToString().Trim()); ErrorMsg = "Error:"; int intErrorCount = 0; UserCheck(); if (this.intUserAvail == 1) intErrorCount++; if (txtPassword.Text != txtRePassword.Text) { //errPwd.Text = "Password mismatch"; //errPwd.Visible = true; intErrorCount++; } //else //errPwd.Visible = false; if (chkYardecart.Checked==false) { ErrCheck.Text = "Please check signup"; ErrCheck.Visible = true; intErrorCount++; } else ErrCheck.Visible = false; MailCheck(); if (intMailAvail == 1) { intErrorCount++; lblErrorEmail.Visible = true; } else lblErrorEmail.Visible = false; if (chkYardecart.Checked == true && intErrorCount == 0) { int x = userBll.CreateUserInfo(userProfile); //HttpContext.Current.Session.Add("UserId", x); SendMailtoUser(x); Response.Redirect("Success.aspx"); } } catch (System.Threading.ThreadAbortException th) { } catch (Exception ex) { lblError.Text = ex.Message; lblError.Visible = true; } }