Example #1
0
        public int GetId(int IdEmpresa)
        {
            try
            {
                int Id;
                EntitiesFacturacion ocxc = new EntitiesFacturacion();
                var select = (from q in ocxc.fa_cliente_tipo
                              where q.IdEmpresa == IdEmpresa
                              select q.Idtipo_cliente).Count();

                if (select == 0)
                {
                    Id = 1;
                }
                else
                {
                    var select_IdCXC = (from q in ocxc.fa_cliente_tipo
                                        where q.IdEmpresa == IdEmpresa
                                        select q.Idtipo_cliente).Max();
                    Id = Convert.ToInt32(select_IdCXC.ToString()) + 1;
                }
                return(Id);
            }
            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());
            }
        }
Example #2
0
        public List <fa_formaPago_Info> Get_List_fa_formaPago()
        {
            try
            {
                List <fa_formaPago_Info> Lst   = new List <fa_formaPago_Info>();
                EntitiesFacturacion      oEnti = new EntitiesFacturacion();
                var Query = from q in oEnti.fa_formaPago
                            select q;



                foreach (var item in Query)
                {
                    fa_formaPago_Info Obj = new fa_formaPago_Info();
                    Obj.IdFormaPago   = item.IdFormaPago;
                    Obj.nom_FormaPago = item.nom_FormaPago;


                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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());
            }
        }
Example #3
0
        public Boolean GuardarDB(List <fa_TerminoPago_Distribucion_Info> lst)
        {
            try
            {
                EntitiesFacturacion context = new EntitiesFacturacion();
                foreach (var item in lst)
                {
                    var address = new fa_TerminoPago_Distribucion();

                    address.IdTerminoPago    = item.IdTerminoPago;
                    address.Secuencia        = item.Secuencia;
                    address.Por_distribucion = item.Por_distribucion;
                    address.Num_Dias_Vcto    = item.Num_Dias_Vcto;
                    context.fa_TerminoPago_Distribucion.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());
            }
        }
Example #4
0
 public Boolean AnularDB(fa_cliente_tipo_Info Info, ref string msjError)
 {
     try
     {
         using (EntitiesFacturacion Context = new EntitiesFacturacion())
         {
             var contact = Context.fa_cliente_tipo.FirstOrDefault(af => af.IdEmpresa == Info.IdEmpresa && af.Idtipo_cliente == Info.Idtipo_cliente);
             if (contact != null)
             {
                 contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                 contact.Fecha_UltAnu    = Info.Fecha_UltAnu;
                 contact.MotivoAnula     = Info.MotivoAnula;
                 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();
         msjError = mensaje;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.ToString());
     }
 }
Example #5
0
        public List <fa_TerminoPago_Distribucion_Info> Get_List_TerminoPago_Distribucion(string IdTipoFormaPago)
        {
            try
            {
                List <fa_TerminoPago_Distribucion_Info> lst = new List <fa_TerminoPago_Distribucion_Info>();
                EntitiesFacturacion context = new EntitiesFacturacion();

                var select = from q in context.fa_TerminoPago_Distribucion
                             where q.IdTerminoPago == IdTipoFormaPago
                             select q;

                fa_TerminoPago_Distribucion_Info _Info;

                foreach (var item in select)
                {
                    _Info = new fa_TerminoPago_Distribucion_Info();
                    _Info.IdTerminoPago    = item.IdTerminoPago;
                    _Info.Secuencia        = item.Secuencia;
                    _Info.Por_distribucion = item.Por_distribucion;
                    _Info.Num_Dias_Vcto    = item.Num_Dias_Vcto;
                    lst.Add(_Info);
                }

                return(lst);
            }
            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());
            }
        }
Example #6
0
 public Boolean AnularDB(fa_cotizacion_info info, ref string mensajeE)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_cotizacion.FirstOrDefault(cot => cot.IdEmpresa == info.IdEmpresa && cot.IdCotizacion == info.IdCotizacion && cot.IdSucursal == info.IdSucursal && cot.IdBodega == info.IdBodega);
             if (contact != null)
             {
                 contact.cc_estado       = "I";
                 contact.Fecha_UltAnu    = DateTime.Now;
                 contact.MotivoAnu       = info.MotivoAnu;
                 contact.IdUsuarioUltAnu = info.IdUsuario;
                 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);
         mensajeE = ex.ToString();
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensajeE);
         throw new Exception(ex.ToString());
     }
 }
Example #7
0
 public Boolean ValidarCodCot(string CodCotizacion)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             EntitiesFacturacion factCot = new EntitiesFacturacion();
             var select = (from C in factCot.fa_cotizacion
                           where C.CodCotizacion == CodCotizacion
                           select C.CodCotizacion).Count();
             var id = (from C in factCot.fa_cotizacion
                       where C.CodCotizacion == CodCotizacion
                       select C.IdCotizacion).Max();
             //IdCotizacion = id;
             if (select == 0)
             {
                 return(false);
             }
             else
             {
                 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());
     }
 }
Example #8
0
 public Boolean ActualizarEstado(int IdEmpresa, fa_cotizacion_info oDeT)
 {
     try
     {
         using (EntitiesFacturacion context = new EntitiesFacturacion())
         {
             var contact = context.fa_cotizacion.FirstOrDefault(minfo => minfo.IdEmpresa == IdEmpresa && minfo.IdCotizacion == oDeT.IdCotizacion);
             if (contact != null)
             {
                 contact.MotivoAnu       = oDeT.MotivoAnu;
                 contact.ip              = oDeT.ip;
                 contact.nom_pc          = oDeT.nom_pc;
                 contact.Fecha_UltAnu    = oDeT.Fecha_UltAnu;
                 contact.IdUsuarioUltAnu = oDeT.IdUsuarioUltAnu;
                 contact.cc_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());
     }
 }
 public bool GuardarDB(fa_factura_det_x_fa_descuento_Info info)
 {
     try
     {
         using (EntitiesFacturacion Context = new EntitiesFacturacion())
         {
             fa_factura_det_x_fa_descuento Entity = new fa_factura_det_x_fa_descuento();
             Entity.IdEmpresa_fa  = info.IdEmpresa_fa;
             Entity.IdSucursal    = info.IdSucursal;
             Entity.IdBodega      = info.IdBodega;
             Entity.IdCbteVta     = info.IdCbteVta;
             Entity.Secuencia     = info.Secuencia;
             Entity.IdEmpresa_de  = info.IdEmpresa_de;
             Entity.IdDescuento   = info.IdDescuento;
             Entity.Secuencia_reg = info.Secuencia_reg;
             Entity.de_valor      = info.de_valor;
             Context.fa_factura_det_x_fa_descuento.Add(Entity);
             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);
         mensaje = ex.ToString();
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.ToString());
     }
 }