if (Page.IsValid) { UserValidation UserV = new UserValidation(); int a = UserV.check_Login(UNtxt.Text, PWtxt.Text, List_company_cmbo.Text); if (a == 1) { //Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Login is ok')</SCRIPT>"); //Response.Write("<a href='WebForm1.aspx'></a> "); // WebForm1 wb = new WebForm1(); Session["logged"] = "logged"; Response.Redirect("Home.aspx"); } else if (a == 3) { // warning_txt.Text = ""; // warning_txt.Visible = true; System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Action Will be cancelled. Please contact the system administrator')</SCRIPT>"); } else { // Response.Redirect("index.aspx"); warning_txt.Visible = true; } } else { Page_PreRender(); }
public static string F_name; public static string Comp_Code; public static string Comp_sqnumber; static SqlCommand cmd; public int check_Login(string userName, string Password, string c_id) { DatabaseTrans dTrans = new DatabaseTrans(); string page = "UserValidation.cs"; string d = userName; string pwr = Password.Trim(); string sql; int a = 0; // string Nname; string cipherPW = CryptorEngine.Encrypt(pwr, true); try { sql = "Select * from tblUser where UserID = '" + userName + "' and userPassword = '" + cipherPW + "' and compID ='" + c_id + "' "; cmd = new SqlCommand(sql, DatabaseTrans.getConn()); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count == 1) { a = 1; F_name = dt.Rows[0][3].ToString(); Comp_Code = dt.Rows[0][1].ToString(); Comp_sqnumber = dt.Rows[0][2].ToString(); } else { a = 0; } // DatabaseTrans.closeCon(); return a; } catch (Exception ex) { ErrorLog el = new ErrorLog(); el.ErrorRegistry(ex, page, "User Validation.cs under login click", "NA", "NA"); a = 3; return a; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)