Ejemplo n.º 1
0
        /// <summary>
        /// The constructor will bootstrap the functionality of this factory
        /// class. The cache will be consulted for the desired data and made
        /// available via C# models. If the cache does not exist, Jira will be
        /// queried for the necessary data, then cached locally.
        /// </summary>
        ///
        /// <param name="jira">A reference to a JiraInterface object to make API calls to a Jira server</param>
        public FieldFactory(JiraInterface jira)
        {
            List = new List <FieldsModel>();
            Jira = jira;
            string path = HostingEnvironment.ApplicationPhysicalPath + DB_FILE;

            //Try reading from the database file, or create it if it doesn't exist
            try {
                SR = new StreamReader(path);

                if (!cacheUpdated())
                {
                    updateCache();
                }
                else
                {
                    extractFields();
                }
            } catch (Exception) {
                FileStream stream = new FileStream(path, FileMode.Create);
                SW = new StreamWriter(stream);
                updateCache();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The constructor will bootstrap the functionality of this factory
        /// class. The cache will be consulted for the desired data and made
        /// available via C# models. If the cache does not exist, Jira will be
        /// queried for the necessary data, then cached locally.
        /// </summary>
        /// 
        /// <param name="jira">A reference to a JiraInterface object to make API calls to a Jira server</param>
        public FieldFactory(JiraInterface jira)
        {
            List = new List<FieldsModel>();
            Jira = jira;
            string path = HostingEnvironment.ApplicationPhysicalPath + DB_FILE;

            //Try reading from the database file, or create it if it doesn't exist
            try {
                SR = new StreamReader(path);

                if (!cacheUpdated()) {
                    updateCache();
                } else {
                    extractFields();
                }
            } catch (Exception) {
                FileStream stream = new FileStream(path, FileMode.Create);
                SW = new StreamWriter(stream);
                updateCache();
            }
        }