Exemple #1
0
        private void btnEntrarLogin_Click_1(object sender, EventArgs e)
        {
            String pass   = txtPassword.Text;
            String user   = txtUsername.Text;
            int    result = serviceDA.ConfirmUsuario(user, pass);

            if (cont < 4)
            {
                if (result != 0)
                {
                    AlmacenDisecWS.employee emp = serviceDA.EmployeeByCode(user);
                    // mainWindow.Closed += (s, args) => this.Close();
                    this.Hide();
                    frmPrincipal mainWindow = new frmPrincipal();
                    mainWindow.lblCargo.Text     = emp.privilege.ToString();
                    mainWindow.lblNombre.Text    = emp.employee_name;
                    mainWindow.lblApellidos.Text = emp.last_name + " " + emp.second_last_name;
                    if (emp.privilege.ToString() == "STOREKEEPER")
                    {
                        mainWindow.btnReport.Enabled = false;
                        mainWindow.btnGUser.Enabled  = false;
                    }
                    else if (emp.privilege.ToString() == "TECHNICIAN")
                    {
                        mainWindow.btnReport.Enabled   = false;
                        mainWindow.btnGUser.Enabled    = false;
                        mainWindow.btnSupplier.Enabled = false;
                        mainWindow.btnStore.Enabled    = false;
                        mainWindow.btnCategory.Enabled = false;
                        mainWindow.btnFamiliy.Enabled  = false;
                        mainWindow.btnBrand.Enabled    = false;
                        mainWindow.btnMaterial.Enabled = false;
                        mainWindow.btnTool.Enabled     = false;
                    }


                    mainWindow.Show();

                    return;
                }
                else
                {
                    frmMessageBoxDontCoincidence fm = new frmMessageBoxDontCoincidence();
                    fm.ShowDialog();
                    cont++;
                }
            }
            else
            {
                frmMessageBoxBlockSystem fm = new frmMessageBoxBlockSystem();
                fm.ShowDialog();
                cont = 0;
                btnEntrarLogin.Enabled = false;
                tmLogin.Start();
            }
        }
        private void BtnModify_Click(object sender, EventArgs e)
        {
            frmUser frm = new frmUser();

            frm.flag = false;

            AddOwnedForm(frm);
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel        = false;
            frm.Dock            = DockStyle.Fill;
            this.Controls.Add(frm);
            this.Tag = frm;
            frm.cboPrivilege.Enabled = false;

            String cod = dgvSearch.CurrentRow.Cells[0].Value.ToString();

            AlmacenDisecWS.employee emp = new AlmacenDisecWS.employee();
            emp = serviceDA.EmployeeByCode(cod);

            frm.lblId.Text          = emp.employee_id.ToString();
            frm.txtCode.Text        = emp.eployee_code;
            frm.txtName.Text        = emp.employee_name;
            frm.txtLastName1.Text   = emp.last_name;
            frm.txtLastName2.Text   = emp.second_last_name;
            frm.txtEmail.Text       = emp.email_employee;
            frm.txtDNI.Text         = emp.dni;
            frm.txtPassword.Enabled = false;
            frm.txtSalary.Text      = emp.salary.ToString();
            frm.cboPrivilege.Text   = dgvSearch.CurrentRow.Cells[8].Value.ToString();
            frm.btnDelete.Enabled   = true;
            if (emp.gender == "F")
            {
                frm.rbWoman.Checked = true;
            }
            else
            {
                frm.rbMan.Checked = true;
            }


            frm.BringToFront();
            frm.Show();
        }