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();
        }