protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bal.Users obj = new bal.Users(); if (Request.QueryString["userid"] == null) { GridView1.DataSource = obj.list(); GridView1.DataBind(); } else { obj.userid = Int32.Parse(Request.QueryString["userid"].ToString()); if (obj.remove() > 0) { Response.Redirect("~/admin/userlist.aspx"); } else { Response.Write("Data couldnot Removed !!"); } } } }
public int save(bal.Users o) { sqlcmd = con.dbCommand("users_save"); sqlcmd.Parameters.AddWithValue("@userid", o.userid); sqlcmd.Parameters.AddWithValue("@email", o.email); sqlcmd.Parameters.AddWithValue("@password", o.password); sqlcmd.Parameters.AddWithValue("@fullname", o.fullname); return(sqlcmd.ExecuteNonQuery()); }
void dList(DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { bal.Users c = new bal.Users(); c.userid = Int32.Parse(dt.Rows[i]["userid"].ToString()); c.email = dt.Rows[i]["email"].ToString(); c.fullname = dt.Rows[i]["fullname"].ToString(); cList.Add(c); } }
public List <bal.Users> get(bal.Users o) { sqlcmd = con.dbCommand("users_get"); sqlcmd.Parameters.AddWithValue("@userid", o.userid); SqlDataReader sqldr = sqlcmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(sqldr); dList(dt); return(cList); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["users"] != null) { bal.Users obj = new bal.Users(); obj = (bal.Users)Session["users"]; lblUsers.Text = "Welcome to [( " + obj.fullname + " )]"; } else { Response.Redirect("~/admin/default.aspx"); } } }
protected void btn_login_Click(object sender, EventArgs e) { bal.Users obj = new bal.Users(); obj.userid = Request.QueryString["userid"] == null ? 0 : Int32.Parse(Request.QueryString["userid"].ToString()); obj.email = txt_email.Text; obj.fullname = txt_fullname.Text; obj.password = txt_passwords.Text; if (obj.save() > 0) { Response.Redirect("~/admin/userlist.aspx"); } else { Response.Write("Could not Saved !!!"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["userid"] != null) { bal.Users obj = new bal.Users(); obj.userid = Int32.Parse(Request.QueryString["userid"].ToString()); List <bal.Users> list = obj.get(); txt_email.Text = list[0].email.ToString(); txt_fullname.Text = list[0].fullname.ToString(); // txt_passwords.Text = list[0].password.ToString(); // txt_conformedpasssword.Text = txt_passwords.Text; } else { clearFields(); } } }
public void checkLogin(bal.Users o) { sqlcmd = con.dbCommand("users_checklogin"); sqlcmd.Parameters.AddWithValue("@username", o.email); sqlcmd.Parameters.AddWithValue("@password", o.password); SqlDataReader sqldr = sqlcmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(sqldr); dList(dt); if (dt.Rows.Count > 0) { o.userid = Int32.Parse(dt.Rows[0]["userid"].ToString()); o.fullname = dt.Rows[0]["fullname"].ToString(); o.password = "******"; } else { o = null; } }
protected void btn_login_Click(object sender, EventArgs e) { string username = txt_username.Text; string password = txt_password.Text; if (Page.IsValid) { bal.Users obj = new bal.Users(); obj.email = username; obj.password = password; obj.checklogin(); if (obj.userid > 0) { Session["users"] = obj; Response.Redirect("~/admin/main.aspx"); } else { lblerrormsg.Text = "Username & Password isnot Found !!!"; } } }
public int remove(bal.Users o) { sqlcmd = con.dbCommand("users_remove"); sqlcmd.Parameters.AddWithValue("@userid", o.userid); return(sqlcmd.ExecuteNonQuery()); }