private void BtnGUser_Click(object sender, EventArgs e)
        {
            frmSearchUser fm = new frmSearchUser();

            // fm.FormClosed += new FormClosedEventHandler(ShowFormInitialCloseForms);
            OpenFormPanel(fm);
        }
Example #2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            frmMessageBoxBack frm = new frmMessageBoxBack();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                frmSearchUser fm = Owner as frmSearchUser;
                //fm.dgvSearch.AutoGenerateColumns = false;
                //fm.dgvSearch.DataSource = serviceDA.queryAllEmployee();


                this.Close();
            }
        }
Example #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtCode.Text))
            {
                frmMessageBoxFillNull frm = new frmMessageBoxFillNull();
                frm.ShowDialog();
            }
            else
            {
                frmMessageBoxDelete frm = new frmMessageBoxDelete();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    String cod = txtCode.Text;
                    serviceDA.deleteEmployee(cod);
                    frmSearchUser fm = Owner as frmSearchUser;
                    fm.dgvSearch.AutoGenerateColumns = false;
                    fm.dgvSearch.DataSource          = serviceDA.queryAllEmployee();

                    this.Close();
                }
            }
        }
Example #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (flag == true)
            {
                if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtLastName1.Text) || String.IsNullOrEmpty(txtLastName2.Text) ||
                    String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtDNI.Text) || String.IsNullOrEmpty(txtSalary.Text) || String.IsNullOrEmpty(txtPassword.Text) ||
                    cboPrivilege.SelectedIndex == -1 || (rbWoman.Checked == false && rbMan.Checked == false))
                {
                    frmMessageBoxFillNull frm = new frmMessageBoxFillNull();
                    frm.ShowDialog();
                }
                else
                {
                    AlmacenDisecWS.employee emp = new AlmacenDisecWS.employee();

                    frmMessageBoxSave frm = new frmMessageBoxSave();
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        string name   = txtName.Text;
                        string apP    = txtLastName1.Text;
                        string apM    = txtLastName2.Text;
                        string DNI    = txtDNI.Text;
                        string email  = txtEmail.Text;
                        string pass   = txtPassword.Text;
                        Double sueldo = Double.Parse(txtSalary.Text);

                        emp.employee_name    = name;
                        emp.last_name        = apP;
                        emp.second_last_name = apM;
                        emp.dni            = DNI;
                        emp.email_employee = email;
                        emp.salary         = sueldo;
                        emp.password       = pass;
                        int a = 0;

                        if (cboPrivilege.SelectedValue.ToString() == "MANAGER")
                        {
                            a = 1;
                        }
                        else if (cboPrivilege.SelectedValue.ToString() == "STOREKEEPER")
                        {
                            a = 2;
                        }
                        else
                        {
                            a = 3;
                        }

                        if (rbMan.Checked == true)
                        {
                            emp.gender = "M";
                        }
                        else
                        {
                            emp.gender = "F";
                        }
                        int result = serviceDA.insertEmployee(emp, a);
                    }
                    frmSearchUser fm = Owner as frmSearchUser;
                    fm.dgvSearch.AutoGenerateColumns = false;
                    fm.dgvSearch.DataSource          = serviceDA.queryAllEmployee();

                    this.Close();
                }
            }
            else
            {
                if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtLastName1.Text) || String.IsNullOrEmpty(txtLastName2.Text) ||
                    String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtDNI.Text) || String.IsNullOrEmpty(txtSalary.Text) ||
                    (rbWoman.Checked == false && rbMan.Checked == false))
                {
                    frmMessageBoxFillNull frm = new frmMessageBoxFillNull();
                    frm.ShowDialog();
                }
                else
                {
                    AlmacenDisecWS.employee emp = new AlmacenDisecWS.employee();

                    frmMessageBoxSave frm = new frmMessageBoxSave();
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        string name  = txtName.Text;
                        string apP   = txtLastName1.Text;
                        string apM   = txtLastName2.Text;
                        string DNI   = txtDNI.Text;
                        string email = txtEmail.Text;

                        Double sueldo = Double.Parse(txtSalary.Text);
                        emp.employee_id      = Int32.Parse(lblId.Text);
                        emp.employee_name    = name;
                        emp.last_name        = apP;
                        emp.second_last_name = apM;
                        emp.dni            = DNI;
                        emp.salary         = sueldo;
                        emp.email_employee = email;
                        if (rbMan.Checked == true)
                        {
                            emp.gender = "M";
                        }
                        else
                        {
                            emp.gender = "F";
                        }
                        int result = serviceDA.updateEmployee(emp);
                    }
                }
                frmSearchUser fm = Owner as frmSearchUser;
                fm.dgvSearch.AutoGenerateColumns = false;
                fm.dgvSearch.DataSource          = serviceDA.queryAllEmployee();

                this.Close();
            }
        }