Exemplo n.º 1
0
        public static CompanyQualification GetCompanyQualification(int qualificationID, bool useCache)
        {
            CompanyQualification qualification = null;
            string cacheKey = CacheKeyManager.GetQualificationKey(qualificationID);

            if (useCache)
            {
                if (HttpContext.Current != null)
                {
                    qualification = HttpContext.Current.Items[cacheKey] as CompanyQualification;
                }
                if (qualification != null)
                {
                    return(qualification);
                }
                qualification = HHCache.Instance.Get(cacheKey) as CompanyQualification;
            }
            if (qualification == null)
            {
                qualification = CommonDataProvider.Instance.GetQualification(qualificationID);
                if (!useCache)
                {
                    return(qualification);
                }
                if (HttpContext.Current != null)
                {
                    HttpContext.Current.Items[cacheKey] = qualification;
                }
                HHCache.Instance.Insert(cacheKey, qualification);
            }
            return(qualification);
        }
Exemplo n.º 2
0
        public static void AddFile(CompanyQualification qualification, Stream contentStream)
        {
            string name = GlobalSettings.EnsureHtmlEncoded(qualification.QualificationName) + ".rar";

            qualification.QualificationFile = MakePath(qualification.CompanyID);
            //事件触发
            FileStorageProvider fs = new FileStorageProvider(FileStoreKey);

            fs.AddUpdateFile(MakePath(qualification.CompanyID), name, contentStream);



            qualification.QualificationID = CommonDataProvider.Instance.CreateQualification(qualification);

            HHCache.Instance.Remove(CacheKeyManager.GetQualificationKey(qualification.QualificationID));

            //事件触发
        }
Exemplo n.º 3
0
        public static void EditFile(CompanyQualification qualification, Stream contentStream)
        {
            string name = GlobalSettings.EnsureHtmlEncoded(qualification.QualificationName) + ".rar";

            if (contentStream == null)
            {
                IStorageFile file = FileStorageProvider.Instance(CompanyQualifications.FileStoreKey)
                                    .GetFile(CompanyQualifications.MakePath(qualification.CompanyID), GlobalSettings.EnsureHtmlEncoded(qualification.QualificationFile) + ".rar");
                contentStream = file.OpenReadStream();
            }
            //事件触发
            FileStorageProvider fs = new FileStorageProvider(FileStoreKey);

            fs.AddUpdateFile(MakePath(qualification.CompanyID), name, contentStream);

            qualification.QualificationFile = MakePath(qualification.CompanyID);
            CommonDataProvider.Instance.UpdateQualification(qualification);

            HHCache.Instance.Remove(CacheKeyManager.GetQualificationKey(qualification.QualificationID));

            //事件触发
        }