Exemplo n.º 1
0
        public bool Modificar_DB(ro_fectividad_Entrega_x_Periodo_Empleado_Info info)
        {
            bool    ba            = false;
            int     idefectividad = 0;
            decimal id_nov        = 0;

            try
            {
                if (data.Modificar_DB(info))
                {
                    foreach (var item in info.lista)
                    {
                        item.IdEmpresa     = info.IdEmpresa;
                        item.IdNomina_Tipo = info.IdNomina_Tipo;
                        item.IdEfectividad = info.IdEfectividad;
                        item.IdEfectividad = idefectividad;
                        item.IdPeriodo     = info.IdPeriodo;
                    }



                    if (data_detalle.Modificar_DB(info.lista))
                    {
                        foreach (var item in Get_Novedades(info.lista))
                        {
                            info_detalle = novedad_detalle_bus.get_si_existe_novedad(item.IdEmpresa, item.IdEmpleado, item.IdRubro, item.IdCalendario);
                            if (info_detalle != null)
                            {
                                item.IdNovedad = info_detalle.IdNovedad;
                                ba             = bus_novedad.ModificarDB(item);
                            }
                            else
                            {
                                ba = bus_novedad.GrabarDB(item, ref id_nov);
                            }
                        }
                    }
                }

                return(ba);
            }
            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);
            }
        }
        public bool Modificar_DB(ro_fectividad_Entrega_x_Periodo_Empleado_Info info)
        {
            bool    ba     = false;
            decimal id_nov = 0;

            try
            {
                if (data.Modificar_DB(info))
                {
                    var ro_fectividad_Entrega_tipoServicio_info = ro_fectividad_Entrega_tipoServicio_Data.Get_Info(info.IdEmpresa, (int)info.IdServicioTipo);
                    if (ro_fectividad_Entrega_tipoServicio_info.Genera_novedad == true)
                    {
                        foreach (var item in Get_Novedades(info.lista, Convert.ToInt32(info.IdServicioTipo)))
                        {
                            info_detalle = novedad_detalle_bus.get_si_existe_novedad(item.IdEmpresa, item.IdEmpleado, item.IdRubro, item.IdCalendario);
                            if (info_detalle != null)
                            {
                                item.IdNovedad = info_detalle.IdNovedad;
                                ba             = bus_novedad.ModificarDB(item);
                            }
                            else
                            {
                                ba = bus_novedad.GrabarDB(item, ref id_nov);
                            }
                        }
                    }
                }

                return(ba);
            }
            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);
            }
        }
        public bool Modificar_DB(ro_fectividad_x_empleado_Adm_x_periodo_Info info)
        {
            bool    bandera = false;
            decimal id_nov  = 0;

            try
            {
                if (data.Modificar_DB(info))
                {
                    if (Bus_Detalle.Modificar_DB(info.detalle))
                    {
                        foreach (var item in Get_Novedades(info.detalle))
                        {
                            info_detalle = bus_detalle_novedad.get_si_existe_novedad(item.IdEmpresa, item.IdEmpleado, item.IdRubro, item.IdCalendario);
                            if (info_detalle != null)
                            {
                                item.IdNovedad = info_detalle.IdNovedad;
                                bandera        = bus_novedad.ModificarDB(item);
                            }
                            else
                            {
                                bandera = bus_novedad.GrabarDB(item, ref id_nov);
                            }
                        }
                    }
                }

                return(bandera);
            }
            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);
            }
        }