コード例 #1
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            listView.Items.Clear();

            string query = BuildQuery();

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.CommandText    = query;
            cmd.CommandTimeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CommandTimedOut"]);
            cmd.CommandType    = CommandType.Text;

            using (System.Data.SqlClient.SqlDataReader reader = SqlHelper.Default.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ListViewItem objItem = this.listView.Items.Add(reader.GetGuid(0).ToString());
                    objItem.SubItems.Add(reader.GetString(3));                                            // Tx Number
                    objItem.SubItems.Add(reader.GetString(5));
                    objItem.SubItems.Add(reader.GetDateTime(4).ToString(Common.Utility.GetDateFormat())); //
                    objItem.SubItems.Add(reader.GetDateTime(6).ToString(Common.Utility.GetDateFormat()));
                    objItem.SubItems.Add(reader.GetString(1));
                    objItem.SubItems.Add(reader.GetDecimal(7).ToString("##"));
                }
            }
        }
コード例 #2
0
ファイル: TifinMaster.cs プロジェクト: NKsahu/Foodoo-Web-App
        public ConcurrentDictionary <Int64, TifinMaster> GetAll()
        {
            System.Data.SqlClient.SqlCommand          cmd     = null;
            System.Data.SqlClient.SqlDataReader       SDR     = null;
            ConcurrentDictionary <Int64, TifinMaster> ListTmp = new ConcurrentDictionary <Int64, TifinMaster>();

            DBCon Obj = new DBCon();

            try
            {
                string Query = "SELECT * FROM TifinMaster";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    TifinMaster ObjTmp = new TifinMaster();
                    ObjTmp.TifinID         = SDR.GetInt64(0);
                    ObjTmp.TifinType       = SDR.GetInt32(1);
                    ObjTmp.TifinColor      = SDR.GetString(2);
                    ObjTmp.TifinStatus     = SDR.IsDBNull(4) ? "UnUsed" : SDR.GetString(4);
                    ObjTmp.TifinAtLocation = SDR.IsDBNull(5) ? "CENTER" : SDR.GetString(5);
                    ObjTmp.TifinTakenBy    = SDR.IsDBNull(6) ? "" : SDR.GetString(6);
                    ObjTmp.UpdationDate    = SDR.IsDBNull(7) ? System.DateTime.Now : SDR.GetDateTime(7);
                    ListTmp.TryAdd(ObjTmp.TifinID, ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
コード例 #3
0
        public override DTOBase PopulateDTO(System.Data.SqlClient.SqlDataReader sqlReader)
        {
            StudentDTO studentDTO = new StudentDTO();

            studentDTO.isNew = false;

            if (!sqlReader.IsDBNull(this.m_IdOrdinal))
            {
                studentDTO.Id = sqlReader.GetInt32(this.m_IdOrdinal);
            }

            if (!sqlReader.IsDBNull(this.m_firstNameOrdinal))
            {
                studentDTO.firstName = sqlReader.GetString(this.m_firstNameOrdinal);
            }

            if (!sqlReader.IsDBNull(this.m_lastNameOrdinal))
            {
                studentDTO.lastName = sqlReader.GetString(this.m_lastNameOrdinal);
            }

            if (!sqlReader.IsDBNull(this.m_isDeletedOrdinal))
            {
                studentDTO.isDeleted = sqlReader.GetInt32(this.m_isDeletedOrdinal);
            }

            return(studentDTO);
        }
コード例 #4
0
ファイル: DeliveryBoy.cs プロジェクト: NKsahu/Foodoo-Web-App
        public System.Collections.Generic.List <DeliveryBoy> GetAll()
        {
            System.Data.SqlClient.SqlCommand              cmd     = null;
            System.Data.SqlClient.SqlDataReader           SDR     = null;
            System.Collections.Generic.List <DeliveryBoy> ListTmp = new System.Collections.Generic.List <DeliveryBoy>();
            DeliveryBoy ObjTmp = null;
            DBCon       Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM DELIVERYBOY WHERE Deleted=0 ORDER BY DBID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new DeliveryBoy
                    {
                        DBID        = SDR.GetInt32(0),
                        Name        = SDR.GetString(1),
                        Mobile      = SDR.GetString(2),
                        Password    = SDR.GetString(3),
                        Create_Date = SDR.GetDateTime(4),
                        Create_By   = SDR.GetInt32(5),
                        Update_Date = SDR.GetDateTime(6),
                        Update_By   = SDR.GetInt32(7),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
コード例 #5
0
ファイル: SqlSchemaReader.cs プロジェクト: mstanford/water
        public static Bamboo.Mssql.ProcedureCollection ReadProcedures(System.Data.SqlClient.SqlConnection connection)
        {
            Bamboo.Mssql.ProcedureCollection procedures = new Bamboo.Mssql.ProcedureCollection();

            string query = "SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME NOT LIKE 'dt_%' ORDER BY ROUTINE_NAME";

            System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(query, connection);

            System.Data.SqlClient.SqlDataReader dataReader = command.ExecuteReader();

            while (dataReader.Read())
            {
                Bamboo.Mssql.Procedure procedure = new Bamboo.Mssql.Procedure();

                if (!dataReader.IsDBNull(dataReader.GetOrdinal("ROUTINE_NAME")))
                {
                    procedure.Name = dataReader.GetString(dataReader.GetOrdinal("ROUTINE_NAME"));
                }

                if (!dataReader.IsDBNull(dataReader.GetOrdinal("ROUTINE_DEFINITION")))
                {
                    procedure.Definition = dataReader.GetString(dataReader.GetOrdinal("ROUTINE_DEFINITION"));
                }

                procedures.Add(procedure);
            }

            dataReader.Close();

            return(procedures);
        }
コード例 #6
0
ファイル: Customer.cs プロジェクト: NKsahu/Foodoo-Web-App
        public System.Collections.Generic.List <Customer> GetAll()
        {
            System.Data.SqlClient.SqlCommand           cmd     = null;
            System.Data.SqlClient.SqlDataReader        SDR     = null;
            System.Collections.Generic.List <Customer> ListTmp = new System.Collections.Generic.List <Customer>();
            Customer ObjTmp = null;
            DBCon    Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM CUSTOMER WHERE Deleted=0 ORDER BY CID DESC";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new Customer
                    {
                        CID         = SDR.GetInt64(0),
                        Name        = SDR.GetString(1),
                        Birthday    = SDR.GetDateTime(2),
                        Email       = SDR.GetString(3),
                        Mobile      = SDR.GetString(4),
                        Password    = SDR.GetString(5),
                        Signup_Date = SDR.GetDateTime(6),
                        Update_Date = SDR.GetDateTime(7),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
コード例 #7
0
        public bool PegaCartao()
        {
            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.CommandText = "SELECT * FROM CARTAOCREDITO WHERE IDCLIENTE = @ID";
            conexao.command.Parameters.Clear();
            conexao.command.Parameters.Add("@ID", SqlDbType.Int).Value = (int)HttpContext.Current.Session["idUsuario"];

            System.Data.SqlClient.SqlDataReader dr = conexao.command.ExecuteReader();

            if (dr.HasRows)
            {
                dr.Read();
                Bandeira     = dr.GetString(1);
                NumeroCartao = dr.GetString(3);
                CVV          = dr.GetString(3);
                Validade     = dr.GetString(4);

                conexao.connection.Close();
                dr.Close();
                return(true);
            }

            conexao.connection.Close();
            dr.Close();
            return(false);
        }
コード例 #8
0
        public ProdutosEAnuncios(int QuantidadeAnuncios, int QuantidadeProdutos)
        {
            Anuncios anun = new Anuncios();

            anuncios = anun.PegarAnuncios(QuantidadeAnuncios);

            BDConexao conexao = new BDConexao();

            conexao.connection.Open();
            conexao.command.CommandText = "SELECT TOP @#QUANTIDADE idProduto,nome,imagem,precoVenda FROM PRODUTO ORDER BY NEWID()";
            conexao.command.CommandText = conexao.command.CommandText.Replace("@#QUANTIDADE", QuantidadeProdutos.ToString());

            System.Data.SqlClient.SqlDataReader dr = conexao.command.ExecuteReader();
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    ProdutoDisplay prod = new ProdutoDisplay()
                    {
                        Id     = dr.GetInt32(0),
                        nome   = dr.GetString(1),
                        imagem = dr.GetString(2),
                        preco  = dr.GetDecimal(3)
                    };
                    produtos.Add(prod);
                }
            }
            conexao.connection.Close();
            dr.Close();
        }
コード例 #9
0
ファイル: Settings.cs プロジェクト: NKsahu/Foodoo-Web-App
        public System.Collections.Generic.List <Settings> GetAll()
        {
            System.Data.SqlClient.SqlCommand           cmd     = null;
            System.Data.SqlClient.SqlDataReader        SDR     = null;
            System.Collections.Generic.List <Settings> ListTmp = new System.Collections.Generic.List <Settings>();
            Settings ObjTmp = null;
            DBCon    Obj    = new DBCon();

            try
            {
                string Query = "SELECT * FROM Settings";
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new Settings
                    {
                        SettingId      = SDR.GetInt32(0),
                        KeyName        = SDR.GetString(1),
                        KeyValue       = SDR.GetString(2),
                        KeyDiscription = SDR.GetString(3),
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
コード例 #10
0
ファイル: SimuuMapper.cs プロジェクト: JustinDavisA/Simuu
        public SimuuDAL SimuuFromReader(System.Data.SqlClient.SqlDataReader reader)
        {
            SimuuDAL proposedReturnValue = new SimuuDAL();

            // ----- Simuus ----- //
            proposedReturnValue.SimuuID            = reader.GetInt32(offsetToSimuuID);
            proposedReturnValue.SimuuName          = reader.GetString(offsetToSimuuName);
            proposedReturnValue.SimuuAge           = reader.GetInt32(offsetToSimuuAge);
            proposedReturnValue.SimuuBirth         = GetDateTimeOrDefault(reader, offsetToSimuuBirth, DateTime.Today);
            proposedReturnValue.SimuuDeath         = GetDateTimeOrDefault(reader, offsetToSimuuDeath, DateTime.Today);
            proposedReturnValue.SimuuXCoordinate   = reader.GetInt32(offsetToSimuuXCoordinate);
            proposedReturnValue.SimuuYCoordinate   = reader.GetInt32(offsetToSimuuYCoordinate);
            proposedReturnValue.ImpulseToRest      = reader.GetInt32(offsetToImpulseToRest);
            proposedReturnValue.ImpulseToDrink     = reader.GetInt32(offsetToImpulseToDrink);
            proposedReturnValue.ImpulseToEat       = reader.GetInt32(offsetToImpulseToEat);
            proposedReturnValue.StatEnergy         = reader.GetInt32(offsetToSimuuEnergy);
            proposedReturnValue.StatThirst         = reader.GetInt32(offsetToSimuuThirst);
            proposedReturnValue.StatHunger         = reader.GetInt32(offsetToSimuuHunger);
            proposedReturnValue.SimuuMovementSpeed = reader.GetInt32(offsetToSimuuMovementSpeed);
            proposedReturnValue.SimuuSenseRadius   = reader.GetInt32(offsetToSimuuSenseRadius);
            proposedReturnValue.UserID             = reader.GetInt32(offsetToUserID);

            // ----- Users ----- //
            proposedReturnValue.UserName     = reader.GetString(offsetToUserName);
            proposedReturnValue.UserEmail    = reader.GetString(offsetToUserEmail);
            proposedReturnValue.PasswordHash = reader.GetString(offsetToPasswordHash);
            proposedReturnValue.PasswordSalt = reader.GetString(offsetToPasswordSalt);
            proposedReturnValue.RoleID       = reader.GetInt32(offsetToRoleID);

            return(proposedReturnValue);
        }
コード例 #11
0
        public static byte[] PrivateMessageCheck(WorldMgr.character c)
        {
            DB           ms     = new DB("SELECT * FROM message WHERE receiver='" + c.Information.Name + "'");
            PacketWriter Writer = new PacketWriter();
            int          count  = ms.Count();

            Writer.Create(OperationCode.SERVER_PM_MESSAGE);
            Writer.Byte(1);                     //Static
            Writer.Byte(Convert.ToByte(count)); //Total count
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    string   pmfrom    = reader.GetString(1);
                    string   pmto      = reader.GetString(2);
                    string   pmmessage = reader.GetString(3);
                    byte     pmstatus  = reader.GetByte(4);
                    DateTime pmdate    = Convert.ToDateTime(reader.GetDateTime(5));

                    Writer.Text(pmfrom);            // Message From
                    Writer.DWord(0x8A070000);       // date
                    Writer.DWord(0xC7058401);       // date
                    Writer.Byte(pmstatus);          // Status (0 = Unread) (1 = Read)
                }
                ms.Close();
            }
            return(Writer.GetBytes());
        }
コード例 #12
0
        public TList_LanLiquidacao_X_DescDup Select(TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            bool podeFecharBco = false;
            TList_LanLiquidacao_X_DescDup lista = new TList_LanLiquidacao_X_DescDup();

            if (Banco_Dados == null)
            {
                this.CriarBanco_Dados(false);
                podeFecharBco = true;
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, vTop, vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_LanLiquidacao_X_DescDup reg = new TRegistro_LanLiquidacao_X_DescDup();
                    if (!(reader.IsDBNull(reader.GetOrdinal("ID_Lancto"))))
                    {
                        reg.Id_lancto = reader.GetDecimal(reader.GetOrdinal("ID_Lancto"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("CD_Empresa"))))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("CD_Empresa"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("NR_Lancto"))))
                    {
                        reg.Nr_lancto = reader.GetDecimal(reader.GetOrdinal("NR_Lancto"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("CD_Parcela"))))
                    {
                        reg.Cd_parcela = reader.GetDecimal(reader.GetOrdinal("CD_Parcela"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("ID_Liquid"))))
                    {
                        reg.Id_liquid = reader.GetDecimal(reader.GetOrdinal("ID_Liquid"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("CD_Contager")))
                    {
                        reg.Cd_contager = reader.GetString(reader.GetOrdinal("CD_Contager"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("CD_LanctoCaixa")))
                    {
                        reg.Cd_lanctocaixa = reader.GetDecimal(reader.GetOrdinal("CD_LanctoCaixa"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #13
0
        public TList_CTREstoque Select(TpBusca[] vBusca, short vTop, string vNM_Campo)
        {
            bool st_transacao = false;

            if (this.Banco_Dados == null)
            {
                st_transacao = this.CriarBanco_Dados(false);
            }
            TList_CTREstoque lista = new TList_CTREstoque();

            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, vTop, vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_CTREstoque reg = new TRegistro_CTREstoque();
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_empresa")))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("cd_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nr_lanctoctr")))
                    {
                        reg.Nr_lanctoctr = reader.GetDecimal(reader.GetOrdinal("nr_lanctoctr"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_nota")))
                    {
                        reg.Id_nota = reader.GetDecimal(reader.GetOrdinal("id_nota"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_produto")))
                    {
                        reg.Cd_produto = reader.GetString(reader.GetOrdinal("cd_produto"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_lanctoestoque")))
                    {
                        reg.Id_lanctoestoque = reader.GetDecimal(reader.GetOrdinal("id_lanctoestoque"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nr_lanctofiscal")))
                    {
                        reg.Nr_lanctofiscal = reader.GetDecimal(reader.GetOrdinal("nr_lanctofiscal"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_nfitem")))
                    {
                        reg.ID_NFItem = reader.GetDecimal(reader.GetOrdinal("id_nfitem"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (st_transacao)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #14
0
        public TList_Lan_RetencaoFinanceiraGMO Select(TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_Lan_RetencaoFinanceiraGMO lista = new TList_Lan_RetencaoFinanceiraGMO();
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }

            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_Lan_RetencaoFinanceiraGMO reg = new TRegistro_Lan_RetencaoFinanceiraGMO();
                    if (!reader.IsDBNull(reader.GetOrdinal("id_lanctoGMO")))
                    {
                        reg.Id_LanctoGMO = reader.GetDecimal(reader.GetOrdinal("id_lanctoGMO"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Cd_ContaGer")))
                    {
                        reg.Cd_ContaGer = reader.GetString(reader.GetOrdinal("Cd_ContaGer"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Cd_LanctoCaixa")))
                    {
                        reg.Cd_LanctoCaixa = reader.GetDecimal(reader.GetOrdinal("Cd_LanctoCaixa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Cd_Empresa")))
                    {
                        reg.Cd_Empresa = reader.GetString(reader.GetOrdinal("Cd_Empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Nr_lancto")))
                    {
                        reg.Nr_Lancto = reader.GetDecimal(reader.GetOrdinal("Nr_lancto"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Cd_Parcela")))
                    {
                        reg.Cd_Parcela = reader.GetDecimal(reader.GetOrdinal("Cd_Parcela"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Id_Liquid")))
                    {
                        reg.Id_Liquid = reader.GetDecimal(reader.GetOrdinal("Id_Liquid"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #15
0
        private Instrument GetInstrumentFromRdr(System.Data.SqlClient.SqlDataReader rdr)
        {
            int    id      = rdr.GetInt32(0);
            string name    = rdr.GetString(1);
            string section = rdr.GetString(2);

            return(new Instrument(id, name, section));
        }
コード例 #16
0
        public TList_Sessao Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            bool         podeFecharBco = false;
            TList_Sessao lista         = new TList_Sessao();

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, vTop, vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_Sessao reg = new TRegistro_Sessao();
                    if (!(reader.IsDBNull(reader.GetOrdinal("id_pdv"))))
                    {
                        reg.Id_pdv = reader.GetDecimal(reader.GetOrdinal("id_pdv"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("Ds_pdv"))))
                    {
                        reg.Ds_pdv = reader.GetString(reader.GetOrdinal("Ds_pdv"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("id_sessao"))))
                    {
                        reg.Id_sessao = reader.GetDecimal(reader.GetOrdinal("id_sessao"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("login"))))
                    {
                        reg.Login = reader.GetString(reader.GetOrdinal("login"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_abertura")))
                    {
                        reg.Dt_abertura = reader.GetDateTime(reader.GetOrdinal("dt_abertura"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_fechamento")))
                    {
                        reg.Dt_fechamento = reader.GetDateTime(reader.GetOrdinal("dt_fechamento"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("st_registro")))
                    {
                        reg.St_registro = reader.GetString(reader.GetOrdinal("st_registro"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #17
0
        public static ushort LoginUser(string aID, ref string aPass, ref WorldMgr.player aPlayer, bool localConnect)
        {
            if (Helpers.Manager.clients.Count >= Helpers.Manager.maxSlots)
            {
                return(0); // crowded
            }
            DB ms = new DB("SELECT * FROM users WHERE id = '" + aID + "'");

            if (ms.Count() == 0)
            {
                ms.Close();
                return(1);
            }
            ms = new DB("SELECT * FROM users WHERE id = '" + aID + "' AND password='******'");
            if (ms.Count() == 0)
            {
                ms.Close();
                return(5);
            }
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    if (reader.GetString(1).ToLower() == aID.ToLower()) // id
                    {
                        if (reader.GetByte(3) == 1)                     // online
                        {
                            ms.Close();
                            return(2); // already online
                        }

                        if (reader.GetInt32(5) == 1) // banned
                        {
                            aPass = reader.GetString(4);
                            ms.Close();
                            return(3); // banned
                        }

                        if (aPlayer == null && localConnect)
                        {
                            DB.query("UPDATE users SET online=1 WHERE userid='" + reader.GetInt32(0) + "'");
                        }
                        aPlayer             = new WorldMgr.player();
                        aPlayer.AccountName = aID;
                        aPlayer.Password    = aPass; // Nukei: ?? whats the reason for saving password in memory ?
                        aPlayer.ID          = reader.GetInt32(0);
                        aPlayer.pGold       = reader.GetInt64(7);
                        aPlayer.Silk        = reader.GetInt32(6);
                        aPlayer.SilkPrem    = reader.GetInt32(9);
                        aPlayer.wSlots      = reader.GetByte(11);
                        ms.Close();
                        return(4);
                    }
                }
            }
            ms.Close();
            return(6); // Bilinmeyen geri dönüş:Özel bir durum oluşmadı. (Mecburi Gönderim)
        }
コード例 #18
0
        public TList_SaboresItens Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            bool podeFecharBco       = false;
            TList_SaboresItens lista = new TList_SaboresItens();

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, vTop, vNM_Campo, string.Empty));
            try
            {
                while (reader.Read())
                {
                    TRegistro_SaboresItens reg = new TRegistro_SaboresItens();
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_empresa")))
                    {
                        reg.Cd_Empresa = reader.GetString(reader.GetOrdinal("cd_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_prevenda")))
                    {
                        reg.Id_PreVenda = reader.GetDecimal(reader.GetOrdinal("id_prevenda"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Id_Item")))
                    {
                        reg.Id_Item = reader.GetDecimal(reader.GetOrdinal("Id_Item"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Sabor")))
                    {
                        reg.ID_Sabor = reader.GetDecimal(reader.GetOrdinal("ID_Sabor"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DS_Sabor")))
                    {
                        reg.DS_Sabor = reader.GetString(reader.GetOrdinal("DS_Sabor"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DS_Sabor")))
                    {
                        reg.DS_Sabor = reader.GetString(reader.GetOrdinal("DS_Sabor"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_grupo")))
                    {
                        reg.cd_grupo = reader.GetString(reader.GetOrdinal("cd_grupo"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #19
0
        public TList_AjusteImposto Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_AjusteImposto lista = new TList_AjusteImposto();
            bool podeFecharBco        = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_AjusteImposto reg = new TRegistro_AjusteImposto();
                    if (!(reader.IsDBNull(reader.GetOrdinal("id_registro"))))
                    {
                        reg.Id_registro = reader.GetDecimal(reader.GetOrdinal("id_registro"));
                    }
                    if (!(reader.IsDBNull(reader.GetOrdinal("id_lancto"))))
                    {
                        reg.Id_lancto = reader.GetDecimal(reader.GetOrdinal("id_lancto"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nr_docarrecadacao")))
                    {
                        reg.Nr_docarrecadacao = reader.GetString(reader.GetOrdinal("nr_docarrecadacao"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nr_procajuste")))
                    {
                        reg.Nr_procajuste = reader.GetString(reader.GetOrdinal("nr_procajuste"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("tp_origemicms")))
                    {
                        reg.Tp_origemicms = reader.GetString(reader.GetOrdinal("tp_origemicms"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_processo")))
                    {
                        reg.Ds_processo = reader.GetString(reader.GetOrdinal("ds_processo"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_complementar")))
                    {
                        reg.Ds_complementar = reader.GetString(reader.GetOrdinal("ds_complementar"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #20
0
        public TList_Abastecidas Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_Abastecidas lista = new TList_Abastecidas();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }

            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
                while (reader.Read())
                {
                    TRegistro_Abastecidas reg = new TRegistro_Abastecidas();
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Abastecimento")))
                    {
                        reg.Id_abastecimento = reader.GetDecimal(reader.GetOrdinal("ID_Abastecimento"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("CD_Empresa")))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("CD_Empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nm_empresa")))
                    {
                        reg.Nm_empresa = reader.GetString(reader.GetOrdinal("nm_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Abastecida")))
                    {
                        reg.Id_abastecida = reader.GetDecimal(reader.GetOrdinal("ID_Abastecida"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Volume")))
                    {
                        reg.Volume = reader.GetDecimal(reader.GetOrdinal("Volume"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DT_Abastecida")))
                    {
                        reg.Dt_abastecida = reader.GetDateTime(reader.GetOrdinal("DT_Abastecida"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #21
0
        public TList_LanFotosItensMud Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNm_Campo)
        {
            TList_LanFotosItensMud lista = new TList_LanFotosItensMud();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNm_Campo));
                while (reader.Read())
                {
                    TRegistro_LanFotosItensMud reg = new TRegistro_LanFotosItensMud();
                    if (!reader.IsDBNull(reader.GetOrdinal("CD_Empresa")))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("CD_Empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Mudanca")))
                    {
                        reg.Id_mudanca = reader.GetDecimal(reader.GetOrdinal("ID_Mudanca"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Item")))
                    {
                        reg.Id_item = reader.GetDecimal(reader.GetOrdinal("ID_Item"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_foto")))
                    {
                        reg.Id_foto = reader.GetDecimal(reader.GetOrdinal("id_foto"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Ds_foto")))
                    {
                        reg.Ds_foto = reader.GetString(reader.GetOrdinal("Ds_foto"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("foto")))
                    {
                        reg.Img = (byte[])reader.GetValue(reader.GetOrdinal("foto"));
                    }


                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #22
0
        public TList_SpedContabil Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_SpedContabil lista = new TList_SpedContabil();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }

            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
                while (reader.Read())
                {
                    TRegistro_SpedContabil reg = new TRegistro_SpedContabil();

                    if (!reader.IsDBNull(reader.GetOrdinal("cd_empresa")))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("cd_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nm_empresa")))
                    {
                        reg.Nm_empresa = reader.GetString(reader.GetOrdinal("nm_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_sped")))
                    {
                        reg.Id_sped = reader.GetDecimal(reader.GetOrdinal("id_sped"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nr_sped")))
                    {
                        reg.Nr_sped = reader.GetDecimal(reader.GetOrdinal("nr_sped"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_ini")))
                    {
                        reg.Dt_ini = reader.GetDateTime(reader.GetOrdinal("dt_ini"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_fin")))
                    {
                        reg.Dt_fin = reader.GetDateTime(reader.GetOrdinal("dt_fin"));
                    }
                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #23
0
        public TList_EtapaOrdem Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNm_Campo)
        {
            TList_EtapaOrdem lista = new TList_EtapaOrdem();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNm_Campo));
                while (reader.Read())
                {
                    TRegistro_EtapaOrdem reg = new TRegistro_EtapaOrdem();

                    if (!reader.IsDBNull(reader.GetOrdinal("id_etapa")))
                    {
                        reg.Id_etapa = reader.GetDecimal(reader.GetOrdinal("id_etapa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_etapa")))
                    {
                        reg.Ds_etapa = reader.GetString(reader.GetOrdinal("ds_etapa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("st_iniciarOS")))
                    {
                        reg.St_iniciarOS = reader.GetString(reader.GetOrdinal("st_iniciarOS"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("st_finalizarOS")))
                    {
                        reg.St_finalizarOS = reader.GetString(reader.GetOrdinal("st_finalizarOS"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("st_etapaorcamento")))
                    {
                        reg.St_etapaorcamento = reader.GetString(reader.GetOrdinal("st_etapaorcamento"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("st_envterceiro")))
                    {
                        reg.St_envterceiro = reader.GetString(reader.GetOrdinal("st_envterceiro"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #24
0
 public static Status Create(System.Data.SqlClient.SqlDataReader rdr)
 {
     return(new Status
     {
         Id = rdr.GetInt("Id"),
         Name = rdr.GetString("Name"),
         Description = rdr.GetString("Description")
     });
 }
コード例 #25
0
        public TList_DataContato Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_DataContato lista = new TList_DataContato();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }

            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
                while (reader.Read())
                {
                    TRegistro_DataContato reg = new TRegistro_DataContato();
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_Contato")))
                    {
                        reg.Id_contato = reader.GetDecimal(reader.GetOrdinal("ID_Contato"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_clifor")))
                    {
                        reg.Cd_clifor = reader.GetString(reader.GetOrdinal("cd_clifor"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nm_clifor")))
                    {
                        reg.Nm_clifor = reader.GetString(reader.GetOrdinal("nm_clifor"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ID_TpData")))
                    {
                        reg.Id_TpData = reader.GetDecimal(reader.GetOrdinal("ID_TpData"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_tpdata")))
                    {
                        reg.Ds_tpdata = reader.GetString(reader.GetOrdinal("ds_tpdata"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Data")))
                    {
                        reg.Data = reader.GetDateTime(reader.GetOrdinal("Data"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #26
0
        public TList_DetRecIsentaPisCofins Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNm_Campo)
        {
            TList_DetRecIsentaPisCofins lista = new TList_DetRecIsentaPisCofins();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNm_Campo));
                while (reader.Read())
                {
                    TRegistro_DetRecIsentaPisCofins reg = new TRegistro_DetRecIsentaPisCofins();

                    if (!reader.IsDBNull(reader.GetOrdinal("id_detrecisenta")))
                    {
                        reg.Id_detrecisenta = reader.GetDecimal(reader.GetOrdinal("id_detrecisenta"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_imposto")))
                    {
                        reg.Cd_imposto = reader.GetDecimal(reader.GetOrdinal("cd_imposto"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_imposto")))
                    {
                        reg.Ds_imposto = reader.GetString(reader.GetOrdinal("ds_imposto"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_st")))
                    {
                        reg.Cd_st = reader.GetString(reader.GetOrdinal("cd_st"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_situacao")))
                    {
                        reg.Ds_situacao = reader.GetString(reader.GetOrdinal("ds_situacao"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_detrecisenta")))
                    {
                        reg.Ds_detrecisenta = reader.GetString(reader.GetOrdinal("ds_detrecisenta"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #27
0
        public TList_CTRQtdeCarga Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNm_Campo)
        {
            TList_CTRQtdeCarga lista = new TList_CTRQtdeCarga();

            System.Data.SqlClient.SqlDataReader reader = null;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            try
            {
                reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNm_Campo));
                while (reader.Read())
                {
                    TRegistro_CTRQtdeCarga reg = new TRegistro_CTRQtdeCarga();

                    if (!reader.IsDBNull(reader.GetOrdinal("cd_empresa")))
                    {
                        reg.Cd_empresa = reader.GetString(reader.GetOrdinal("cd_empresa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("nr_lanctoctr")))
                    {
                        reg.Nr_lanctoCTR = reader.GetDecimal(reader.GetOrdinal("nr_lanctoctr"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_qtde")))
                    {
                        reg.Id_qtde = reader.GetDecimal(reader.GetOrdinal("id_qtde"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cUnid")))
                    {
                        reg.cUnid = reader.GetString(reader.GetOrdinal("cUnid"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("tp_medida")))
                    {
                        reg.Tp_medida = reader.GetString(reader.GetOrdinal("tp_medida"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("qt_carga")))
                    {
                        reg.Qt_carga = reader.GetDecimal(reader.GetOrdinal("qt_carga"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
コード例 #28
0
        public TList_EtapaPedido Select(TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_EtapaPedido lista = new TList_EtapaPedido();

            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = ExecutarBusca(SqlCodeBusca(vBusca, vTop, ""));
            try
            {
                while (reader.Read())
                {
                    TRegistro_EtapaPedido reg = new TRegistro_EtapaPedido();

                    if (!reader.IsDBNull(reader.GetOrdinal("Id_etapa")))
                    {
                        reg.Id_etapa = reader.GetDecimal(reader.GetOrdinal("Id_etapa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("NR_Pedido")))
                    {
                        reg.Nr_pedido = reader.GetDecimal(reader.GetOrdinal("NR_Pedido"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DS_Etapa")))
                    {
                        reg.DS_Etapa = reader.GetString(reader.GetOrdinal("DS_Etapa"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_ini")))
                    {
                        reg.Dt_ini = reader.GetDateTime(reader.GetOrdinal("dt_ini"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_fin")))
                    {
                        reg.Dt_fin = reader.GetDateTime(reader.GetOrdinal("dt_fin"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("st_registro")))
                    {
                        reg.St_registro = reader.GetString(reader.GetOrdinal("st_registro"));
                    }

                    lista.Add(reg);
                }
                return(lista);
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
        }
コード例 #29
0
 public static ActionType Create(System.Data.SqlClient.SqlDataReader rdr)
 {
     return(new ActionType
     {
         Id = rdr.GetInt("Id"),
         Name = rdr.GetString("Name"),
         Description = rdr.GetString("Description"),
         Unit = rdr.GetString("Unit")
     });
 }
コード例 #30
0
        public TList_DesdobroPesagem Select(Utils.TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_DesdobroPesagem lista = new TList_DesdobroPesagem();
            bool podeFecharBco          = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = ExecutarBusca(SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
            try
            {
                while (reader.Read())
                {
                    TRegistro_DesdobroPesagem reg = new TRegistro_DesdobroPesagem();

                    if (!reader.IsDBNull(reader.GetOrdinal("cd_empresa_orig")))
                    {
                        reg.Cd_empresa_orig = reader.GetString(reader.GetOrdinal("cd_empresa_orig"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("tp_pesagem_orig")))
                    {
                        reg.Tp_pesagem_orig = reader.GetString(reader.GetOrdinal("tp_pesagem_orig"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_ticket_orig")))
                    {
                        reg.Id_ticket_orig = reader.GetDecimal(reader.GetOrdinal("id_ticket_orig"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_empresa_dest")))
                    {
                        reg.Cd_empresa_dest = reader.GetString(reader.GetOrdinal("cd_empresa_dest"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("tp_pesagem_dest")))
                    {
                        reg.Tp_pesagem_dest = reader.GetString(reader.GetOrdinal("tp_pesagem_dest"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("id_ticket_dest")))
                    {
                        reg.Id_ticket_dest = reader.GetDecimal(reader.GetOrdinal("id_ticket_dest"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    deletarBanco_Dados();
                }
            }
            return(lista);
        }