Exemplo n.º 1
0
 public bool guardarDB(in_Catalogo_Info info)
 {
     try
     {
         using (Entities_inventario Context = new Entities_inventario())
         {
             in_Catalogo Entity = new in_Catalogo
             {
                 IdCatalogo_tipo = info.IdCatalogo_tipo,
                 IdCatalogo      = info.IdCatalogo,
                 Abrebiatura     = info.Abrebiatura,
                 Nombre          = info.Nombre,
                 Estado          = info.Estado = "A",
                 Orden           = info.Orden
             };
             Context.in_Catalogo.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
 public in_Catalogo_Info get_info(string IdCatalogo)
 {
     try
     {
         in_Catalogo_Info info = new in_Catalogo_Info();
         using (Entities_inventario Context = new Entities_inventario())
         {
             in_Catalogo Entity = Context.in_Catalogo.FirstOrDefault(q => q.IdCatalogo == IdCatalogo);
             if (Entity == null)
             {
                 return(null);
             }
             info = new in_Catalogo_Info
             {
                 IdCatalogo_tipo = Entity.IdCatalogo_tipo,
                 IdCatalogo      = Entity.IdCatalogo,
                 Abrebiatura     = Entity.Abrebiatura,
                 Nombre          = Entity.Nombre,
                 Estado          = Entity.Estado,
                 Orden           = Entity.Orden
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 3
0
        public Boolean GuardarDB(in_Catalogo_Info info, ref string Mensaje)
        {
            try
            {
                using (EntitiesInventario oEnti = new EntitiesInventario())
                {
                    var Q = (from per in oEnti.in_Catalogo
                             select per.Orden).Max() + 1;


                    if ((from per in oEnti.in_Catalogo where per.IdCatalogo == info.IdCatalogo select per).Count() != 0)
                    {
                        Mensaje = "El Codigo Ingresado Ya existe por favor ingrese uno distinto";
                        return(false);
                    }


                    var registo = new in_Catalogo();

                    registo.IdCatalogo      = info.IdCatalogo;
                    registo.IdCatalogo_tipo = info.IdCatalogo_tipo;
                    registo.Nombre          = info.Nombre;
                    registo.NombreIngles    = info.NombreIngles;
                    registo.Abrebiatura     = info.Abrebiatura;
                    registo.Orden           = Q;
                    registo.Estado          = "A";

                    oEnti.in_Catalogo.Add(registo);
                    oEnti.SaveChanges();
                    Mensaje = "Registro Ingresado Correctamente";
                }
                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() + " " + ex.Message;
                Mensaje = "Error al ingresar el registro ";
                throw new Exception(ex.ToString());
            }
        }
Exemplo n.º 4
0
        public bool anularDB(in_Catalogo_Info info)
        {
            try
            {
                using (Entities_inventario Context = new Entities_inventario())
                {
                    in_Catalogo Entity = Context.in_Catalogo.FirstOrDefault(q => q.IdCatalogo == info.IdCatalogo);
                    if (Entity == null)
                    {
                        return(false);
                    }

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

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 5
0
        public bool modificarDB(in_Catalogo_Info info)
        {
            try
            {
                using (Entities_inventario Context = new Entities_inventario())
                {
                    in_Catalogo Entity = Context.in_Catalogo.FirstOrDefault(q => q.IdCatalogo == info.IdCatalogo);
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Nombre      = info.Nombre;
                    Entity.Abrebiatura = info.Abrebiatura;

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }