protected void btnSubmit_Click(object sender, EventArgs e) { HomeBE objHomeBe = new HomeBE(); objHomeBe.UserName = txtUserName.Text.Trim(); objHomeBe.Passw0rd = txtPassword.Text.Trim(); string success = string.Empty; int userid = 0; success = objHomeBl.GetUserInfo(objHomeBe); if (success != string.Empty) { userid = Convert.ToInt32(success); } if (success == string.Empty) { lblMessage.Text = "Invalid User"; lblMessage.Visible = true; } else { Response.Redirect("New User.aspx?Userid=" + userid); } //if (success.Tables[0].Rows.Count > 0) //{ // // foreach (DataRow drow in success.Tables[0].Rows) // { // userid = Convert.ToInt32(drow["UserId"]); // } // Response.Redirect("New User.aspx?Userid=" + userid); //} }
public string GetUserInfo(HomeBE objHomeBe) { string success = string.Empty; try { success = objHomeDL.GetUserInfo(objHomeBe); } catch (Exception ex) { throw ex; } return(success); }
public string GetUserInfo(HomeBE objHomeBe) { SqlCommand sqlCmd = new SqlCommand(); string success = string.Empty; try { commandText = "ValidateLogonUser"; sqlCmd.Parameters.AddWithValue("@UserName", objHomeBe.UserName); sqlCmd.Parameters.AddWithValue("@Password", objHomeBe.Passw0rd); success = objConnection.ExecuteSQLScalar(sqlCmd, CommandType.StoredProcedure, commandText); } catch (Exception ex) { throw ex; } return(success); }