/// <summary>
        /// Retrieves the settings from the database
        /// </summary>
        /// <returns></returns>
        public static SettingsObject GetSettings()
        {
            DB database = null;

            try
            {
                database = new DB();

                var settings = (from s in database.Settings
                                select new SettingsObject
                                {
                                    HostingOU = s.BaseOU,
                                    PrimaryDC = s.PrimaryDC,
                                    Username = s.Username,
                                    Password = s.Password,
                                    SuperAdmins = s.SuperAdmins,
                                    BillingAdmins = s.BillingAdmins,
                                    ExchangeServer = s.ExchangeFqdn,
                                    ExchangePublicFolderServer = s.ExchangePFServer,
                                    ExchangeVersion = s.ExchangeVersion,
                                    ExchangeSSLEnabled = s.ExchangeSSLEnabled,
                                    ExchangeConnectionType = s.ExchangeConnectionType,
                                    CitrixEnabled = s.CitrixEnabled,
                                    PublicFoldersEnabled = s.PublicFolderEnabled,
                                    LyncEnabled = s.LyncEnabled,
                                    ResellersEnabled = s.ResellersEnabled == null ? false : (bool)s.ResellersEnabled,
                                    HostersName = s.CompanysName,
                                    AllowCustomNameAttribute = s.AllowCustomNameAttrib == null ? false : (bool)s.AllowCustomNameAttrib,
                                    IPBlockingEnabled = s.IPBlockingEnabled == null ? false : (bool)s.IPBlockingEnabled,
                                    UsersOU = s.UsersOU,
                                    LoginLogo = s.BrandingLoginLogo,
                                    CornerLogo = s.BrandingCornerLogo,
                                    LockDownEnabled = s.LockdownEnabled == null ? false : (bool)s.LockdownEnabled
                                }).FirstOrDefault();

                return settings;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (database != null)
                    database.Dispose();
            }
        }
Exemple #2
0
        /// <summary>
        /// Gets information about a particular reseller
        /// </summary>
        /// <param name="resellerCode"></param>
        /// <returns></returns>
        public static ResellerObject GetReseller(string resellerCode)
        {
            DB database = null;

            try
            {
                database = new DB();

                var resellers = (from r in database.Companies
                                where r.IsReseller
                                where r.CompanyCode == resellerCode
                                select new ResellerObject
                                {
                                    CompanyID = r.CompanyId,
                                    CompanyName = r.CompanyName,
                                    CompanyCode = r.CompanyCode,
                                    Street = r.Street,
                                    City = r.City,
                                    State = r.State,
                                    ZipCode = r.ZipCode,
                                    Country = r.Country,
                                    Telephone = r.PhoneNumber,
                                    AdminName = r.AdminName,
                                    AdminEmail = r.AdminEmail,
                                    DistinguishedName = r.DistinguishedName,
                                    Created = r.Created
                                }).FirstOrDefault();

                return resellers;
            }
            catch (Exception ex)
            {
                // TODO: LOG ERROR
                throw;
            }
            finally
            {
                if (database != null)
                    database.Dispose();
            }
        }
Exemple #3
0
        /// <summary>
        /// Gets a list of resellers
        /// </summary>
        /// <returns></returns>
        public static List<ResellerObject> GetResellers()
        {
            DB database = null;

            try
            {
                database = new DB();

                var resellers = from r in database.Companies
                                 where r.IsReseller
                                 orderby r.CompanyName
                                 select new ResellerObject
                                 {
                                    CompanyID = r.CompanyId,
                                    CompanyName = r.CompanyName,
                                    CompanyCode = r.CompanyCode,
                                    Street = r.Street,
                                    City = r.City,
                                    State = r.State,
                                    ZipCode = r.ZipCode,
                                    Country = r.Country,
                                    Telephone = r.PhoneNumber,
                                    AdminName = r.AdminName,
                                    AdminEmail = r.AdminEmail,
                                    DistinguishedName = r.DistinguishedName,
                                    Created = r.Created
                                 };

                return resellers.ToList();
            }
            catch (Exception ex)
            {
                // TODO: LOG ERROR
                throw;
            }
            finally
            {
                if (database != null)
                    database.Dispose();
            }
        }
Exemple #4
0
        /// <summary>
        /// Finds the total number of companies for a particular reseller
        /// </summary>
        /// <param name="resellersCompanyCode"></param>
        /// <returns></returns>
        public static int GetResellersCompanyCount(string resellersCompanyCode)
        {
            DB database = null;

            try
            {
                database = new DB();

                var companyCount = (from c in database.Companies
                                    where c.ResellerCode == resellersCompanyCode
                                    select c).Count();

                return companyCount;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (database != null)
                    database.Dispose();
            }
        }