Пример #1
0
        private void ListUserbutton_Click(object sender, EventArgs e)
        {
            BussinesLayer.ZKTecoDeviceBLL obj = new BussinesLayer.ZKTecoDeviceBLL();

            BiometricCore.UserInfo user = new BiometricCore.UserInfo();
            ICollection <BiometricCore.UserInfo> users = obj.GetAllUserInfo();
        }
Пример #2
0
        private void test_Click(object sender, EventArgs e)
        {
            BussinesLayer.ZKTecoDeviceBLL obj = new BussinesLayer.ZKTecoDeviceBLL();

            BiometricCore.UserInfo user = new BiometricCore.UserInfo();
            user = obj.GetUserInfoById(175);
        }
Пример #3
0
        private void NewUserbutton_Click(object sender, EventArgs e)
        {
            BussinesLayer.ZKTecoDeviceBLL obj = new BussinesLayer.ZKTecoDeviceBLL();

            BiometricCore.UserInfo user = new BiometricCore.UserInfo();
            int id = obj.SetUserInfo(177, "dchan", 1, "", "177177");

            MessageBox.Show(string.Format("{0}", id));
        }
Пример #4
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (FormValidate())
                {
                    CompanyBLL CompanyBLL = new CompanyBLL();
                    CompanyML  Company    = CompanyBLL.GetEntity();

                    UsersML User = new UsersML
                    {
                        UserName = textBoxUsuario.Text,
                        Password = textBoxPassword.Text,
                        Image    = System.IO.Path.GetFileName(PathFileNameTextBox.Text),
                        Rol      = int.Parse(comboBoxRol.SelectedValue.ToString())
                    };

                    if (IdUser > 0)
                    {
                        User.Id = IdUser;
                    }

                    UsersBLL   UsersBALL = new UsersBLL();
                    EmployeeML Employee  = new EmployeeML
                    {
                        RFC           = textBoxRfc.Text,
                        Curp          = textBoxCurp.Text,
                        Name          = textBoxNombre.Text,
                        LastName      = textBoxApellidos.Text,
                        Scholarship   = comboBoxEscolaridad.SelectedValue.ToString(),
                        Birthdate     = dateTimeFechaNacimiento.Value,
                        Nationality   = textBoxNacionalidad.Text,
                        Address       = textBoxCalle.Text,
                        Municipality  = textBoxMunicipio.Text,
                        Country       = textBoxPais.Text,
                        Email         = textBoxEmail.Text,
                        Telephone     = textBoxTelefono.Text,
                        CivilStatus   = comboBoxEstadoCivil.SelectedValue.ToString(),
                        PostalCode    = (String.IsNullOrEmpty(textBoxCodigoPostal.Text))?0: int.Parse(textBoxCodigoPostal.Text),
                        Colony        = textBoxColonia.Text,
                        StateCountry  = textBoxEstado.Text,
                        AdmissionDate = dateTimeFechaIngreso.Value,
                        IdDepartament = Int32.Parse(comboBoxDepartamento.SelectedValue.ToString()),
                        IdJob         = Int32.Parse(comboBoxPuesto.SelectedValue.ToString()),
                        SureType      = comboBoxTipoSeguro.SelectedValue.ToString(),
                        NumberSure    = textBoxNumSeguro.Text,
                        Salary        = Convert.ToDecimal(textBoxSueldo.Text),
                        HoursDay      = Convert.ToDateTime(textBoxNumHours.Text),
                    };

                    if (radioButtonHombre.Checked)
                    {
                        Employee.Gender = "Hombre";
                    }
                    else
                    {
                        Employee.Gender = "Mujer";
                    }

                    if (IdEmployee > 0)
                    {
                        Employee.Id = IdEmployee;
                    }
                    Employee.IdUser = UsersBALL.Save(User);
                    EmployeeBLL EmployeeBLL   = new EmployeeBLL();
                    int         IdNewEmployee = EmployeeBLL.Save(Employee);

                    DaysOfWorkEmployeeBLL DaysOfWorkEmployeeBLL = new DaysOfWorkEmployeeBLL();
                    DaysOfWorkEmployeeBLL.DeleteRegistrys(IdEmployee);
                    foreach (object item in checkedListBoxDias.CheckedItems)
                    {
                        DaysOfWorkEmployeeML DaysOfWorkEmployee = new DaysOfWorkEmployeeML()
                        {
                            IdDays     = Int32.Parse(item.GetType().GetProperty("Value").GetValue(item, null).ToString()),
                            IdEmployee = IdNewEmployee
                        };
                        DaysOfWorkEmployeeBLL.Save(DaysOfWorkEmployee);
                    }

                    TurnsOfEmployeeBLL TurnsOfEmployeeBLL = new TurnsOfEmployeeBLL();
                    TurnsOfEmployeeBLL.DeleteRegistrys(IdEmployee);
                    foreach (object item in checkedListBoxTurns.CheckedItems)
                    {
                        TurnsOfEmployeeML TurnsOfEmployee = new TurnsOfEmployeeML()
                        {
                            IdTurn       = Int32.Parse(item.GetType().GetProperty("Value").GetValue(item, null).ToString()),
                            IdEmployee   = IdNewEmployee,
                            IdUserInsert = GlobalBLL.userML.Id
                        };
                        TurnsOfEmployeeBLL.Save(TurnsOfEmployee);
                    }

                    if (!string.IsNullOrEmpty(PathFileNameTextBox.Text) && !string.IsNullOrEmpty(PathFileImage) && System.IO.Path.GetFileName(PathFileImageOld) != PathFileImage)
                    {
                        if (!System.IO.Directory.Exists(DirectoryFiles))
                        {
                            System.IO.Directory.CreateDirectory(DirectoryFiles);
                        }

                        System.IO.File.Delete(string.Format("{0}/{1}", DirectoryFiles, PathFileNameTextBox.Text));
                        System.IO.File.Copy(PathFileImage, string.Format("{0}/{1}", DirectoryFiles, System.IO.Path.GetFileName(PathFileNameTextBox.Text)));
                    }

                    ZKTecoDeviceBLL        zKTecoDevice = new ZKTecoDeviceBLL();
                    BiometricCore.UserInfo _userInfo    = new BiometricCore.UserInfo()
                    {
                        EnrollNumber = string.Format("{0}", IdNewEmployee),
                        Name         = Employee.Name,
                        Privelage    = (int)BiometricCore.Enums.Privileges.CommonUser,
                        TmpData      = "",
                        Password     = string.Format("{0}", IdNewEmployee)
                    };
                    zKTecoDevice.SetUserInfo(_userInfo, Convert.ToInt32(Company.NumberUserEmploye));

                    cFMEM100010 FrmDataGrid = this.Owner as cFMEM100010;
                    FrmDataGrid.LoadDataGridView();
                    cFAT100010 Alert = new cFAT100010("Información", "Información Guardado con exito!!", MessageBoxIcon.Information);
                    Alert.ShowDialog();
                    Alert.Dispose();
                    Clear();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("buttonGuardar_Click: {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }