Example #1
0
        public IDataContent <Company> GetCompanyData(List <IMatchNumber> numbersTypeToCheck, string number, string headers)
        {
            IDataContent <Company> company = new CompanyContent();

            executor = new CompanyExecutor(numbersTypeToCheck, number, headers);

            company = executor.GetData();

            return(company);
        }
Example #2
0
        private CompanyContent GetCompanyContent(string CompanyId)
        {
            Informa.Models.DCD.Company c = GetCompany(CompanyId);
            if (c == null)
            {
                return(null);
            }

            CompanyContent cc = _.CachedXmlParser.ParseContent <CompanyContent>(c.Content, CompanyId);

            return(cc);
        }
Example #3
0
        public IDataContent <Company> GetData()
        {
            IDataContent <Company> dataContent = new CompanyContent();

            dataContent.Headers = Headers;

            MatchFactory factory = new MatchFactory();

            NumberBase concreteNumberType = factory.MatchNumber(NumbersToCheck, Number);

            if (concreteNumberType != null && concreteNumberType.IsValid(Number))
            {
                try
                {
                    Number = concreteNumberType.FormatNumber(Number);
                    ISession session = NHibernateManager.BeginSessionTransaction();
                    dataContent.Data = CompanyDAO.Instance.GetCompanyDataByNumber(Number, session);
                    NHibernateManager.CloseSessionTransaction();
                    dataContent.Status = StatusEnum.Valid.ToString();
                    if (dataContent.Data == null)
                    {
                        dataContent.Message = "Brak danych";
                        dataContent.Status  = StatusEnum.Error.ToString();
                    }
                }
                catch (Exception e)
                {
                    NHibernateManager.CloseSessionTransaction();
                    throw new Exception(e.Message);
                }
            }
            else
            {
                dataContent.Message = "Podany numer jest niepoprawny";
                dataContent.Status  = StatusEnum.Error.ToString();
            }
            LogManager log = new LogManager();

            log.LogData(dataContent);

            return(dataContent);
        }
Example #4
0
 public string GetParentCompany(CompanyContent content)
 {
     return(content.ParentsAndDivisions.CompanyPaths.FirstOrDefault()?.Path);
 }
Example #5
0
        public string GetCompanyDescription(string CompanyId)
        {
            CompanyContent cc = GetCompanyContent(CompanyId);

            return(cc?.CompanyInfo?.Description ?? string.Empty);
        }