예제 #1
0
        public Boolean GuardarDB(in_devolucion_inven_Info info, ref decimal IdDev_Inven, ref string mensaje)
        {
            try
            {
                using (EntitiesInventario Context = new EntitiesInventario())
                {
                    var Address = new in_devolucion_inven();

                    Address.IdEmpresa     = info.IdEmpresa;
                    Address.IdDev_Inven   = info.IdDev_Inven = IdDev_Inven = GetId(info.IdEmpresa);
                    Address.cod_Dev_Inven = (info.cod_Dev_Inven == "") ? IdDev_Inven.ToString() : info.cod_Dev_Inven;
                    Address.Fecha         = Convert.ToDateTime(info.Fecha.ToShortDateString());

                    Address.Devuelve_toda_tran = info.Devuelve_toda_tran;
                    Address.estado             = "A";


                    Address.IdSucursal_movi_inven = info.IdSucursal_movi_inven;
                    Address.IdMovi_inven_tipo     = info.IdMovi_inven_tipo;
                    Address.IdNumMovi             = info.IdNumMovi;
                    Address.observacion           = (info.observacion == "") ? "" : info.observacion;
                    Address.IdUsuario             = info.IdUsuario;
                    Address.Fecha_Transac         = info.Fecha_Transac;
                    Address.IdUsuarioUltModi      = info.IdUsuarioUltModi;
                    Address.Fecha_UltMod          = info.Fecha_UltMod;
                    Address.IdusuarioUltAnu       = info.IdusuarioUltAnu;
                    Address.Fecha_UltAnu          = info.Fecha_UltAnu;
                    Address.nom_pc = info.nom_pc;
                    Address.ip     = info.ip;

                    Context.in_devolucion_inven.Add(Address);
                    Context.SaveChanges();

                    mensaje = "Grabación ok..";
                }
                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;
                throw new Exception(ex.ToString());
            }
        }
        public in_devolucion_inven_Info get_info(int IdEmpresa, decimal IdDev_Inven)
        {
            try
            {
                in_devolucion_inven_Info info;

                using (Entities_inventario Context = new Entities_inventario())
                {
                    in_devolucion_inven Entity = Context.in_devolucion_inven.Where(q => q.IdEmpresa == IdEmpresa && q.IdDev_Inven == IdDev_Inven).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(null);
                    }
                    info = new in_devolucion_inven_Info
                    {
                        IdEmpresa             = Entity.IdEmpresa,
                        IdDev_Inven           = Entity.IdDev_Inven,
                        cod_Dev_Inven         = Entity.cod_Dev_Inven,
                        Fecha                 = Entity.Fecha,
                        IdEmpresa_inv         = Entity.IdEmpresa_inv,
                        IdSucursal_inv        = Entity.IdSucursal_inv,
                        IdMovi_inven_tipo_inv = Entity.IdMovi_inven_tipo_inv,
                        IdNumMovi_inv         = Entity.IdNumMovi_inv,
                        dev_IdEmpresa         = Entity.dev_IdEmpresa,
                        dev_IdSucursal        = Entity.dev_IdSucursal,
                        dev_IdMovi_inven_tipo = Entity.dev_IdMovi_inven_tipo,
                        dev_IdNumMovi         = Entity.dev_IdNumMovi,
                        dev_signo             = Entity.dev_signo,
                        observacion           = Entity.observacion,
                        Estado                = Entity.Estado
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }