Example #1
0
 private void buttonEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         if (dataGridViewDataEmpleado.RowCount > 0)
         {
             IdRowSelect = dataGridViewDataEmpleado.CurrentRow.Index;
             cFAT100010 Alert = new cFAT100010("INFORMACION", String.Format("¿Desea eliminar el registro {0}?", dataGridViewDataEmpleado.Rows[IdRowSelect].Cells["Id"].Value.ToString()), MessageBoxIcon.Question);
             Alert.ShowDialog();
             if (Alert.DialogResult == DialogResult.Yes)
             {
                 EmployeeML Employee = new EmployeeML
                 {
                     Id = Int32.Parse(dataGridViewDataEmpleado.Rows[IdRowSelect].Cells["Id"].Value.ToString()),
                 };
                 EmployeeBLL.Delete(Employee);
                 dataGridViewDataEmpleado.Rows.Remove(dataGridViewDataEmpleado.CurrentRow);
             }
         }
         else
         {
             cFAT100010 Alert = new cFAT100010("Información", "No hay datos", MessageBoxIcon.Information);
             Alert.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(String.Format("buttonEliminar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
 public void LoadObject(int IdObject)
 {
     try
     {
         EmployeeBLL EmployeeBLL = new EmployeeBLL();
         if (EmployeeBLL.GetIdEntity(IdObject) != null)
         {
             EmployeeML Employee = EmployeeBLL.GetIdEntity(IdObject);
             textBoxNumControl.Text = Employee.Id.ToString();
             textBoxNombre.Text     = Employee.Name.ToString();
             textBoxApellidoP.Text  = Employee.LastName.ToString();
             DepartamentBLL DepartamentBLL = new DepartamentBLL();
             DepartamentML  Departament    = DepartamentBLL.GetIdEntity(Employee.IdDepartament);
             textBoxDepartamento.Text = Departament.Name.ToString();
             JobBLL JobBLL = new JobBLL();
             JobML  Job    = JobBLL.GetIdEntity(Employee.IdJob);
             textBoxPuesto.Text = Job.Name;
         }
         else
         {
             cFAT100010 Alert = new cFAT100010("Información", "El empleado no existe", MessageBoxIcon.Information);
             Alert.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(String.Format("LoadObject: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        public int Save(EmployeeML employee)
        {
            try
            {
                ModelDAL ModelDAL = new ModelDAL();
                String   Response = ModelDAL.InsertModel(employee, TableName, IdUserSession);

                SqlConnection Conexion = new SqlConnection()
                {
                    ConnectionString = ConnectionString
                };

                using (SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion))
                {
                    Conexion.Open();
                    int newID = (Int32)cmd2.ExecuteScalar();

                    if (Conexion.State == System.Data.ConnectionState.Open)
                    {
                        Conexion.Close();
                    }
                    return(newID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("{0}.save : {1}", core, ex));
            }
        }
Example #4
0
 public void Delete(EmployeeML employee)
 {
     try
     {
         EmployeeDAL.Delete(employee);
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.Delete: {1}", core, ex));
     }
 }
Example #5
0
        public void LoadUser()
        {
            try
            {
                employeeBLL = new EmployeeBLL();
                employeeML  = employeeBLL.GetEmploymentByIdUser(BussinesLayer.GlobalBLL.userML.Id);

                if (employeeML != null)
                {
                    KeyTextBox.Text      = employeeML.Id.ToString();
                    NameTextBox.Text     = employeeML.Name;
                    LastNameTextBox.Text = employeeML.LastName;
                }

                if (GlobalBLL.userML != null)
                {
                    UsersBLL usersBLL = new UsersBLL();
                    UsersML  usersML  = usersBLL.GetEntityById(GlobalBLL.userML.Id);

                    UserNameTextBox.Text = usersML.UserName;
                    PasswordTextBox.Text = usersML.Password;

                    if (!string.IsNullOrEmpty(GlobalBLL.userML.Image))
                    {
                        PathFileProfileTextBox.Text = string.Format("{0}\\{1}", System.IO.Path.GetFullPath(GlobalBLL.DirectoryFiles), GlobalBLL.userML.Image);

                        if (System.IO.File.Exists(PathFileProfileTextBox.Text))
                        {
                            ProfilePictureBox.BackgroundImage = new Bitmap(PathFileProfileTextBox.Text);
                        }
                        else
                        {
                            throw new Exception("No se encontró la imagen");
                        }
                    }
                }
                //else
                //{
                //    Alerts.cFAT100010 alr = new Alerts.cFAT100010("ERROR", "No se encontró la información del usuarios", MessageBoxIcon.Error);
                //    alr.ShowDialog();
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("LoadUser: {0}", ex.Message));
            }
        }
Example #6
0
 public int Save(EmployeeML employee)
 {
     try
     {
         if (employee.Id == 0)
         {
             return(EmployeeDAL.Save(employee));
         }
         else
         {
             return(EmployeeDAL.Update(employee));
         }
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.Save: {1}", core, ex));
     }
 }
Example #7
0
 public EmployeeML GetEntity(DataRow row)
 {
     try
     {
         if (row != null)
         {
             EmployeeML EmployeeML = new EmployeeML()
             {
                 Id            = (row[EmployeeML.DataBase.Id] != DBNull.Value) ? Convert.ToInt32(row[EmployeeML.DataBase.Id]) : 0,
                 RFC           = (row[EmployeeML.DataBase.Rfc] != DBNull.Value) ? row[EmployeeML.DataBase.Rfc].ToString() : string.Empty,
                 Curp          = (row[EmployeeML.DataBase.Curp] != DBNull.Value) ? row[EmployeeML.DataBase.Curp].ToString() : string.Empty,
                 Name          = (row[EmployeeML.DataBase.Name] != DBNull.Value) ? row[EmployeeML.DataBase.Name].ToString() : string.Empty,
                 LastName      = (row[EmployeeML.DataBase.Lastname] != DBNull.Value) ? row[EmployeeML.DataBase.Lastname].ToString() : string.Empty,
                 Scholarship   = (row[EmployeeML.DataBase.Scholarship] != DBNull.Value) ? row[EmployeeML.DataBase.Scholarship].ToString() : string.Empty,
                 Birthdate     = (row[EmployeeML.DataBase.Birthdate] != DBNull.Value) ? Convert.ToDateTime(row[EmployeeML.DataBase.Birthdate]) : Convert.ToDateTime(row[EmployeeML.DataBase.Birthdate]),
                 Gender        = (row[EmployeeML.DataBase.Gender] != DBNull.Value) ? row[EmployeeML.DataBase.Gender].ToString() : string.Empty,
                 Nationality   = (row[EmployeeML.DataBase.Nationality] != DBNull.Value) ? row[EmployeeML.DataBase.Nationality].ToString() : string.Empty,
                 Address       = (row[EmployeeML.DataBase.Address] != DBNull.Value) ? row[EmployeeML.DataBase.Address].ToString() : string.Empty,
                 Municipality  = (row[EmployeeML.DataBase.Municipality] != DBNull.Value) ? row[EmployeeML.DataBase.Municipality].ToString() : string.Empty,
                 Country       = (row[EmployeeML.DataBase.Country] != DBNull.Value) ? row[EmployeeML.DataBase.Country].ToString() : string.Empty,
                 Email         = (row[EmployeeML.DataBase.Email] != DBNull.Value) ? row[EmployeeML.DataBase.Email].ToString() : string.Empty,
                 CivilStatus   = (row[EmployeeML.DataBase.CivilStatus] != DBNull.Value) ? row[EmployeeML.DataBase.CivilStatus].ToString() : string.Empty,
                 Colony        = (row[EmployeeML.DataBase.Colony] != DBNull.Value) ? row[EmployeeML.DataBase.Colony].ToString() : string.Empty,
                 StateCountry  = (row[EmployeeML.DataBase.StateCountry] != DBNull.Value) ? row[EmployeeML.DataBase.StateCountry].ToString() : string.Empty,
                 PostalCode    = (row[EmployeeML.DataBase.PostalCode] != DBNull.Value) ? int.Parse(row[EmployeeML.DataBase.PostalCode].ToString()) : 0,
                 SureType      = (row[EmployeeML.DataBase.SureType] != DBNull.Value) ? row[EmployeeML.DataBase.SureType].ToString() : string.Empty,
                 IdJob         = (row[EmployeeML.DataBase.IdJob] != DBNull.Value) ? int.Parse(row[EmployeeML.DataBase.IdJob].ToString()) : 0,
                 IdDepartament = (row[EmployeeML.DataBase.IdDepartament] != DBNull.Value) ? int.Parse(row[EmployeeML.DataBase.IdDepartament].ToString()) : 0,
                 IdUser        = (row[EmployeeML.DataBase.IdUser] != DBNull.Value) ? int.Parse(row[EmployeeML.DataBase.IdUser].ToString()) : 0,
                 Telephone     = (row[EmployeeML.DataBase.Telephone] != DBNull.Value) ? row[EmployeeML.DataBase.Telephone].ToString() : String.Empty,
                 Salary        = (row[EmployeeML.DataBase.Salary] != DBNull.Value) ? decimal.Parse(row[EmployeeML.DataBase.Salary].ToString()) : 0,
                 HoursDay      = (row[EmployeeML.DataBase.HoursDay] != DBNull.Value) ? Convert.ToDateTime(row[EmployeeML.DataBase.HoursDay].ToString()) : DateTime.Now,
                 NumberSure    = (row[EmployeeML.DataBase.NumberSure] != DBNull.Value) ? row[EmployeeML.DataBase.NumberSure].ToString() : String.Empty,
             };
             return(EmployeeML);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.GetIdEntity : {1}", core, ex));
     }
 }
Example #8
0
 public void Delete(EmployeeML Employee)
 {
     try
     {
         ModelDAL      ModelDAL = new ModelDAL();
         String        Response = ModelDAL.DeleteModel(Employee, TableName, IdUserSession);
         SqlConnection Conexion = new SqlConnection()
         {
             ConnectionString = ConnectionString
         };
         Conexion.Open();
         SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion);
         cmd2.ExecuteNonQuery();
         Conexion.Close();
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.delete: {1}", core, ex));
     }
 }
Example #9
0
        public void LoadGetEmployee(int id)
        {
            try
            {
                EmployeeML EmployeeML = new EmployeeML();
                EmployeeML EmployeeEntiy;
                UsersML    UserEntity;

                if (EmployeeBLL.GetIdEntity(id).Id > 0)
                {
                    EmployeeEntiy = EmployeeBLL.GetIdEntity(id);
                    if (radioButtonHombre.Text == EmployeeEntiy.Gender.ToString())
                    {
                        radioButtonHombre.Checked = true;
                    }
                    else
                    {
                        radioButtonMujer.Checked = true;
                    }

                    textBoxRfc.Text                    = EmployeeEntiy.RFC.ToString();
                    textBoxCurp.Text                   = EmployeeEntiy.Curp.ToString();
                    textBoxNombre.Text                 = EmployeeEntiy.Name.ToString();
                    textBoxApellidos.Text              = EmployeeEntiy.LastName.ToString();
                    dateTimeFechaNacimiento.Text       = Convert.ToDateTime(EmployeeEntiy.Birthdate).ToString();
                    textBoxNacionalidad.Text           = EmployeeEntiy.Nationality.ToString();
                    textBoxCalle.Text                  = EmployeeEntiy.Address.ToString();
                    textBoxPais.Text                   = EmployeeEntiy.Country.ToString();
                    textBoxMunicipio.Text              = EmployeeEntiy.Municipality.ToString();
                    textBoxEmail.Text                  = EmployeeEntiy.Email.ToString();
                    textBoxColonia.Text                = EmployeeEntiy.Colony.ToString();
                    textBoxTelefono.Text               = EmployeeEntiy.Telephone.ToString();
                    textBoxCodigoPostal.Text           = EmployeeEntiy.PostalCode.ToString();
                    textBoxEstado.Text                 = EmployeeEntiy.StateCountry.ToString();
                    textBoxNumSeguro.Text              = EmployeeEntiy.NumberSure.ToString();
                    textBoxSueldo.Text                 = EmployeeEntiy.Salary.ToString();
                    textBoxNumHours.Text               = EmployeeEntiy.HoursDay.ToString("HH:mm:ss");
                    comboBoxTipoSeguro.SelectedValue   = EmployeeEntiy.SureType.ToString();
                    comboBoxDepartamento.SelectedValue = EmployeeEntiy.IdDepartament.ToString();
                    comboBoxEscolaridad.SelectedValue  = EmployeeEntiy.Scholarship.ToString();
                    comboBoxPuesto.SelectedValue       = EmployeeEntiy.IdJob.ToString();
                    comboBoxEstadoCivil.SelectedValue  = EmployeeEntiy.CivilStatus.ToString();

                    if (!String.IsNullOrEmpty(UsersBLL.GetEntityById(Convert.ToInt32(EmployeeEntiy.IdUser.ToString())).UserName))
                    {
                        UserEntity = UsersBLL.GetEntityById(Convert.ToInt32(EmployeeEntiy.IdUser.ToString()));

                        textBoxUsuario.Text       = UserEntity.UserName.ToString();
                        textBoxPassword.Text      = UserEntity.Password.ToString();
                        comboBoxRol.SelectedValue = UserEntity.Rol.ToString();
                        PathFileNameTextBox.Text  = UserEntity.Image.ToString();
                        IdUser = Convert.ToInt32(UserEntity.Id.ToString());
                        if (!string.IsNullOrEmpty(UserEntity.Image.ToString()))
                        {
                            String FilePath = string.Format("{0}\\{1}", System.IO.Path.GetFullPath(DirectoryFiles), UserEntity.Image.ToString());
                            PathFileImageOld = FilePath;
                            if (System.IO.File.Exists(FilePath))
                            {
                                pictureBoxImage.BackgroundImage = new Bitmap(FilePath);
                            }
                            else
                            {
                                throw new Exception("No se encontró la imagen");
                            }
                        }
                    }
                    if (DaysOfWorkEmployeeBLL.GetAllEntitys(id).Rows.Count > 0)
                    {
                        int loop;
                        foreach (DataRow DaysWorkRow in DaysOfWorkEmployeeBLL.GetAllEntitys(id).Rows)
                        {
                            loop = 0;
                            foreach (object item in checkedListBoxDias.Items)
                            {
                                if (DaysWorkRow[DaysOfWorkEmployeeML.DataBase.IdDays].ToString() == item.GetType().GetProperty("Value").GetValue(item, null).ToString())
                                {
                                    checkedListBoxDias.SetItemChecked(loop, true);
                                    break;
                                }

                                loop++;
                            }
                        }
                    }


                    if (TurnsOfEmployeeBLL.GetAllEntitys(id).Rows.Count > 0)
                    {
                        int loopTurn;
                        foreach (DataRow TurnsOfEmployees in TurnsOfEmployeeBLL.GetAllEntitys(id).Rows)
                        {
                            loopTurn = 0;
                            foreach (object item in checkedListBoxTurns.Items)
                            {
                                if (TurnsOfEmployees[TurnsOfEmployeeML.DataBase.IdTurn].ToString() == item.GetType().GetProperty("Value").GetValue(item, null).ToString())
                                {
                                    checkedListBoxTurns.SetItemChecked(loopTurn, true);
                                    break;
                                }

                                loopTurn++;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("buttonGuardar_Click: {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #10
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);
            }
        }
Example #11
0
        public DataTable ReportHoursJob(DateTime DateStart, DateTime DateEnd, int IdTurn = 0, int IdDepartament = 0, int IdEmployee = 0)
        {
            try
            {
                DataTable   HoursExtras = ReportsDAL.ReportExtras(DateStart, DateEnd, IdTurn, IdDepartament, IdEmployee);
                TurnBLL     TurnBLL     = new TurnBLL();
                EmployeeBLL EmployeeBLL = new EmployeeBLL();
                TimeSpan    ExtraEntrada;
                TimeSpan    ExtraSalida;
                TimeSpan    RetardoEntrada;
                TimeSpan    SalidaAntes;
                TimeSpan    HrsJornadas;
                TimeSpan    HrsExtras;
                TimeSpan    TotalHrsDia;
                String      TotalHrs;

                HoursExtras.Columns.Add("HORASJORNADA", typeof(TimeSpan));
                HoursExtras.Columns.Add("HORASEXTRAS", typeof(TimeSpan));
                HoursExtras.Columns.Add("TOTAL_HRS", typeof(TimeSpan));
                HoursExtras.Columns.Add("SUELDO_TOTAL", typeof(Decimal));

                foreach (DataRow Horas in HoursExtras.Rows)
                {
                    TimeSpan HoraEntrada = TimeSpan.Parse(Convert.ToDateTime(Horas["ENTRADA"].ToString()).ToString("HH:mm:ss"));
                    TimeSpan HoraSalida  = TimeSpan.Parse(Convert.ToDateTime(Horas["SALIDA"].ToString()).ToString("HH:mm:ss"));
                    //int IdEmployee = Int32.Parse(Horas["CVE"].ToString());

                    ExtraEntrada   = TimeSpan.Parse("00:00:00");
                    ExtraSalida    = TimeSpan.Parse("00:00:00");
                    RetardoEntrada = TimeSpan.Parse("00:00:00");
                    SalidaAntes    = TimeSpan.Parse("00:00:00");
                    //horasxDias = TimeSpan.Parse("00:00:00");

                    EmployeeML SalaryEmployeeML = EmployeeBLL.GetColumnsEmployee(Int32.Parse(Horas["CVE"].ToString()));

                    Decimal Salario    = Decimal.Parse(SalaryEmployeeML.Salary.ToString());
                    Decimal horasxDias = Decimal.Parse(SalaryEmployeeML.HoursDay.ToString());

                    if (Horas["TURNO"].ToString() != "HRS EXTRA")
                    {
                        TurnML TurnMLEmployee = TurnBLL.GetTurnForNaMe(Horas["TURNO"].ToString());

                        TimeSpan HoraInicial   = TimeSpan.Parse(Convert.ToDateTime(TurnMLEmployee.StartEntry.ToString()).ToString("HH:mm:ss"));
                        TimeSpan LimiteSalida  = TimeSpan.Parse(Convert.ToDateTime(TurnMLEmployee.LimitDeparture.ToString()).ToString("HH:mm:ss"));
                        TimeSpan LimiteEntrada = TimeSpan.Parse(Convert.ToDateTime(TurnMLEmployee.LimitEntry.ToString()).ToString("HH:mm:ss"));
                        TimeSpan Salida        = TimeSpan.Parse(Convert.ToDateTime(TurnMLEmployee.Departuretime.ToString()).ToString("HH:mm:ss"));
                        TimeSpan HorasJornada  = TimeSpan.Parse(Convert.ToDateTime(TurnMLEmployee.HoursJornada.ToString()).ToString("HH:mm:ss"));

                        //HORAS EXTRAS
                        if (HoraEntrada < HoraInicial)
                        {
                            ExtraEntrada = HoraInicial.Subtract(HoraEntrada);
                        }

                        if (HoraSalida > LimiteSalida)
                        {
                            ExtraSalida = HoraSalida.Subtract(LimiteSalida);
                        }

                        //HORAS JORNADA NORMAL
                        if (HoraEntrada != TimeSpan.Parse("00:00:00") && HoraSalida != TimeSpan.Parse("00:00:00"))
                        {
                            Horas["HORASJORNADA"] = HorasJornada;
                            HrsJornadas           = HorasJornada;
                        }
                        else
                        {
                            Horas["HORASJORNADA"] = TimeSpan.Parse("00:00:00");
                            HrsJornadas           = TimeSpan.Parse("00:00:00");
                        }
                        Horas["HORASEXTRAS"] = SumToTime(ExtraEntrada, ExtraSalida);
                        HrsExtras            = SumToTime(ExtraEntrada, ExtraSalida);
                    }
                    else
                    {
                        Horas["HORASJORNADA"] = TimeSpan.Parse("00:00:00");
                        Horas["HORASEXTRAS"]  = HoraSalida.Subtract(HoraEntrada);
                        HrsJornadas           = TimeSpan.Parse("00:00:00");
                        HrsExtras             = HoraSalida.Subtract(HoraEntrada);;
                    }

                    Horas["TOTAL_HRS"] = SumToTime(HrsJornadas, HrsExtras);
                    TotalHrsDia        = SumToTime(HrsJornadas, HrsExtras);
                    TotalHrs           = Convert.ToDecimal(Convert.ToDecimal(TotalHrsDia.Hours) + (Convert.ToDecimal(TotalHrsDia.Minutes))).ToString("#.00");

                    if (horasxDias > 0)
                    {
                        Horas["SUELDO_TOTAL"] = (Salario / 15 / horasxDias) * Convert.ToDecimal(TotalHrs);
                    }
                    else
                    {
                        Horas["SUELDO_TOTAL"] = 0;
                    }
                }

                return(HoursExtras);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("ReportHoursJob: {0}", ex.Message));
            }
        }