Ejemplo n.º 1
0
        private void cmbPeriodos_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                int sec = 0;

                ro_periodo_x_ro_Nomina_TipoLiqui_Info info_pe = new ro_periodo_x_ro_Nomina_TipoLiqui_Info();

                info_pe       = (ro_periodo_x_ro_Nomina_TipoLiqui_Info)cmbPeriodos.Properties.View.GetFocusedRow();
                listaempleado = bus_empleado.Get_listaEventuales_con_marcaciones(param.IdEmpresa, Convert.ToInt32(cmbnomina.EditValue), info_pe.pe_FechaIni, info_pe.pe_FechaFin);


                // lista_planificacion =new BindingList<ro_empleado_x_cargo_fuerza_grupo_Info>( Bus_planificacion.get_lista_planificacion(param.IdEmpresa,Convert.ToInt32( cmbnomina.EditValue),Convert.ToInt32( cmbPeriodos.EditValue)));
                if (lista_planificacion.Count() == 0)
                {
                    foreach (var item in listaempleado)
                    {
                        sec++;
                        ro_empleado_x_cargo_fuerza_grupo_Info info = new ro_empleado_x_cargo_fuerza_grupo_Info();
                        info.IdEmpleado = param.IdEmpresa;
                        info.IdNomina   = Convert.ToInt32(cmbnomina.EditValue);
                        info.IdEmpleado = item.IdEmpleado;
                        info.IdCargo    = item.IdCargo;
                        if (item.IdGrupo != null)
                        {
                            info.IdGrupo = Convert.ToInt32(item.IdGrupo);
                        }
                        if (sec % 2 == 0)
                        {
                            info.IdFuerza = 1;
                        }
                        else
                        {
                            info.IdFuerza = 2;
                        }
                        lista_planificacion.Add(info);
                    }
                }
                else
                {
                    lista_planificacion = new BindingList <ro_empleado_x_cargo_fuerza_grupo_Info>(Bus_planificacion.get_lista_planificacion(param.IdEmpresa, Convert.ToInt32(cmbnomina.EditValue), Convert.ToInt32(cmbPeriodos.EditValue)));
                }

                gridControl_planificacion.DataSource = lista_planificacion;
                cmb_empleado.ValueMember             = "IdEmpleado";
                cmb_empleado.DisplayMember           = "NombreCompleto";
                cmb_empleado.DataSource = listaempleado;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void Procesar()
        {
            cmbnomina.Focus();
            splashScreenManagereEspera.ShowWaitForm();
            try{
                cmbnomina.Focus();
                string msg = "";
                bus_rol = new ro_Rol_Bus(inforolEventuales, info_periodo_mensual_eventuales);
                foreach (var item in lista.Where(v => v.check == true))
                {
                    // Actualizando planificacion de ventuales
                    ro_empleado_x_cargo_fuerza_grupo_Info info_ev = new ro_empleado_x_cargo_fuerza_grupo_Info();
                    info_ev.IdEmpresa  = param.IdEmpresa;
                    info_ev.IdNomina   = 2;
                    info_ev.IdEmpleado = item.idempleado;
                    info_ev.IdPeriodo  = Convert.ToInt32(cmbPeriodos.EditValue);
                    info_ev.IdCargo    = Convert.ToInt32(item.IdCargo);
                    if (item.IdCargo == 41)
                    {
                        info_ev.IdGrupo = 5;
                    }
                    else
                    {
                        info_ev.IdGrupo = 2;
                    }
                    if (item.IdFuerza != null)
                    {
                        info_ev.IdFuerza = Convert.ToInt32(item.IdFuerza);
                    }
                    bus_planificacionEventual.GrabarBD(info_ev, ref msg);


                    // Proesando la nomina
                    //InfoEmpleado=   bus_empleado.Get_List_Empleado_x_Nomina_Liquidar_Eventuales_Ajuste_MO_Cliente(param.IdEmpresa, info_ev.IdNomina, info_ev.IdPeriodo, info_periodo_mensual_eventuales.pe_FechaIni, info_periodo_mensual_eventuales.pe_FechaFin,Convert.ToInt32( info_ev.IdEmpleado));

                    bus_rol.procesar(param.IdEmpresa, 2, 5, info_Perioso_x_nominaMensual.IdPeriodo, item.idempleado, "spRo_nomina_liquidacion_cliente", "", param.IdUsuario);

                    //inforolEventuales = bus_rol.GetInfoConsultaPorRol(param.IdEmpresa, 2, 5, info_Perioso_x_nominaMensual.IdPeriodo, ref msg);
                }

                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Se_guardaron_los_datos_correctamente), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                Generar_Excell();

                splashScreenManagereEspera.CloseWaitForm();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                splashScreenManagereEspera.CloseWaitForm();
            }
        }
 public Boolean GrabarBD(ro_empleado_x_cargo_fuerza_grupo_Info info, ref string msg)
 {
     try
     {
         return(data.GrabarBD(info, ref msg));
     }
     catch (Exception ex)
     {
         mensaje = ex.ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(mensaje);
     }
 }
Ejemplo n.º 4
0
        public List <ro_empleado_x_cargo_fuerza_grupo_Info> get_lista_planificacion(int IdEmpresa, int idnomina_tipo, int IdPeriodo)
        {
            try
            {
                List <ro_empleado_x_cargo_fuerza_grupo_Info> lista = new List <ro_empleado_x_cargo_fuerza_grupo_Info>();

                int idperio = 0;

                using (EntityRoles_FJ Context = new EntityRoles_FJ())
                {
                    var sel = (from s in Context.ro_planificacion_x_ruta_x_empleado
                               where s.IdEmpresa == IdEmpresa &&
                               s.IdNomina_Tipo == idnomina_tipo
                               select s.IdPeriodo);
                    if (sel.Count() > 0)
                    {
                        idperio = sel.Max();
                    }
                }


                using (EntityRoles_FJ Context = new EntityRoles_FJ())
                {
                    IQueryable <ro_empleado_x_cargo_fuerza_grupo> contact;

                    if (idperio > 0)
                    {
                        contact = from q in Context.ro_empleado_x_cargo_fuerza_grupo
                                  where q.IdEmpresa == IdEmpresa &&
                                  q.IdNomina == idnomina_tipo &&
                                  q.IdPeriodo == idperio
                                  select q;
                    }

                    else
                    {
                        contact = from q in Context.ro_empleado_x_cargo_fuerza_grupo
                                  where q.IdEmpresa == IdEmpresa &&
                                  q.IdNomina == idnomina_tipo
                                  select q;
                    }


                    foreach (var item in contact)
                    {
                        ro_empleado_x_cargo_fuerza_grupo_Info Info = new ro_empleado_x_cargo_fuerza_grupo_Info();
                        Info.IdEmpresa   = Convert.ToInt32(item.IdEmpresa);
                        Info.IdNomina    = Convert.ToInt32(item.IdNomina);
                        Info.IdEmpleado  = Convert.ToInt32(item.IdEmpleado);
                        Info.IdPeriodo   = item.IdPeriodo;
                        Info.IdFuerza    = item.IdFuerza;
                        Info.IdGrupo     = item.IdGrupo;
                        Info.IdCargo     = item.IdCargo;
                        Info.Observacion = item.Observacion;

                        lista.Add(Info);
                    }
                }
                return(lista);
            }
            catch (Exception ex)
            {
                string array = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Ejemplo n.º 5
0
        public Boolean GrabarBD(ro_empleado_x_cargo_fuerza_grupo_Info info, ref string msg)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var contact = (from a in db.ro_empleado_x_cargo_fuerza_grupo
                                   where a.IdEmpresa == info.IdEmpresa &&
                                   a.IdNomina == info.IdNomina &&
                                   a.IdEmpleado == info.IdEmpleado &&
                                   a.IdPeriodo == info.IdPeriodo
                                   select a).FirstOrDefault();
                    if (contact != null)
                    {
                        contact.IdFuerza    = info.IdFuerza;
                        contact.IdGrupo     = info.IdGrupo;
                        contact.IdCargo     = info.IdCargo;
                        contact.Observacion = info.Observacion;
                        db.SaveChanges();
                    }

                    else
                    {
                        ro_empleado_x_cargo_fuerza_grupo add = new ro_empleado_x_cargo_fuerza_grupo();


                        add.IdEmpresa   = info.IdEmpresa;
                        add.IdNomina    = info.IdNomina;
                        add.IdEmpleado  = info.IdEmpleado;
                        add.IdPeriodo   = info.IdPeriodo;
                        add.IdFuerza    = info.IdFuerza;
                        add.IdGrupo     = info.IdGrupo;
                        add.IdCargo     = info.IdCargo;
                        add.Observacion = info.Observacion;
                        db.ro_empleado_x_cargo_fuerza_grupo.Add(add);
                        db.SaveChanges();
                    }


                    // actualizando empleado

                    /*
                     * var empleado = (from a in db.ro_empleado_x_cargo_fuerza_grupo
                     *             where a.IdEmpresa == info.IdEmpresa
                     *             && a.IdEmpleado == info.IdEmpleado
                     *             select a).FirstOrDefault();
                     * if (empleado != null)
                     * {
                     *  empleado.IdGrupo = info.IdGrupo;
                     *  empleado.IdCargo = info.IdCargo;
                     *
                     *  db.SaveChanges();
                     * }
                     */
                }
                return(true);
            }
            catch (Exception ex)
            {
                string array = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }