Ejemplo n.º 1
0
        protected void BtnOk_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;
            frmEmp.IDAccess = int.Parse(this.ddpAccess.SelectedValue);

            isExisting = isUserExisting();
            if (isExisting.Equals(true))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('User existing')", true);
            }
            else
            {
                string x = busemp.insertEmployee(frmEmp);

                if (x.Trim() == string.Empty)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Successfully added new User')", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Failed to added new User')", true);
                }
            }
            //DataTable dt = new DataTable("User");
            //dt = busemp.allUser();
            //GridView1.DataSource = dt;
            //GridView1.DataBind();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
 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;
     }
 }
Ejemplo n.º 4
0
        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*/
            }
        }
Ejemplo n.º 5
0
        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();
                ViewState["User"] = dt;
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }