Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="arguments"></param>
        /// <param name="connection"></param>
        /// <returns></returns>
        private static Domain.Application GetApplication(XmlCastReport arguments, WSConnection connection)
        {
            List <Domain.Application> applications;

            using (CastDomainBLL castDomainBLL = new CastDomainBLL(connection))
            {
                applications = castDomainBLL.GetApplications();
            }

            if (arguments.Database != null && arguments.Domain == null)
            {
                return(applications.FirstOrDefault(_ => _.Name == arguments.Application.Name && _.AdgDatabase == arguments.Database.Name));
            }

            if (arguments.Database == null && arguments.Domain != null)
            {
                return(applications.FirstOrDefault(_ => _.Name == arguments.Application.Name && _.DomainId == arguments.Domain.Name));
            }

            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            // For code readability I keep this redundancy
            if (arguments.Database != null && arguments.Domain != null)
            {
                return(applications.FirstOrDefault(_ => _.Name == arguments.Application.Name && _.AdgDatabase == arguments.Database.Name && _.DomainId == arguments.Domain.Name));
            }

            return(applications.FirstOrDefault(_ => _.Name == arguments.Application.Name));
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        public void InitializeFromWS()
        {
            //GetActive Connection
            ActiveConnection = Setting?.GetActiveConnection();

            //Get list of domains
            if (_ActiveConnection != null)
            {
                try
                {
                    using (CastDomainBLL castDomainBLL = new CastDomainBLL(ActiveConnection))
                    {
                        Applications = castDomainBLL.GetApplications().Select(app => new ApplicationItem(app));
                        List <CastDomain> domains = castDomainBLL.GetDomains().ToList();
                        foreach (CastDomain domain in domains)
                        {
                            if (domain.DBType.Equals("AAD"))
                            {
                                Categories = castDomainBLL.GetCategories();
                            }
                        }
                        if (Categories == null)
                        {
                            Categories = new List <string>();
                        }

                        SelectedTab = 0;
                    }
                }
                catch (Exception ex)
                {
                    MessageManager.OnErrorOccured(ex);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="application"></param>
        /// <param name="connection"></param>
        /// <returns></returns>
        private static Application GetApplication(string application, WSConnection connection)
        {
            List <Application> applications;

            using (CastDomainBLL castDomainBLL = new CastDomainBLL(connection))
            {
                applications = castDomainBLL.GetApplications();
            }

            return(applications.Where(_ => _.Name == application).FirstOrDefault());
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        public void InitializeFromWS()
        {
            //GetActive Connection
            ActiveConnection = (Setting != null) ? Setting.GetActiveConnection() : null;

            //Get list of domains
            if (_ActiveConnection != null)
            {
                try
                {
                    using (CastDomainBLL castDomainBLL = new CastDomainBLL(ActiveConnection))
                    {
                        Applications = castDomainBLL.GetApplications();
                        Categories   = castDomainBLL.GetCategories();
                        SelectedTab  = 0;
                    }
                }
                catch (Exception ex)
                {
                    base.MessageManager.OnErrorOccured(ex);
                }
            }
        }