예제 #1
0
        public bool AnularDB(fa_liquidacion_gastos_Info Info, ref string mensaje)
        {
            try
            {
                using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ())
                {
                    fa_liquidacion_gastos contact = Context.fa_liquidacion_gastos.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdLiquidacion == Info.IdLiquidacion);
                    if (contact != null)
                    {
                        contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = Info.Fecha_UltAnu;
                        contact.MotivoAnulacion = Info.MotivoAnulacion;
                        contact.estado          = "I";

                        Context.SaveChanges();
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
예제 #2
0
        public bool GuardarDB(fa_liquidacion_gastos_Info Info, ref decimal IdLiquidacion, ref string mensaje)
        {
            try
            {
                IdLiquidacion = Get_Id(Info.IdEmpresa, ref mensaje);

                using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ())
                {
                    fa_liquidacion_gastos contact = new fa_liquidacion_gastos();

                    contact.IdEmpresa         = Info.IdEmpresa;
                    contact.IdLiquidacion     = Info.IdLiquidacion = IdLiquidacion;
                    contact.IdPeriodo         = Info.IdPeriodo;
                    contact.cod_liquidacion   = Info.cod_liquidacion;
                    contact.IdCliente         = Info.IdCliente;
                    contact.fecha_liqui       = Info.fecha_liqui;
                    contact.Observacion       = Info.Observacion;
                    contact.estado            = Info.estado;
                    contact.IdUsuario         = Info.IdUsuario;
                    contact.Fecha_Transaccion = Info.Fecha_Transaccion;
                    contact.nom_pc            = Info.nom_pc;
                    contact.ip = Info.ip;

                    Context.fa_liquidacion_gastos.Add(contact);
                    Context.SaveChanges();
                }

                foreach (var item in Info.Lis_Detalle)
                {
                    item.IdEmpresa     = Info.IdEmpresa;
                    item.IdLiquidacion = Info.IdLiquidacion;
                }

                oData_Det.GuardarDB(Info.Lis_Detalle, ref mensaje);

                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
예제 #3
0
        public bool ModificarDB(fa_liquidacion_gastos_Info Info, ref string mensaje)
        {
            try
            {
                using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ())
                {
                    fa_liquidacion_gastos contact = Context.fa_liquidacion_gastos.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdLiquidacion == Info.IdLiquidacion);
                    if (contact != null)
                    {
                        contact.IdEmpresa        = Info.IdEmpresa;
                        contact.IdLiquidacion    = Info.IdLiquidacion;
                        contact.IdPeriodo        = Info.IdPeriodo;
                        contact.cod_liquidacion  = Info.cod_liquidacion;
                        contact.IdCliente        = Info.IdCliente;
                        contact.fecha_liqui      = Info.fecha_liqui;
                        contact.Observacion      = Info.Observacion;
                        contact.estado           = "A";
                        contact.IdUsuarioUltModi = Info.IdUsuarioUltModi;
                        contact.Fecha_UltMod     = DateTime.Now;
                        contact.nom_pc           = Info.nom_pc;
                        contact.ip = Info.ip;
                        Context.SaveChanges();
                    }
                }

                oData_Det.EliminarDB(Info, ref mensaje);

                foreach (var item in Info.Lis_Detalle)
                {
                    item.IdEmpresa     = Info.IdEmpresa;
                    item.IdLiquidacion = Info.IdLiquidacion;
                }
                oData_Det.GuardarDB(Info.Lis_Detalle, ref mensaje);

                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }