Пример #1
0
        public bool anularDB(fa_TipoNota_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_TipoNota Entity = Context.fa_TipoNota.FirstOrDefault(q => q.IdTipoNota == info.IdTipoNota);
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Estado = info.Estado = "I";

                    Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                    Entity.Fecha_UltAnu    = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        public bool modificarDB(fa_TipoNota_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_TipoNota Entity = Context.fa_TipoNota.FirstOrDefault(q => q.IdTipoNota == info.IdTipoNota);
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.CodTipoNota     = info.CodTipoNota;
                    Entity.No_Descripcion  = info.No_Descripcion;
                    Entity.Tipo            = info.Tipo;
                    Entity.GeneraMoviInven = info.GeneraMoviInven;
                    Entity.IdCtaCble       = info.IdCtaCble;

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = DateTime.Now;

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        public bool guardarDB(fa_TipoNota_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_TipoNota Entity = new fa_TipoNota
                    {
                        IdEmpresa       = info.IdEmpresa,
                        IdTipoNota      = info.IdTipoNota = get_id(info.IdEmpresa),
                        CodTipoNota     = info.CodTipoNota,
                        No_Descripcion  = info.No_Descripcion,
                        Tipo            = info.Tipo,
                        Estado          = info.Estado = "A",
                        GeneraMoviInven = info.GeneraMoviInven,
                        IdCtaCble       = info.IdCtaCble,

                        IdUsuario     = info.IdUsuario,
                        Fecha_Transac = DateTime.Now
                    };
                    Context.fa_TipoNota.Add(Entity);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #4
0
 public fa_TipoNota_Info get_info(int IdEmpresa, int IdTipoNota)
 {
     try
     {
         fa_TipoNota_Info info = new fa_TipoNota_Info();
         using (Entities_facturacion Context = new Entities_facturacion())
         {
             fa_TipoNota Entity = Context.fa_TipoNota.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdTipoNota == IdTipoNota);
             if (Entity == null)
             {
                 return(null);
             }
             info = new fa_TipoNota_Info
             {
                 IdEmpresa       = Entity.IdEmpresa,
                 IdTipoNota      = Entity.IdTipoNota,
                 CodTipoNota     = Entity.CodTipoNota,
                 No_Descripcion  = Entity.No_Descripcion,
                 Tipo            = Entity.Tipo,
                 Estado          = Entity.Estado,
                 GeneraMoviInven = Entity.GeneraMoviInven,
                 IdCtaCble       = Entity.IdCtaCble
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #5
0
        public bool modificarDB(fa_TipoNota_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_TipoNota Entity = Context.fa_TipoNota.FirstOrDefault(q => q.IdTipoNota == info.IdTipoNota);
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.CodTipoNota     = info.CodTipoNota;
                    Entity.No_Descripcion  = info.No_Descripcion;
                    Entity.Tipo            = info.Tipo;
                    Entity.GeneraMoviInven = info.GeneraMoviInven;

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = DateTime.Now;

                    var lst = Context.fa_TipoNota_x_Empresa_x_Sucursal.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdTipoNota == info.IdTipoNota).ToList();
                    foreach (var item in lst)
                    {
                        Context.fa_TipoNota_x_Empresa_x_Sucursal.Remove(item);
                    }
                    foreach (var item in info.Lst_fa_TipoNota_x_Empresa_x_Sucursal)
                    {
                        fa_TipoNota_x_Empresa_x_Sucursal det = new fa_TipoNota_x_Empresa_x_Sucursal
                        {
                            IdEmpresa  = info.IdEmpresa,
                            IdSucursal = item.IdSucursal,
                            IdTipoNota = info.IdTipoNota,
                            IdCtaCble  = item.IdCtaCble
                        };
                        Context.fa_TipoNota_x_Empresa_x_Sucursal.Add(det);
                    }


                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception e)
            {
                throw;
            }
        }
Пример #6
0
        public Boolean GrabarDB(fa_TipoNota_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesFacturacion context = new EntitiesFacturacion())
                {
                    if (context.fa_TipoNota.Where <fa_TipoNota>(v => v.CodTipoNota == info.CodTipoNota).Count() != 0)
                    {
                        msg = "El codigo Ingresado ya existe por favor ingresar uno diferente";
                        return(false);
                    }


                    var address = new fa_TipoNota();
                    int idpv    = GetId(info.IdEmpresa);
                    id = idpv;
                    address.IdTipoNota     = idpv;
                    address.CodTipoNota    = (info.CodTipoNota == "") ? idpv.ToString() : info.CodTipoNota;
                    address.Tipo           = info.Tipo;
                    address.No_Descripcion = info.no_Descripcion;
                    address.Nemonico       = (info.Nemonico == "") ? idpv.ToString() : info.Nemonico;
                    address.InternoSis     = info.InternoSis;
                    address.SeDeclaraSRI   = info.SeDeclaraSRI;
                    address.IdUsuario      = info.IdUsuario;
                    address.Fecha_Transac  = info.Fecha_Transac;
                    address.nom_pc         = info.nom_pc;
                    address.ip             = info.ip;
                    address.Estado         = "A";
                    context.fa_TipoNota.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el registro del Tipo de Nota #: " + id.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());
            }
        }