protected void submitButton_Click(object sender, EventArgs e) { UserDetailsBO userDetailsBOObj = new UserDetailsBO(); userDetailsBOObj.UserID = userIdTextBox.Text; userDetailsBOObj.UserName = userNameTextBox.Text; userDetailsBOObj.Password = passwordTextBox.Text; userDetailsBOObj.Role = roleDropDownLis.SelectedItem.Value; Session["userName"] = userDetailsBOObj.UserName; UserRegistrationBLL accountCreate = new UserRegistrationBLL(); int queryStatus = accountCreate.InsertUserDetails(userDetailsBOObj); if (queryStatus < 0) { //esponse.Write("<script>alert('Your account has been created successfully!.');</script>"); DialogResult result1 = MessageBox.Show("Created Successfully", "Important Info", MessageBoxButtons.OK); // ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Created Successfully');", true); if (result1 == DialogResult.OK) { Response.Redirect("Login.aspx"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert(' account not created ')", true); } }
public int InsertUserDetails(UserDetailsBO userDetailsObj) { dbConnection.DBDataTable = new System.Data.DataTable("users"); dbConnection.DBDataTable.Columns.Add("UserId", typeof(string)); dbConnection.DBDataTable.Columns.Add("UserName", typeof(string)); dbConnection.DBDataTable.Columns.Add("Password", typeof(string)); dbConnection.DBDataTable.Columns.Add("Role", typeof(string)); dbConnection.DBDataTable.Rows.Add(userDetailsObj.UserID, userDetailsObj.UserName, userDetailsObj.Password, userDetailsObj.Role); try { dbConnection.DBConnection.Open(); using (dbConnection.DBConnection) { dbConnection.DBCommand = new System.Data.SqlClient.SqlCommand("dbo.uspInsertUserDetails", dbConnection.DBConnection); dbConnection.DBCommand.CommandType = CommandType.StoredProcedure; SqlParameter tvpParam = dbConnection.DBCommand.Parameters.AddWithValue("@TVP", dbConnection.DBDataTable); tvpParam.SqlDbType = SqlDbType.Structured; queryStatus = dbConnection.DBCommand.ExecuteNonQuery(); return queryStatus; } } catch (SqlException exc) { return queryStatus; } finally { dbConnection.DBConnection.Close(); } }
public DataTable ValidateUserCredintials(UserDetailsBO userDetails) { try { dbConnection.DBAdapter = new SqlDataAdapter(); dbConnection.DBCommand = new SqlCommand("uspValidateUser",dbConnection.DBConnection); dbConnection.DBCommand.CommandType = CommandType.StoredProcedure; dbConnection.DBCommand.Parameters.AddWithValue("@userid", userDetails.UserID); dbConnection.DBCommand.Parameters.AddWithValue("@password", userDetails.Password); dbConnection.DBAdapter.SelectCommand = dbConnection.DBCommand; dbConnection.DBDataTable = new DataTable("validate"); dbConnection.DBAdapter.Fill(dbConnection.DBDataTable); return dbConnection.DBDataTable; } catch (SqlException) { return dbConnection.DBDataTable; } }
protected void submitButton_Click(object sender, EventArgs e) { long loginId = 0; UserRegistrationBLL userValidate = new UserRegistrationBLL(); UserDetailsBO user = new UserDetailsBO(); user.UserID = userNameTextBox.Text; user.Password = passwordTextBox.Text; Session["userId"] = user.UserID; // this.Master.userId = Session["userId"].ToString(); DataTable resultTable = userValidate.ValidateUserCredintials(user); Object rowValue = resultTable.Rows[0]["result"]; string validationResult = rowValue.ToString(); if (validationResult.Equals("true")) { Object rowValue2 = resultTable.Rows[0]["role"]; string role = rowValue2.ToString(); Object loginInfo = resultTable.Rows[0]["Loginid"]; loginId = Convert.ToInt64(loginInfo); //Session["LoginId"] = loginId; if (role.Equals("Admin")) { loginId = Convert.ToInt64(loginInfo); Session["LoginId"] = loginId; Response.Redirect("~/JobPostingApprovalByAdmin.aspx"); } #region //resultTable = userValidate.ValidateUserCredintials(user); //rowValue = resultTable.Rows[0]["result"]; //validationResult = rowValue.ToString(); //if (validationResult.Equals("true")) //{ // Object rowValue2 = resultTable.Rows[0]["role"]; // string role = rowValue2.ToString(); // Object loginInfo = resultTable.Rows[0]["Loginid"]; // loginId = Convert.ToInt64(loginInfo); // Session["LoginId"] = loginId; #endregion else if (role.Equals("Recruiter")) { loginId = Convert.ToInt64(loginInfo); Session["LoginId"] = loginId; Server.Transfer("RecruiterProfile.aspx"); } else if (role.Equals("JobSeeker")) { loginId = Convert.ToInt64(loginInfo); Session["LoginId"] = loginId; Server.Transfer("JobSeekerHomePage.aspx"); } } else if (validationResult.Equals("false")) { Server.Transfer("ErrorPage.aspx"); } }
public DataTable ValidateUserCredintials(UserDetailsBO userDetails) { return accountCreate.ValidateUserCredintials(userDetails); }
public int InsertUserDetails(UserDetailsBO userDetailsObj) { return accountCreate.InsertUserDetails(userDetailsObj); }