Exemplo n.º 1
0
        /// <summary>
        /// Returns 0 if no patches were installed.
        /// </summary>
        /// <param name="major"></param>
        /// <param name="minor"></param>
        /// <param name="patch"></param>
        /// <param name="installDate"></param>
        /// <returns></returns>
        public static int GetProfileSystemVersion(out int major, out int minor, out int patch, out DateTime installDate)
        {
            int retval = 0;

            major       = 0;
            minor       = 0;
            patch       = 0;
            installDate = DateTime.MinValue;

            DataCommand command = ProfileDataHelper.CreateDataCommand();

            command.CommandText = "GetProfileSchemaVersionNumber";
            DataResult result = DataService.LoadDataSet(command);

            if (result.DataSet != null)
            {
                if (result.DataSet.Tables.Count > 0 && result.DataSet.Tables[0].Rows.Count > 0)
                {
                    DataRow row = result.DataSet.Tables[0].Rows[0];
                    major       = (int)row["Major"];
                    minor       = (int)row["Minor"];
                    patch       = (int)row["Patch"];
                    installDate = (DateTime)row["InstallDate"];
                }
            }

            return(retval);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the search results.
        /// </summary>
        /// <param name="SearchGuid">The search GUID.</param>
        /// <returns></returns>
        private static MetaStorageCollectionBase <Account> LoadSearchResults(Guid SearchGuid)
        {
            DataCommand cmd = ProfileDataHelper.CreateDataCommand();

            cmd.CommandText = String.Format("ecf_Search_{0}", ProfileContext.Current.AccountMetaClass.Name);
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("SearchSetId", SearchGuid, DataParameterType.UniqueIdentifier));

            // Might be good idea to signal if there are results at all
            DataResult result = DataService.LoadDataSet(cmd);

            MetaStorageCollectionBase <Account> accounts = new MetaStorageCollectionBase <Account>();

            PopulateCollection <Account>(ProfileContext.Current.AccountClassInfo, accounts, result.DataSet);
            return(accounts);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads the by provider key.
        /// </summary>
        /// <param name="ProviderKey">The provider key.</param>
        /// <returns></returns>
        internal static Account LoadByProviderKey(string ProviderKey)
        {
            Guid        searchGuid = Guid.NewGuid();
            DataCommand cmd        = ProfileDataHelper.CreateDataCommand();

            cmd.CommandText = String.Format("ecf_Search_{0}_ProviderKey", ProfileContext.Current.AccountMetaClass.Name);
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", ProfileConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("SearchSetId", searchGuid, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("ProviderKey", ProviderKey, DataParameterType.NVarChar));

            // Might be good idea to signal if there are results at all
            DataService.Run(cmd);

            // Load results and return them back
            MetaStorageCollectionBase <Account> accounts = LoadSearchResults(searchGuid);

            if (accounts.Count > 0)
            {
                return(accounts[0]);
            }

            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Loads the by id.
        /// </summary>
        /// <param name="organizationId">The organization id.</param>
        /// <returns></returns>
        public static Organization LoadById(int organizationId)
        {
            Guid        searchGuid = Guid.NewGuid();
            DataCommand cmd        = ProfileDataHelper.CreateDataCommand();

            cmd.CommandText = String.Format("ecf_Search_{0}_OrganizationId", ProfileContext.Current.OrganizationMetaClass.Name);
            cmd.Parameters  = new DataParameters();
            cmd.Parameters.Add(new DataParameter("ApplicationId", ProfileConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("SearchSetId", searchGuid, DataParameterType.UniqueIdentifier));
            cmd.Parameters.Add(new DataParameter("OrganizationId", organizationId, DataParameterType.Int));

            // Might be good idea to signal if there are results at all
            DataService.Run(cmd);

            MetaStorageCollectionBase <Organization> orgs = LoadSearchResults(searchGuid);

            if (orgs.Count > 0)
            {
                return(orgs[0]);
            }

            // Load results and return them back
            return(null);
        }