Пример #1
0
        public T Get <T>(long?TakerId = 0)
        {
            try
            {
                SQL = new StringBuilder();
                SQL.AppendLine(" Select ");
                SQL.AppendLine("    TakerId, ");
                SQL.AppendLine("    CompanyId, ");
                SQL.AppendLine("    IM, ");
                SQL.AppendLine("    CPF_CNPJ, ");
                SQL.AppendLine("    RG_IE, ");
                SQL.AppendLine("    Name, ");
                SQL.AppendLine("    NameFantasy, ");
                SQL.AppendLine("    TypePerson, ");
                SQL.AppendLine("    CEP, ");
                SQL.AppendLine("    Street, ");
                SQL.AppendLine("    Number, ");
                SQL.AppendLine("    Neighborhood, ");
                SQL.AppendLine("    City, ");
                SQL.AppendLine("    State, ");
                SQL.AppendLine("    Telephone, ");
                SQL.AppendLine("    Email, ");
                SQL.AppendLine("    Active, ");
                SQL.AppendLine("    DateInsert, ");
                SQL.AppendLine("    DateUpdate ");
                SQL.AppendLine(" From Takers ");
                SQL.AppendLine(" Where Active = 1 ");
                SQL.AppendLine(" And CompanyId = " + SessionDomain.GetCompanySession().CompanyId);
                if (TakerId > 0)
                {
                    SQL.AppendLine(" And TakerId = " + TakerId);
                }

                DataTable data = Functions.Conn.GetDataTable(SQL.ToString(), "Takers");
                if (data != null && data.Rows.Count > 0)
                {
                    if (typeof(T) == typeof(List <Takers>))
                    {
                        List <Takers> lTakers = new List <Takers>();
                        foreach (DataRow row in data.Rows)
                        {
                            lTakers.Add(Fill(row));
                        }
                        return((T)Convert.ChangeType(lTakers, typeof(T)));
                    }
                    else if (typeof(T) == typeof(Takers))
                    {
                        return((T)Convert.ChangeType(Fill(data.AsEnumerable().First()), typeof(T)));
                    }
                }
                throw new InternalProgramException("Não foram encontrados registros!");
            }catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public T Get <T>(long Id = 0)
        {
            try
            {
                SQL = new StringBuilder();

                SQL.AppendLine(" Select ");
                SQL.AppendLine(" 	NumeroNota As 'NumberNF', ");
                SQL.AppendLine(" 	ChaveValidacao As 'KeyValidation', ");
                SQL.AppendLine(" 	ValorTotalNota As 'Total', ");
                SQL.AppendLine(" 	ISSQNTotal As 'TotalISS', ");
                SQL.AppendLine(" 	ClienteNomeRazaoSocial As 'Name', ");
                SQL.AppendLine(" 	ClienteNomeFantasia As 'NameFantasy', ");
                SQL.AppendLine(" 	ClienteCNPJCPF As 'CPF_CNPJ', ");
                SQL.AppendLine(" 	ClienteInscricaoEstadual As 'IE', ");
                SQL.AppendLine(" 	ClienteInscricaoMunicipal As 'IM', ");
                SQL.AppendLine(" 	DataEmissao As 'DateEmission', ");
                SQL.AppendLine(" 	Observacao As 'Note', ");
                SQL.AppendLine(" 	NotaFiscalPDF As 'PDF', ");
                SQL.AppendLine(" 	URL as 'URL', ");
                SQL.AppendLine(" 	URLAutenticidade As 'URLAuthenticity' ");
                SQL.AppendLine(" From NFeS ");
                SQL.AppendLine(" Where Active = 1 ");
                SQL.AppendLine(" And CompanyId = " + SessionDomain.GetCompanySession().CompanyId);
                if (Id > 0)
                {
                    SQL.AppendLine(" And NFeSId = " + Id);
                }

                DataTable data = Functions.Conn.GetDataTable(SQL.ToString(), "NFeS");

                if (data != null && data.Rows.Count > 0)
                {
                    if (typeof(T) == typeof(List <NFeSRequestQuery>))
                    {
                        List <NFeSRequestQuery> lRequestQuery = new List <NFeSRequestQuery>();
                        foreach (DataRow row in data.Rows)
                        {
                            lRequestQuery.Add(Fill(row));
                        }
                        return((T)Convert.ChangeType(lRequestQuery, typeof(T)));
                    }
                    else if (typeof(T) == typeof(NFeSRequestQuery))
                    {
                        return((T)Convert.ChangeType(Fill(data.AsEnumerable().First()), typeof(T)));
                    }
                }
                throw new InternalProgramException("Não foram encontrados registros!");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        public T Get <T>(long?ServicesId)
        {
            try
            {
                SQL = new StringBuilder();
                SQL.AppendLine(" Select ");
                SQL.AppendLine("    ServicesId, ");
                SQL.AppendLine("    CompanyId, ");
                SQL.AppendLine("    Unity, ");
                SQL.AppendLine("    Value, ");
                SQL.AppendLine("    Description, ");
                SQL.AppendLine("    IRRF, ");
                SQL.AppendLine("    PIS, ");
                SQL.AppendLine("    CSLL, ");
                SQL.AppendLine("    INSS, ");
                SQL.AppendLine("    COFINS, ");
                SQL.AppendLine("    Active, ");
                SQL.AppendLine("    DateInsert, ");
                SQL.AppendLine("    DateUpdate ");
                SQL.AppendLine(" From Services ");
                SQL.AppendLine(" Where Active = 1 ");
                SQL.AppendLine(" And CompanyId = " + SessionDomain.GetCompanySession().CompanyId);
                if (ServicesId > 0)
                {
                    SQL.AppendLine(" And ServicesId = " + ServicesId);
                }

                DataTable data = Functions.Conn.GetDataTable(SQL.ToString(), "Services");
                if (data != null && data.Rows.Count > 0)
                {
                    if (typeof(T) == typeof(List <Services>))
                    {
                        List <Services> lServices = new List <Services>();
                        foreach (DataRow row in data.Rows)
                        {
                            lServices.Add(Fill(row));
                        }
                        return((T)Convert.ChangeType(lServices, typeof(T)));
                    }
                    else if (typeof(T) == typeof(Services))
                    {
                        return((T)Convert.ChangeType(Fill(data.AsEnumerable().First()), typeof(T)));
                    }
                }
                throw new InternalProgramException("Não foram encontrados registros!");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }