public in_presentacion_Info get_info(int IdEmpresa, string IdPresentacion)
 {
     try
     {
         in_presentacion_Info info = new in_presentacion_Info();
         using (Entities_inventario Context = new Entities_inventario())
         {
             in_presentacion Entity = Context.in_presentacion.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdPresentacion == IdPresentacion);
             if (Entity == null)
             {
                 return(null);
             }
             info = new in_presentacion_Info
             {
                 IdEmpresa        = Entity.IdEmpresa,
                 IdPresentacion   = Entity.IdPresentacion,
                 nom_presentacion = Entity.nom_presentacion,
                 estado           = Entity.estado
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool anularDB(in_presentacion_Info info)
 {
     try
     {
         using (Entities_inventario Context = new Entities_inventario())
         {
             in_presentacion Entity = Context.in_presentacion.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdPresentacion == info.IdPresentacion);
             if (Entity == null)
             {
                 return(false);
             }
             Entity.estado = info.estado = "I";
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #3
0
        public Boolean GuardarDB(in_presentacion_Info info, ref string Mensaje)
        {
            try
            {
                using (EntitiesInventario oEnti = new EntitiesInventario())
                {
                    var Q = from per in oEnti.in_presentacion
                            where per.IdEmpresa == info.IdEmpresa &&
                            per.IdPresentacion == info.IdPresentacion
                            select per;

                    if (Q.ToList().Count == 0)
                    {
                        var registo = new in_presentacion();

                        registo.IdEmpresa        = info.IdEmpresa;
                        registo.IdPresentacion   = (info.IdPresentacion == "" || info.IdPresentacion == null) ? Convert.ToString(GetId(info.IdEmpresa)) : info.IdPresentacion;
                        registo.nom_presentacion = info.nom_presentacion.Trim();
                        registo.estado           = "A";


                        oEnti.in_presentacion.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());
            }
        }
 public bool guardarDB(in_presentacion_Info info)
 {
     try
     {
         using (Entities_inventario Context = new Entities_inventario())
         {
             in_presentacion Entity = new in_presentacion
             {
                 IdEmpresa        = info.IdEmpresa,
                 IdPresentacion   = info.IdPresentacion,
                 nom_presentacion = info.nom_presentacion,
                 estado           = info.estado = "A"
             };
             Context.in_presentacion.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }