static void Main(string[] args)
        {
            //get the cache object
            Cache cache = SAF.Cache.Cache.GetSAFCacheService();

            //add some objects into the cache service
            cache.AddObject("/WebApplication/Users/Xin", "customer xin");
            cache.AddObject("/WebApplication/Users/Mike", "customer mike");
            cache.AddObject("/WebApplication/Users/Steve", "customer steve");
            cache.AddObject("/WebApplication/GlobalData", "1/1/2003");

            //retrieve the objects as a group
            object[] objects = cache.RetrieveObjectList("/WebApplication/Users");
            foreach (object o in objects)
            {
                Console.WriteLine("Customer in cache: {0}", o.ToString());
            }

            //retrieve the object as individual
            string time = (string)cache.RetrieveObject("/WebApplication/GlobalData");
            string name = (string)cache.RetrieveObject("/WebApplication/Users/Xin");

            //remove the object
            cache.RemoveObject("/WebApplication/GlobalData");

            //remove all the object under /Users
            cache.RemoveObject("/WebApplication/Users");

            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }
Esempio n. 2
0
        public DALTradingPartnerSpecCertMetadata(CloudStorageAccount account)
        {
            this.account = account;

            TradingPartnerSpecCertTableName = RoleEnvironment.GetConfigurationSettingValue("Tenant.TradingPartnerSpecCertTableName");

            TradingPartnerSpecCerts = tradingPartnerSpecCertsCache.GetObject(CacheName) as List <TradingPartnerSpecCertMetadata>;

            if (TradingPartnerSpecCerts == null)
            {
                TradingPartnerSpecCerts = GetAllTradingPartnerSpecCert();
                tradingPartnerSpecCertsCache.AddObject(CacheName, TradingPartnerSpecCerts);
            }
        }
Esempio n. 3
0
        public DALBtsAssemblyFilesMetadata(CloudStorageAccount account)
        {
            this.account = account;

            MapFilesTableName = RoleEnvironment.GetConfigurationSettingValue("Tenant.BtsAssemblyFilesTableName");

            MapFiles = mapFilesCache.GetObject(CacheName) as List <BtsAssemblyFilesMetadata>;

            if (MapFiles == null)
            {
                MapFiles = GetAllBtsAssemblyFiles();
                mapFilesCache.AddObject(CacheName, MapFiles);
            }
        }
        public DALBizRuleCertMetadata(CloudStorageAccount account)
        {
            this.account = account;

            BizRuleCertTableName = RoleEnvironment.GetConfigurationSettingValue("Tenant.BizRuleCertTableName");

            BizRuleCerts = bizRuleCertsCache.GetObject(CacheName) as List <BizRuleCertMetadata>;

            if (BizRuleCerts == null)
            {
                BizRuleCerts = GetAllBizRuleCert();
                bizRuleCertsCache.AddObject(CacheName, BizRuleCerts);
            }
        }
Esempio n. 5
0
        public static BizRuleSet GetBizRuleSet(BizRuleCertMetadata bizRuleCertMetadata, IDalManager dalManager)
        {
            BizRuleSet bizRuleSet = gcSpecCertCache.GetObject(bizRuleCertMetadata.RuleCertFileName) as BizRuleSet;

            if (bizRuleSet == null)
            {
                Stream bizRuleStream = dalManager.GetBizRuleCert(bizRuleCertMetadata);

                if (bizRuleStream == null)
                {
                    throw new GCEdiValidatorException(string.Format("{0} BizRule not found.", bizRuleCertMetadata.RuleCertFileName));
                }

                GCExcelToBizRuleSet gcExcelToBizRuleSet = new GCExcelToBizRuleSet();

                bizRuleSet = gcExcelToBizRuleSet.GenerateBizRuleSet(bizRuleStream);

                gcBizRuleCertCache.AddObject(bizRuleCertMetadata.RuleCertFileName, bizRuleSet);
            }

            return(bizRuleSet);
        }
Esempio n. 6
0
        public static IDocumentPlug GetDocumentPlug(TradingPartnerSpecCertMetadata tradingPartnerSpecCertMetadata, IDalManager dalManager)
        {
            IDocumentPlug documentPlug = gcSpecCertCache.GetObject(tradingPartnerSpecCertMetadata.SchemaFileName) as IDocumentPlug;

            if (documentPlug == null)
            {
                Stream schemaStream = dalManager.GetTradingPartnerSpecCert(tradingPartnerSpecCertMetadata);

                if (schemaStream == null)
                {
                    throw new GCEdiValidatorException(string.Format("{0} Schema not found.", tradingPartnerSpecCertMetadata.SchemaFileName));
                }

                GCExcelToDocumentPlug gcExcelToDocumentPlug = GCExcelToDocumentPlug.CreateInstance((SpecCertFileType)tradingPartnerSpecCertMetadata.FileType);

                documentPlug = gcExcelToDocumentPlug.GenerateDocumentPlug(schemaStream, tradingPartnerSpecCertMetadata.TradingPartnerName,
                                                                          tradingPartnerSpecCertMetadata.DocumentType, tradingPartnerSpecCertMetadata.Direction, (SpecCertFileType)tradingPartnerSpecCertMetadata.FileType);

                gcSpecCertCache.AddObject(tradingPartnerSpecCertMetadata.SchemaFileName, documentPlug);
            }

            return(documentPlug);
        }
Esempio n. 7
0
        private void ChooseAddress_Load(object sender, EventArgs e)
        {
            uxCBAisle.SelectedIndex    = 0;
            uxCBShelf.SelectedIndex    = 0;
            uxCBSubshelf.SelectedIndex = 0;

            try
            {
                dsPhysicalInventory = new DataSetPhysicalInventory();
                cache.AddObject(CacheAddress.PhysicalInventoryData, dsPhysicalInventory);

                taWarehouseInventory      = new WarehouseInventoryTableAdapter();
                taWarehouseLocations      = new WarehouseLocationsTableAdapter();
                taPhysicalProgress        = new PhysicalProgressTableAdapter();
                taPhysicalProgressSummary = new PhysicalProgressSummaryTableAdapter();
                taEmployee = new EmployeeTableAdapter();

                cache.AddObject(CacheAddress.WarehouseInventoryTableAdapter, taWarehouseInventory);
                cache.AddObject(CacheAddress.WarehouseLocationsTableAdapter, taWarehouseLocations);
                cache.AddObject(CacheAddress.PhysicalProgressTableAdapter, taPhysicalProgress);
                cache.AddObject(CacheAddress.PhysicalProgressSummaryTableAdapter, taPhysicalProgressSummary);
                cache.AddObject(CacheAddress.EmployeeTableAdapter, taEmployee);
                cache.AddObject(CacheAddress.BeginPhysicalAisle, BeginPhysicalAisle);
                cache.AddObject(CacheAddress.BeginPhysicalShelf, BeginPhysicalShelf);
                cache.AddObject(CacheAddress.BeginPhysicalSubshelf, BeginPhysicalSubshelf);
                taWarehouseLocations.Fill(dsPhysicalInventory.WarehouseLocations);
            }
            catch (SqlException ex)
            {
                foreach (SqlError SQLErr in ex.Errors)
                {
                    MessageBox.Show(SQLErr.Message);
                }
            }
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            ConfigurationManager framConfMana = (ConfigurationManager)ConfigurationSettings.GetConfig("GreenFram");
            IList <string>       iocAopPath   = framConfMana.CoreConfig.GetIocAopPathList();

            Console.WriteLine("IocAop配置文件路径");
            foreach (var path in iocAopPath)
            {
                Console.WriteLine(path);
            }

            IList <string> autoIocAopPath = framConfMana.CoreConfig.GetIocAopPathList();

            Console.WriteLine("AutoIocAop配置文件路径");
            foreach (var path in iocAopPath)
            {
                Console.WriteLine(path);
            }

            IList <string> autoTablePath = framConfMana.CoreConfig.GetAutoTablePathList();

            Console.WriteLine("自动表配置文件路径");
            foreach (var path in autoTablePath)
            {
                Console.WriteLine(path);
            }

            Dictionary <string, IocConfigDto> iocDic = framConfMana.CoreConfig.GreenIocConfiguration.GetIocConfigList();

            Console.WriteLine("注入配置读取");
            foreach (var obj in iocDic)
            {
                Console.WriteLine(obj.Key + ":" + obj.Value.Type + ":" + obj.Value.Type);
                if (obj.Value.Propertys != null)
                {
                    foreach (var pro in obj.Value.Propertys)
                    {
                        Console.WriteLine("属性");
                        Console.WriteLine(pro.Key + ":" + pro.Type + ":" + pro.Value);
                    }
                }
            }
            Console.WriteLine("拦截配置读取");
            Dictionary <string, AopConfigDto> aopDic = framConfMana.CoreConfig.GreenAopConfiguration.GetAopConfigList();

            foreach (var obj in aopDic)
            {
                Console.WriteLine(obj.Key + ":" + obj.Value.Type + ":" + obj.Value.Type);
                if (obj.Value.Propertys != null)
                {
                    foreach (var pro in obj.Value.Propertys)
                    {
                        Console.WriteLine("属性");
                        Console.WriteLine(pro.Key + ":" + pro.Type + ":" + pro.Value);
                    }
                }
                if (obj.Value.Interceptors != null)
                {
                    foreach (var inter in obj.Value.Interceptors)
                    {
                        Console.WriteLine("拦截");
                        Console.WriteLine(inter);
                    }
                }
            }
            Console.WriteLine("数据库串读取");
            AppConfigurationManager appConfMana = (AppConfigurationManager)ConfigurationSettings.GetConfig("UserApplication");

            Console.WriteLine(appConfMana.DatabaseConfig.GetDatabaseConnection());

            Cache cache = Cache.GetSAFCacheService();

            Console.WriteLine("写入缓存");
            cache.AddObject("Student", new Student());
            Student student = (Student)cache.GetObject("Student");

            student.Say();
            Console.WriteLine("读取缓存");
            student.SayString("从缓存获得的我");

            Console.WriteLine("事件通知服务");
            Teacher     teacher = new Teacher();
            string      url     = framConfMana.EventNotificationConfig.GetEventServerUrl();
            EventClient client  = new EventClient(url);

            //client.SubscribeEvent("test1", new EventClient.EventProcessingHandler(Test1_EventReceiver));
            //client.SubscribeEvent("test2", new EventClient.EventProcessingHandler(Test2_EventReceiver));

            ////事件客户端发布或引发一些事件
            Console.WriteLine("张联珠发出的事件通知");
            client.RaiseEvent("test1", "张联珠发出的事件通知");
            Console.WriteLine("张联珠发出的事件通知1");
            client.RaiseEvent("test2", "张珠珠发出的事件通知1");

            Console.Read();
        }