public Boolean ModificarDB(List <fa_devol_venta_det_Info> Lista, fa_devol_venta_Info info)
        {
            try
            {
                List <fa_devol_venta_det_Info> listaAux = new List <fa_devol_venta_det_Info>();
                listaAux = Get_List_devol_venta_det(info.IdEmpresa, info.IdSucursal, info.IdBodega, info.IdDevolucion);

                using (EntitiesFacturacion context = new EntitiesFacturacion())
                {
                    foreach (var item in listaAux)
                    {
                        var contact = context.fa_devol_venta_det.FirstOrDefault(cot => cot.IdEmpresa == info.IdEmpresa && cot.IdDevolucion == info.IdDevolucion && cot.IdSucursal == info.IdSucursal && cot.IdBodega == info.IdBodega);
                        if (contact != null)
                        {
                            context.fa_devol_venta_det.Remove(contact);
                            context.SaveChanges();
                        }
                    }

                    foreach (var item in Lista)
                    {
                        var address = new fa_devol_venta_det();
                        address.IdEmpresa      = item.IdEmpresa;
                        address.IdSucursal     = item.IdSucursal;
                        address.IdBodega       = item.IdBodega;
                        address.IdDevolucion   = info.IdDevolucion;
                        address.Secuencia      = item.Secuencia;
                        address.IdProducto     = item.IdProducto;
                        address.dv_cantidad    = item.dv_cantidad;
                        address.dv_valor       = item.dv_valor;
                        address.dv_PorDescUni  = item.dv_PorDescUni;
                        address.dv_descUni     = item.dv_descUni;
                        address.dv_PrecioFinal = item.dv_PrecioFinal;
                        address.dv_subtotal    = item.dv_subtotal;
                        address.dv_iva         = item.dv_iva;
                        address.dv_total       = item.dv_total;
                        address.dv_costo       = item.dv_costo;
                        context.fa_devol_venta_det.Add(address);
                        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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 2
0
        public Boolean ModificarDB(List <fa_guia_remision_det_Info> listDetalle_Guia_Info)
        {
            try
            {
                foreach (var item in listDetalle_Guia_Info)
                {
                    using (EntitiesFacturacion Context = new EntitiesFacturacion())
                    {
                        if (item.Secuencia != 0)
                        {
                            var Contact = Context.fa_guia_remision_det.FirstOrDefault(var => var.IdEmpresa == item.IdEmpresa && var.IdSucursal == item.IdSucursal && var.IdBodega == item.IdBodega && var.IdGuiaRemision == item.IdGuiaRemision && var.IdProducto == item.IdProducto && var.Secuencia == item.Secuencia);
                            if (Contact != null)
                            {
                                Contact.gi_cantidad = item.gi_cantidad;

                                Contact.gi_detallexItems = item.gi_detallexItems;


                                Context.SaveChanges();
                                Context.Dispose();
                            }
                        }
                        else
                        {
                            item.Secuencia = listDetalle_Guia_Info.Where(var => var.IdEmpresa == item.IdEmpresa && var.IdGuiaRemision == item.IdGuiaRemision && var.IdBodega == item.IdBodega && var.IdSucursal == item.IdSucursal).Count();
                            var Address = new fa_guia_remision_det();
                            Address.IdEmpresa      = item.IdEmpresa;
                            Address.IdSucursal     = item.IdSucursal;
                            Address.IdBodega       = item.IdBodega;
                            Address.IdGuiaRemision = item.IdGuiaRemision;
                            Address.Secuencia      = item.Secuencia;
                            Address.IdProducto     = item.IdProducto;
                            Address.gi_cantidad    = item.gi_cantidad;

                            Address.gi_detallexItems = (item.gi_detallexItems == null) ? "" : item.gi_detallexItems;

                            Context.fa_guia_remision_det.Add(Address);
                            Context.SaveChanges();
                            Context.Dispose();
                        }
                    }
                }
                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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 3
0
        public Boolean GuardarDB(fa_catalogo_Info Info, ref string IdCatalogo, ref string msjError)
        {
            try
            {
                using (EntitiesFacturacion Context = new EntitiesFacturacion())
                {
                    var Address = new fa_catalogo();
                    Address.IdCatalogo      = IdCatalogo = GetId();
                    Address.IdCatalogo_tipo = Info.IdCatalogo_tipo;
                    Address.Nombre          = Info.Nombre;
                    Address.Estado          = Info.Estado;
                    Address.Orden           = Info.Orden;

                    Address.IdUsuario = Info.IdUsuario;
                    Address.nom_pc    = Info.nom_pc;
                    Address.ip        = Info.ip;

                    Context.fa_catalogo.Add(Address);
                    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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                msjError = mensaje;
                throw new Exception(ex.ToString());
            }
        }
 public Boolean EliminarFacxCot(fa_factura_x_fa_cotizacion_info info)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_factura_x_fa_cotizacion.FirstOrDefault
                               (cot => cot.fa_IdEmpresa == info.fa_IdEmpresa && cot.fa_IdCbteVta == info.fa_IdCbteVta && cot.fa_IdSucursal == info.fa_IdSucursal && cot.fa_IdBodega == info.fa_IdBodega && cot.cc_IdCotizacion == info.cc_IdCotizacion);
             if (contact != null)
             {
                 context.fa_factura_x_fa_cotizacion.Remove(contact);
                 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());
     }
 }
        public Boolean ModificarDB(fa_venta_telefonica_det_Info Info)
        {
            try
            {
                EntitiesFacturacion context = new EntitiesFacturacion();

                var address = context.fa_venta_telefonica_det.FirstOrDefault(var => var.IdEmpresa == Info.IdEmpresa &&
                                                                             var.IdVenta_tel == Info.IdVenta_tel &&
                                                                             var.IdSucursal == Info.IdSucursal);
                if (address != null)
                {
                    address.IdEmpresa   = Info.IdEmpresa;
                    address.IdVenta_tel = Info.IdVenta_tel;
                    address.IdSucursal  = Info.IdSucursal;
                    address.Secuencia   = Convert.ToInt32(Info.Secuencia);
                    address.IdProducto  = Info.IdProducto;
                    address.Observacion = Info.Observacion;
                    address.Cantidad    = Convert.ToDouble(Info.Cantidad);
                    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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 6
0
 public Boolean ModificarDB(fa_TipoNota_Info info, ref string msg)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_TipoNota.FirstOrDefault(obj => obj.IdTipoNota == info.IdTipoNota);
             if (contact != null)
             {
                 contact.IdTipoNota      = info.IdTipoNota;
                 contact.CodTipoNota     = info.CodTipoNota;
                 contact.Tipo            = info.Tipo;
                 contact.No_Descripcion  = info.no_Descripcion;
                 contact.Nemonico        = info.Nemonico;
                 contact.InternoSis      = info.InternoSis;
                 contact.SeDeclaraSRI    = info.SeDeclaraSRI;
                 contact.Estado          = info.Estado;
                 contact.IdUsuarioUltMod = info.IdUsuarioUltMod;
                 contact.Fecha_UltMod    = info.Fecha_UltMod;
                 context.SaveChanges();
                 msg = "Se ha procedido actualizar el registro del Tipo de Nota #: " + info.IdTipoNota.ToString() + " exitosamente";
             }
         }
         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);
         msg = ex.ToString();
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         throw new Exception(ex.ToString());
     }
 }
Esempio n. 7
0
        public Boolean ModificarDB(fa_devol_venta_Info info, ref string msgs)
        {
            try
            {
                using (EntitiesFacturacion context = new EntitiesFacturacion())
                {
                    var contact = context.fa_devol_venta.FirstOrDefault(cot => cot.IdEmpresa == info.IdEmpresa && cot.IdDevolucion == info.IdDevolucion && cot.IdSucursal == info.IdSucursal && cot.IdBodega == info.IdBodega);
                    if (contact != null)
                    {
                        contact.mvInv_IdEmpresa         = info.mvInv_IdEmpresa;
                        contact.mvInv_IdSucursal        = info.mvInv_IdSucursal;
                        contact.mvInv_IdBodega          = info.mvInv_IdBodega;
                        contact.mvInv_IdNumMovi         = info.mvInv_IdNumMovi;
                        contact.mvInv_IdMovi_inven_tipo = info.mvInv_IdMovi_inven_tipo;

                        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);
                msgs = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msgs);
                throw new Exception(ex.ToString());
            }
        }
        public Boolean Guardar(fa_factura_TerminoPago_Info _Info)
        {
            try
            {
                EntitiesFacturacion context = new EntitiesFacturacion();
                var address = new fa_factura_TerminoPago();

                address.IdTipoFormaPago = _Info.IdTipoFormaPago;
                address.Descripcion     = _Info.Descripcion;
                address.Dias_Vct        = _Info.Dias_Vct;
                address.Num_Coutas      = _Info.Num_Cuotas;

                context.AddTofa_factura_TerminoPago(address);
                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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(false);
            }
        }
Esempio n. 9
0
        public Boolean GuardarDB(List <fa_factura_det_info> Lista, ref decimal Id, ref string msg)
        {
            try
            {
                List <fa_factura_det_otros_campos_Info> List  = new List <fa_factura_det_otros_campos_Info>();
                fa_factura_det_otros_campos_Data        odata = new fa_factura_det_otros_campos_Data();

                using (EntitiesFacturacion Contex = new EntitiesFacturacion())
                {
                    int secuencia = 0;
                    foreach (var item in Lista)
                    {
                        if (item.IdProducto != 0)
                        {
                            var address = new fa_factura_det();
                            secuencia = secuencia + 1;

                            address.IdEmpresa          = item.IdEmpresa;
                            address.IdSucursal         = item.IdSucursal;
                            address.IdBodega           = item.IdBodega;
                            address.IdCbteVta          = Id;
                            address.Secuencia          = Convert.ToInt32(secuencia);
                            address.IdProducto         = item.IdProducto;
                            address.vt_cantidad        = item.vt_cantidad;
                            address.vt_Precio          = item.vt_Precio;
                            address.vt_PorDescUnitario = item.vt_PorDescUnitario;
                            address.vt_DescUnitario    = item.vt_DescUnitario;
                            address.vt_PrecioFinal     = item.vt_PrecioFinal;
                            address.vt_Subtotal        = item.vt_Subtotal;
                            address.vt_iva             = item.vt_iva;
                            address.vt_total           = item.vt_total;
                            address.vt_Peso            = item.vt_Peso;
                            address.vt_estado          = item.vt_estado;

                            address.vt_detallexItems               = item.vt_detallexItems == null ? "" : item.vt_detallexItems.ToString().Trim();
                            address.vt_por_iva                     = (item.vt_por_iva == null) ? 0 : Convert.ToDouble(item.vt_por_iva);
                            address.IdPunto_Cargo                  = item.IdPunto_cargo;
                            address.IdPunto_cargo_grupo            = item.IdPunto_cargo_grupo;
                            address.IdCod_Impuesto_Iva             = (item.IdCod_Impuesto_Iva == "") ? null : item.IdCod_Impuesto_Iva;
                            address.IdCod_Impuesto_Ice             = (item.IdCod_Impuesto_Ice == "") ? null : item.IdCod_Impuesto_Ice;
                            address.IdCentroCosto                  = item.IdCentroCosto;
                            address.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo;
                            Contex.fa_factura_det.Add(address);
                            Contex.SaveChanges();
                        }
                    }
                    odata.GuardarDB(List);
                }
                return(true);
            }
            catch (DbEntityValidationException 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 msg);
                msg = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 10
0
 public Boolean AnularDB(fa_notaCreDeb_Info oDeT)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_notaCreDeb.FirstOrDefault(minfo => minfo.IdEmpresa == oDeT.IdEmpresa && minfo.IdNota == oDeT.IdNota && minfo.IdSucursal == oDeT.IdSucursal && minfo.IdBodega == oDeT.IdBodega);
             if (contact != null)
             {
                 contact.MotiAnula       = oDeT.MotiAnula;
                 contact.Fecha_UltAnu    = oDeT.Fecha_UltAnu;
                 contact.IdUsuarioUltAnu = oDeT.IdUsuarioUltAnu;
                 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());
     }
 }
Esempio n. 11
0
 public Boolean EliminarDB(fa_pedido_det_Info info, ref string msg)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_pedido_det.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdPedido == info.IdPedido && obj.Secuencial == info.Secuencial);
             if (contact != null)
             {
                 context.fa_pedido_det.Remove(contact);
                 context.SaveChanges();
                 context.Dispose();
             }
         }
         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);
         msg = ex.ToString();
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
         throw new Exception(ex.ToString());
     }
 }
        public bool anular_detalle(List <fa_proforma_det_Info> lista)
        {
            try
            {
                using (EntitiesFacturacion Context = new EntitiesFacturacion())
                {
                    foreach (var item in lista)
                    {
                        fa_proforma_det Entity = Context.fa_proforma_det.Where(q => q.IdEmpresa == item.IdEmpresa && q.IdProforma == item.IdProforma && q.Secuencia == item.Secuencia).FirstOrDefault();
                        if (Entity != null)
                        {
                            Entity.anulado = true;
                            Context.SaveChanges();
                        }
                    }
                }

                return(false);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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());
            }
        }
        public bool anularDB(fa_proforma_Info info)
        {
            try
            {
                using (EntitiesFacturacion Context = new EntitiesFacturacion())
                {
                    fa_proforma Entity = Context.fa_proforma.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdSucursal == info.IdSucursal && q.IdProforma == info.IdProforma);
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.estado = false;
                    Entity.IdUsuario_anulacion = info.IdUsuario_anulacion;
                    Entity.fecha_anulacion     = info.fecha_anulacion;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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());
            }
        }
Esempio n. 14
0
        public Boolean AnularDB(fa_catalogo_Info Info, ref string msjError)
        {
            try
            {
                using (EntitiesFacturacion context = new EntitiesFacturacion())
                {
                    var contact = context.fa_catalogo.FirstOrDefault(var => var.IdCatalogo == Info.IdCatalogo && var.IdCatalogo_tipo == Info.IdCatalogo_tipo);

                    if (contact != null)
                    {
                        contact.Estado          = "I";
                        contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = Info.Fecha_UltAnu;
                        contact.MotiAnula       = Info.MotiAnula;
                        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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                msjError = mensaje;
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 15
0
 public bool ModificarDB(fa_catalogo_Info info, ref string msjError)
 {
     try
     {
         EntitiesFacturacion context = new EntitiesFacturacion();
         var contenido = context.fa_catalogo.FirstOrDefault(var => var.IdCatalogo == info.IdCatalogo);
         if (contenido != null)
         {
             contenido.Nombre          = info.Nombre;
             contenido.Orden           = info.Orden;
             contenido.IdUsuarioUltMod = info.IdUsuarioUltMod;
             contenido.FechaUltMod     = info.FechaUltMod;
             contenido.MotiAnula       = info.MotiAnula;
             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);
         mensaje = ex.ToString();
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         msjError = mensaje;
         throw new Exception(ex.ToString());
     }
 }
Esempio n. 16
0
        public Boolean GuardarDB(fa_TerminoPago_Info _Info)
        {
            try
            {
                EntitiesFacturacion context = new EntitiesFacturacion();
                var address = new fa_TerminoPago();

                address.IdTerminoPago   = _Info.IdTerminoPago;
                address.nom_TerminoPago = _Info.nom_TerminoPago;
                address.Dias_Vct        = _Info.Dias_Vct;
                address.Num_Coutas      = _Info.Num_Cuotas;

                context.fa_TerminoPago.Add(address);
                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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 17
0
        public bool guardarDB(List <fa_cuotas_x_doc_Info> Lista)
        {
            try
            {
                int secuencia = 1;
                using (EntitiesFacturacion Context = new EntitiesFacturacion())
                {
                    foreach (var item in Lista)
                    {
                        fa_cuotas_x_doc Entity = new fa_cuotas_x_doc
                        {
                            IdEmpresa        = item.IdEmpresa,
                            IdSucursal       = item.IdSucursal,
                            IdBodega         = item.IdBodega,
                            IdCbteVta        = item.IdCbteVta,
                            secuencia        = item.secuencia = secuencia++,
                            num_cuota        = item.num_cuota,
                            fecha_vcto_cuota = item.fecha_vcto_cuota,
                            valor_a_cobrar   = item.valor_a_cobrar,
                            Estado           = item.Estado,
                        };
                        Context.fa_cuotas_x_doc.Add(Entity);
                    }
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 18
0
        public Boolean ModificarDB(fa_TerminoPago_Info _Info, ref string msjError)
        {
            try
            {
                EntitiesFacturacion context = new EntitiesFacturacion();
                var address = context.fa_TerminoPago.FirstOrDefault(var => var.IdTerminoPago == _Info.IdTerminoPago);
                if (address != null)
                {
                    address.nom_TerminoPago = _Info.nom_TerminoPago;
                    address.Dias_Vct        = _Info.Dias_Vct;
                    address.Num_Coutas      = _Info.Num_Cuotas;

                    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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                msjError = mensaje;
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 19
0
        public Boolean GuardarDB(fa_factura_x_in_Ing_Egr_Inven_Info info, ref string mensajeR)
        {
            try
            {
                using (EntitiesFacturacion Context = new EntitiesFacturacion())
                {
                    fa_factura_x_in_Ing_Egr_Inven address = new fa_factura_x_in_Ing_Egr_Inven();

                    address.IdEmpresa_fa                  = info.IdEmpresa_fa;
                    address.IdSucursal_fa                 = info.IdSucursal_fa;
                    address.IdBodega_fa                   = info.IdBodega_fa;
                    address.IdCbteVta_fa                  = info.IdCbteVta_fa;
                    address.IdEmpresa_in_eg_x_inv         = info.IdEmpresa_in_eg_x_inv;
                    address.IdSucursal_in_eg_x_inv        = info.IdSucursal_in_eg_x_inv;
                    address.IdMovi_inven_tipo_in_eg_x_inv = info.IdMovi_inven_tipo_in_eg_x_inv;
                    address.IdNumMovi_in_eg_x_inv         = info.IdNumMovi_in_eg_x_inv;
                    address.observacion                   = (info.observacion == null) ? "" : info.observacion;

                    Context.fa_factura_x_in_Ing_Egr_Inven.Add(address);
                    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);
                mensajeR = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensajeR);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 20
0
        public Boolean GuardarDB(fa_venta_telefonica_Info Info, ref decimal Id)
        {
            try
            {
                EntitiesFacturacion context = new EntitiesFacturacion();

                var address = new fa_venta_telefonica();

                address.IdEmpresa        = Info.IdEmpresa;
                address.IdSucursal       = Info.IdSucursal;
                address.IdVenta_tel      = Id = GetId(Info.IdEmpresa, Info.IdSucursal);
                address.IdCliente        = Info.IdCliente;
                address.IdMotivo         = Info.IdMotivo;
                address.Observacion      = Info.Observacion;
                address.Fecha            = Info.Fecha;
                address.Estado           = Info.Estado;
                address.Contactar_futuro = Info.Contactar_futuro;
                address.IdUsuario        = Info.IdUsuario;
                address.Fecha_Transac    = Convert.ToDateTime(Info.Fecha_Transac);
                address.ip     = Info.ip;
                address.nom_pc = Info.nom_pc;
                context.fa_venta_telefonica.Add(address);
                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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 21
0
 public Boolean AnularBD(fa_descuento_Info Info, ref string mensaje)
 {
     try
     {
         bool resultado           = false;
         EntitiesFacturacion Base = new EntitiesFacturacion();
         var Descuento            = Base.fa_descuento.FirstOrDefault(a => a.IdEmpresa == Info.IdEmpresa && a.IdDescuento == Info.IdDescuento);
         if (Descuento != null)
         {
             Descuento.Estado          = false;
             Descuento.Fecha_UltAnu    = Info.Fecha_UltAnu;
             Descuento.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
             Descuento.MotiAnula       = Info.MotiAnula;
             Descuento.ip     = Info.ip;
             Descuento.nom_pc = Info.nom_pc;
             Base.SaveChanges();
             resultado = true;
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         string arreglo      = ToString();
         string MensajeError = string.Empty;
         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);
         MensajeError = ex.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         throw new Exception(ex.InnerException.ToString());
     }
 }
Esempio n. 22
0
        public Boolean AnularDB(fa_venta_telefonica_Info Info)
        {
            try
            {
                EntitiesFacturacion context = new EntitiesFacturacion();

                var address = context.fa_venta_telefonica.FirstOrDefault(var => var.IdEmpresa == Info.IdEmpresa &&
                                                                         var.IdVenta_tel == Info.IdVenta_tel &&
                                                                         var.IdSucursal == Info.IdSucursal);
                if (address != null)
                {
                    address.Estado          = Info.Estado;
                    address.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                    address.Fecha_UltAnu    = Info.Fecha_UltAnu;
                    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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 23
0
 public Boolean AnularDB(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdDevolucion, string Motivo)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_devol_venta.FirstOrDefault(cot => cot.IdEmpresa == IdEmpresa && cot.IdDevolucion == IdDevolucion && cot.IdSucursal == IdSucursal && cot.IdBodega == IdBodega);
             if (contact != null)
             {
                 contact.Estado          = "I";
                 contact.MotivoAnulacion = Motivo;
                 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);
         mensaje = ex.ToString();
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.ToString());
     }
 }
Esempio n. 24
0
 public Boolean ActualizarEstado(int IdEmpresa, fa_orden_Desp_Info oCot)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_orden_Desp.FirstOrDefault(minfo => minfo.IdEmpresa == IdEmpresa && minfo.IdOrdenDespacho == oCot.IdOrdenDespacho && minfo.IdBodega == oCot.IdBodega && minfo.IdSucursal == oCot.IdSucursal);
             if (contact != null)
             {
                 contact.MotivoAnu       = oCot.MotivoAnu;
                 contact.ip              = oCot.ip;
                 contact.nom_pc          = oCot.nom_pc;
                 contact.Fecha_UltAnu    = oCot.Fecha_UltAnu;
                 contact.IdUsuarioUltAnu = oCot.IdUsuarioUltAnu;
                 contact.Estado          = "I";
                 context.SaveChanges();
                 DataOrdenXpedido.EliminarDB(oCot);
             }
         }
         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);
         mensaje = ex.ToString();
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.ToString());
     }
 }
        public Boolean EliminarDB(fa_notaCreDeb_Info info)
        {
            try
            {
                List <fa_notaCreDeb_det_Info> ListaEliminar = new List <fa_notaCreDeb_det_Info>();
                ListaEliminar = Get_List_notaCreDeb_det(info);

                foreach (var item in ListaEliminar)
                {
                    using (EntitiesFacturacion context = new EntitiesFacturacion())
                    {
                        var contact = context.fa_notaCreDeb_det.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdNota == item.IdNota && obj.Secuencia == item.Secuencia);
                        if (contact != null)
                        {
                            context.fa_notaCreDeb_det.Remove(contact);
                            context.SaveChanges();
                            context.Dispose();
                        }
                    }
                }

                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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 26
0
 public Boolean GuardarDB(fa_cliente_contactos_Info Info, ref string mensaje)
 {
     try
     {
         EntitiesFacturacion conexion = new EntitiesFacturacion();
         {
             fa_cliente_contactos Base = new fa_cliente_contactos();
             Base.IdCliente      = Info.IdCliente;
             Base.IdEmpresa_cli  = Info.IdEmpresa_cli;
             Base.IdEmpresa_cont = Info.IdEmpresa_cont;
             Base.IdContacto     = Info.IdContacto;
             Base.observacion    = Info.observacion;
             conexion.fa_cliente_contactos.Add(Base);
             conexion.SaveChanges();
             mensaje = "Se ha grabado el Cliente: " + Info.IdCliente.ToString() + " exitosamente.";
         }
         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.InnerException + " " + ex.Message;
         throw new Exception(ex.InnerException.ToString());
     }
 }
        public Boolean GuardarFacxCot(fa_factura_x_fa_cotizacion_info info)
        {
            try
            {
                using (EntitiesFacturacion context = new EntitiesFacturacion())
                {
                    EntitiesFacturacion fact = new EntitiesFacturacion();


                    var addressG = new fa_factura_x_fa_cotizacion();
                    addressG.fa_IdEmpresa    = info.fa_IdEmpresa;
                    addressG.fa_IdSucursal   = info.fa_IdSucursal;
                    addressG.fa_IdBodega     = info.fa_IdBodega;
                    addressG.fa_IdCbteVta    = info.fa_IdCbteVta;
                    addressG.cc_IdEmpresa    = info.cc_IdEmpresa;
                    addressG.cc_IdSucursal   = info.cc_IdSucursal;
                    addressG.cc_IdBodega     = info.cc_IdBodega;
                    addressG.cc_IdCotizacion = info.cc_IdCotizacion;

                    context.fa_factura_x_fa_cotizacion.Add(addressG);
                    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());
            }
        }
        public Boolean GuardarDB(fa_notaCreDeb_x_ct_cbtecble_Info info)
        {
            try
            {
                using (EntitiesFacturacion context = new EntitiesFacturacion())
                {
                    var addressG = new fa_notaCreDeb_x_ct_cbtecble();
                    addressG.no_IdEmpresa  = info.no_IdEmpresa;
                    addressG.no_IdSucursal = info.no_IdSucursal;
                    addressG.no_IdBodega   = info.no_IdBodega;
                    addressG.no_IdNota     = info.no_IdNota;
                    addressG.ct_IdEmpresa  = info.ct_IdEmpresa;
                    addressG.ct_IdTipoCbte = info.ct_IdTipoCbte;
                    addressG.ct_IdCbteCble = info.ct_IdCbteCble;

                    context.fa_notaCreDeb_x_ct_cbtecble.Add(addressG);
                    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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 29
0
        public Boolean EliminarDB(fa_orden_Desp_Info info)
        {
            try
            {
                foreach (var item in info.ListaAuxiliar)
                {
                    using (EntitiesFacturacion context = new EntitiesFacturacion())
                    {
                        var contact = context.fa_orden_Desp_det_x_fa_pedido_det.FirstOrDefault(obj => obj.od_IdEmpresa == item.od_IdEmpresa && obj.od_IdSucursal == item.od_IdSucursal && obj.od_IdBodega == item.od_IdBodega && obj.od_IdOrdenDespacho == item.od_IdOrdenDespacho && obj.od_Secuencia == item.od_Secuencia && obj.od_IdProducto == item.od_IdProducto &&
                                                                                               obj.pe_IdEmpresa == item.pe_IdEmpresa && obj.pe_IdSucursal == item.pe_IdSucursal && obj.pe_IdBodega == item.pe_IdBodega && obj.pe_IdPedido == item.pe_IdPedido && obj.pe_Secuencia == item.pe_Secuencia && obj.pe_IdProducto == item.pe_IdProducto);
                        if (contact != null)
                        {
                            context.fa_orden_Desp_det_x_fa_pedido_det.Remove(contact);
                            context.SaveChanges();
                            context.Dispose();
                        }
                    }
                }

                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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 30
0
        public Boolean Imprimir(fa_guia_remision_Info info, ref string msg)
        {
            try
            {
                using (EntitiesFacturacion context = new EntitiesFacturacion())
                {
                    var contact = context.fa_guia_remision.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdGuiaRemision == info.IdGuiaRemision);
                    if (contact != null)
                    {
                        contact.CodDocumentoTipo   = info.CodDocumentoTipo;
                        contact.Serie1             = info.Serie1;
                        contact.Serie2             = info.Serie2;
                        contact.NUAutorizacion     = info.NumAutorizacion;
                        contact.NumGuia_Preimpresa = info.NumGuia_Preimpresa;
                        contact.Impreso            = "S";

                        context.SaveChanges();
                        msg = "Se ha procedido anular el registro del Cliente #: " + info.IdCliente.ToString() + " exitosamente";
                    }
                }
                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);
                msg = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }