protected void btnSave_Click(object sender, EventArgs e) { busEmployees busemp = new busEmployees(); Employees frmEmp = new Employees(); frmEmp.FullName = this.txtFullname.Text; frmEmp.Email = this.txtEmail.Text; frmEmp.Login = this.txtLogin.Text; frmEmp.LastName = this.txtLastName.Text; frmEmp.passwords = this.txtPassword.Text; isExisting = isUserExisting(); if (isExisting.Equals(true)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('User existing')", true); } else { busemp.insertEmployee(frmEmp); } DataTable dt = new DataTable("User"); dt = busemp.allUser(); GridView1.DataSource = dt; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { busEmployees busemp = new busEmployees(); //FrameWork.Login[] log; //log = buslogin.getAllUser(); //UserGridView.DataSource = log; //UserGridView.DataBind(); DataTable dt = new DataTable("User"); dt = busemp.allUser(); GridView1.DataSource = dt; GridView1.DataBind(); /*trial code*/ //FrameWork.Login a = new FrameWork.Login(); //BusLogin buslogin = new BusLogin(); //DataTable userDt = new DataTable(); //DataTable dt = new DataTable(); ////dt = buslogin.allUser(); //a.UserTable = buslogin.allUser(); //dt = a.UserTable; //UserGridView.DataSource = dt; //UserGridView.DataBind(); /*trial code*/ } }
private bool isUserExisting() { string userid = this.txtLogin.Text; busEmployees busemp = new busEmployees(); FrameWork.Employees log = busemp.isUserExisting(userid); if (log == null) { return(false); } else if (userid.Equals(log.Login)) { return(true); } else { return(false); } }