/// <summary>
        /// Creates an instance
        /// </summary>
        /// <param name="artifactLinkType"></param>
        /// <param name="modelElement"></param>
        /// <param name="mappingTable"></param>
        /// <returns></returns>
        public static ArtifactLink CreateInstance(Type artifactLinkType, ModelElement modelElement, string mappingTable,
                                                  ICustomAttributeProvider attributeProvider)
        {
            Guard.ArgumentNotNull(artifactLinkType, "artifactLinkType");
            Guard.ArgumentNotNull(modelElement, "modelElement");
            Guard.ArgumentNotNull(attributeProvider, "attributeProvider");

            Tuple <Type, Guid, string> key = new Tuple <Type, Guid, string>(artifactLinkType, modelElement.Id, mappingTable);

            return(GlobalCache.AddOrGetExisting <ArtifactLink>(key.ToString(), k =>
            {
                ArtifactLink link = CreateLink(artifactLinkType, modelElement);
                if (!String.IsNullOrEmpty(mappingTable))
                {
                    try
                    {
                        link.Container = GetContainer(mappingTable, attributeProvider);
                        link.Path = GetProjectPath(mappingTable, link.Container);
                        link.Project = GetProject(modelElement, link.Container);
                    }
                    catch (Exception e)
                    {
                        Logger.Write(e);
                    }
                }
                return link;
            }));
        }
 public static object MortgageLoan_create(
     [ExcelArgument(Description = @"Balance Notional")] double Balance,
     [ExcelArgument(Description = @"Loan Rate")] double Rate,
     [ExcelArgument(Description = @"Loan Spread, Zero if It is a Fixed Rate Loan")]   double Spread,
     [ExcelArgument(Description = @"Maturity Period")] int Maturity,
     [ExcelArgument(Description = @"Rate Resetting Period, the same as Maturity if it is a Fixed Rate Loan")] int Resetting,
     [ExcelArgument(Description = @"Fixed (Fixed) or ARM (ARM)")] string FixedOrARM,
     [ExcelArgument(Description = @"Principal and Interest (PI) or Interest Only (IO)")] string PIOrIO,
     [ExcelArgument(Description = @"Libor Curve as an name")] string LiborCurve)
 {
     if (ExcelDnaUtil.IsInFunctionWizard())
     {
         return(ExcelError.ExcelErrorRef);
     }
     else
     {
         return(GlobalCache.CreateHandle(m_tag, new object[] { Balance, Rate, Spread, Maturity, Resetting, FixedOrARM, PIOrIO, LiborCurve, "MortgageLoan_create" },
                                         (objectType, parameters) =>
         {
             IMortgageLoan loan = construct_loan(Balance, Rate, Spread, Maturity, Resetting, FixedOrARM, PIOrIO, LiborCurve);
             if (loan == null)
             {
                 return ExcelError.ExcelErrorNull;
             }
             else
             {
                 return loan;
             }
         }));
     }
 }
Exemple #3
0
        private void Delete(Shop item)
        {
            if (item != null)
            {
                if (GlobalMessageBox.Show("删除后将查无店铺信息,确定删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    List <Shop>    list   = DataGridViewUtil.BindingListToList <Shop>(dataGridView1.DataSource);
                    InteractResult result = GlobalCache.ServerProxy.DeleteShop(item.ID);

                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("删除成功!");
                        GlobalCache.RemoveShop(item.ID);
                        this.dataGridView1.DataSource = null;
                        list.Remove(item);
                        this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList(list);
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Exemple #4
0
        protected override ValidationResult IsValid(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext)
        {
            ProductViewModel input = (ProductViewModel)validationContext.ObjectInstance;

            int filesCnt = 0;

            if (input.OldFileURLs != null)
            {
                var nonDeletedFiles = input.OldFileURLs.Where(p => !p.ShouldBeDeleted);
                filesCnt += nonDeletedFiles.Count();
            }


            if (input.ImageFiles != null)
            {
                filesCnt += input.ImageFiles.Count();
            }

            if (filesCnt >= GlobalCache.MinImgFilesCnt())
            {
                return(ValidationResult.Success);
            }
            else
            {
                return(new ValidationResult(ErrMsg));
            }
        }
Exemple #5
0
        public static async Task <IList <OldImage> > GetImageURLs(ProductDBModel product)
        {
            int size             = product?.ImageFilePaths?.Count ?? 0;
            IList <OldImage> ret = new List <OldImage>(size);

            for (int i = 0; i < size; i++)
            {
                FilePath filePath = product.ImageFilePaths?.ElementAt(i);
                string   fileName = filePath?.FileName;
                if (!String.IsNullOrEmpty(fileName))
                {
                    try
                    {
                        //ret[i] = (await GlobalCache.GetImageBlob(fileName)).Uri.AbsoluteUri;
                        string URL = (await GlobalCache.GetImageBlob(fileName)).Uri.AbsoluteUri;
                        ret.Add(new OldImage()
                        {
                            URL = URL, FPid = filePath.FilePathId
                        });
                    }
                    catch
                    {
                        //If we can't get the image, just return null. NBD
                        ret.Add(new OldImage(""));
                    }
                }
            }
            return(ret);
        }
Exemple #6
0
        private List <Transcript> GetCombinedCacheElements(GlobalCache cache1, GlobalCache cache2, out List <RegulatoryElement> combinedRegElements,
                                                           out List <Gene> combinedGenes, out List <SimpleInterval> combinedIntrons, out List <SimpleInterval> combinedMirnas, out List <string> combinedPeptides)
        {
            var combinedTranscripts = CombinedTranscripts(cache1, cache2);

            combinedRegElements = new List <RegulatoryElement>();
            combinedRegElements.AddRange(cache1.RegulatoryElements);
            combinedRegElements.AddRange(cache2.RegulatoryElements);
            combinedRegElements.Sort();
            Console.WriteLine($"combined regulatory elemements count:{combinedRegElements.Count}");

            combinedGenes = new List <Gene>();
            combinedGenes.AddRange(cache1.Genes);
            combinedGenes.AddRange(cache2.Genes);
            combinedGenes.Sort();
            Console.WriteLine($"combined genes count:{combinedGenes.Count}");

            combinedIntrons = new List <SimpleInterval>();
            combinedIntrons.AddRange(cache1.Introns);
            combinedIntrons.AddRange(cache2.Introns);
            //combinedIntrons.Sort();//should not be sorted as transcripts may access them via index : not sure
            Console.WriteLine($"combined introns count:{combinedIntrons.Count}");

            combinedMirnas = new List <SimpleInterval>();
            combinedMirnas.AddRange(cache1.MicroRnas);
            combinedMirnas.AddRange(cache2.MicroRnas);
            //combinedMirnas.Sort();//should not be sorted as transcripts may access them via index: not sure
            Console.WriteLine($"combined mirna count:{combinedMirnas.Count}");

            combinedPeptides = new List <string>();
            combinedPeptides.AddRange(cache1.PeptideSeqs);
            combinedPeptides.AddRange(cache2.PeptideSeqs);
            Console.WriteLine($"combined peptide count:{combinedPeptides.Count}");
            return(combinedTranscripts);
        }
Exemple #7
0
        public static object[,] DisplaySampleOptionDetails([ExcelArgument("the option handle", Name = "option handle")] string optHandle)
        {
            if (ExcelDnaUtil.IsInFunctionWizard())
            {
                return(new object[, ] {
                    { ExcelError.ExcelErrorRef }
                });
            }

            RandClass value;

            if (GlobalCache.TryGetObject(optHandle, out value))
            {
                try
                {
                    RandClass obj = (RandClass)value;
                    return(TradeFactory.GetInstanceAsync.Task.Result.DisplayRandClassDetails(obj).Result);
                }
                catch (Exception e)
                {
                    return(new object[, ] {
                        { e.Message }
                    });
                }
            }

            object[,] ret = { { "!Invalid Handle!" } };
            return(ret);
        }
Exemple #8
0
        public void GlobalCache_CtorAndIndexer_CorrectData()
        {
            //arrange
            IGlobalCache gc = new GlobalCache(_repo, 30);

            //act
            Action badKey = () => Console.Write(gc["NonEx"]);

            //assert
            badKey.Should().Throw <ArgumentOutOfRangeException>().WithMessage("*There is no 'NonEx' element in GlobalCache.*"); //*'s are wildcards

            gc.Count.Should().Be(8);
            gc["I1"].Should().BeOfType <int>();
            gc["I1"].Should().Be(0);
            gc["D1"].Should().BeOfType <DateTime>();
            gc["D1"].Should().Be(new DateTime(2010, 6, 20));
            gc["M1"].Should().BeOfType <decimal>();
            gc["M1"].Should().Be(20.5m);
            gc["S1"].Should().BeOfType <string>();
            gc["S1"].Should().Be("hello");
            gc["S2"].Should().BeNull(); //note the type is not known
            gc["S3"].Should().BeOfType <string>();
            gc["S3"].Should().Be("Jane");
            gc["I2"].Should().BeOfType <int>();
            gc["I2"].Should().Be(-5);
            gc["I3"].Should().BeOfType <int>();
            gc["I3"].Should().Be(3);
        }
Exemple #9
0
        private void Search()
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                List <GiftTicketTemplate> list = GlobalCache.ServerProxy.GetGiftTicketTemplates();

                foreach (var item in list)
                {
                    item.OperatorUserName = GlobalCache.GetUserName(item.OperatorUserID);
                }
                dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ListToBindingList(list));
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
Exemple #10
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && !dataGridView1.Rows[e.RowIndex].IsNewRow)
            {
                DataGridView view = (DataGridView)sender;
                List <Brand> list = null;
                if (dataGridView1.DataSource != null)
                {
                    list = DataGridViewUtil.BindingListToList <Brand>(dataGridView1.DataSource);
                }

                Brand Mitem = (Brand)list[e.RowIndex];

                /*  if (e.ColumnIndex == isDisableDataGridViewCheckBoxColumn.Index)
                 * {
                 *    Mitem.IsEnable = (bool)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
                 *    Mitem.IsDisable = !Mitem.IsEnable;
                 *    UpIsCheck(Mitem.AutoID, Mitem.IsDisable);
                 *    //  RefreshPage();
                 *    // baseButton1_Click(null,null);
                 *
                 *
                 * }
                 * else*/if (e.ColumnIndex == Column2.Index)
                {
                    Mitem.IsEnable  = (bool)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
                    Mitem.IsDisable = !Mitem.IsEnable;
                    UpIsCheck(Mitem.AutoID, Mitem.IsDisable);
                    //CommonGlobalCache. = GlobalCache.ServerProxy.GetEnableBrands().Data;
                    GlobalCache.UpdateBrand(Mitem);
                }
            }
        }
Exemple #11
0
        private async Task <FilePath> GetEmptyFilePath(ProductDBModel product)
        {
            FilePath oldFilePath = null; //just want to to get this to compile product.ImageFilePath;

            if (oldFilePath == null)     //hitherto there was no image saved
            {
                FilePath ret = new FilePath()
                {
                    ProductID = product.ID
                };
                _context.Add(ret);
                return(ret);
            }
            //If there was an image, let's delete it and return the existing object
            string oldFileName = oldFilePath.FileName;

            if (!string.IsNullOrWhiteSpace(oldFileName))
            {
                CloudBlockBlob blob = await GlobalCache.GetImageBlob(oldFileName); //delete the old file

                await blob.DeleteIfExistsAsync();
            }

            return(oldFilePath);
        }
Exemple #12
0
 //将绑定的RetailDetail源转换成RefundDetail
 private RetailDetail RetailDetailToRefundDetail(RetailDetail retailDetail, string orderID)
 {
     return(new RetailDetail()
     {
         RetailOrderID = orderID,
         CostumeID = retailDetail.CostumeID,
         CostumeName = GlobalCache.GetCostumeName(retailDetail.CostumeID),
         ColorName = retailDetail.ColorName,
         SizeName = retailDetail.SizeName,
         Discount = retailDetail.Discount,
         DiscountOrigin = retailDetail.DiscountOrigin,
         IsRefund = true,
         Price = retailDetail.Price,
         BuyCount = retailDetail.RefundCount * -1,
         BrandName = ValidateUtil.CheckNotNullValue(retailDetail.BrandName),
         OccureTime = dateTimePicker_Start.Value,
         //268 畅滞排行榜:商品退货后,零售金额变成0
         //20180820 summoney 修改为除以购买数量再乘以退货数量
         SumMoney = Math.Round(retailDetail.SumMoney * -1, 1, MidpointRounding.AwayFromZero),
         SumMoneyActual = Math.Round(retailDetail.SumMoneyActual * -1, 1, MidpointRounding.AwayFromZero),
         SizeDisplayName = retailDetail.SizeDisplayName,
         //retailDetail.RefundCount * retailDetail.Price * -1,
         CostPrice = retailDetail.CostPrice * -1,
         SumCost = retailDetail.RefundCount * retailDetail.CostPrice * -1,
         Remarks = retailDetail.Remarks,
         InSalesPromotion = retailDetail.InSalesPromotion,
         GiftTickets = retailDetail.GiftTickets,
         SalePrice = retailDetail.Price,
         RefundCount = retailDetail.RefundCount,
         GuideID = retailDetail.GuideID,
     });
 }
Exemple #13
0
        public ActionResult ClearCache(string type)
        {
            var clearSuccess = GlobalCache.GetCache().ClearCache(type);

            ViewBag.Message = clearSuccess ? $"clearing cash for {type} success" : $"clearing cash for {type} failed";
            return(RedirectToAction("Index"));
        }
Exemple #14
0
        public static string Handle(HttpRequest request)
        {
            try {
                //MemoryCache cache = MemoryCache.Default;
                GlobalCache.IncreaseInt();
                GlobalCache.AppendHistory();
                GlobalCache.Set("RequestType", request.RequestType);
                // var dict = cache.ToDictionary<string, object>(z => z); //Someone tell me how to use this properly.
                string cacheJson = GlobalCache.ToJson();
                string action    = "write";
                if (request.QueryString.AllKeys.Contains("action"))
                {
                    action = request.QueryString["action"];
                }
                if (action == "break")
                {
                    Logger.WriteButBreakCache(cacheJson);
                }
                else
                {
                    Logger.Write(cacheJson);
                }

                //Logger.WriteV2(cacheJson);
                return(cacheJson);
            } catch (Exception e) {
                Dictionary <string, string> returnDict = new Dictionary <string, string> {
                    { "error", "Woops" },
                    { "Exception", e.ToString() }
                };
                return(JsonConvert.SerializeObject(returnDict));
            }
        }
Exemple #15
0
        public ActionResult Books()
        {
            Book[] books = null;
            try
            {
                string endpointName = GlobalCache.GetResolvedString("LibraryServiceEndpoint");
                if (endpointName == null)
                {
                    throw new ApplicationException("Could not find 'LibraryServiceEndpoint' in configuration settings.");
                }
                Debug.WriteLine(string.Format("LibraryServiceEndpoint='{0}'", endpointName));

                // ---------------------------------------------------------
                //
                // ---------------------------------------------------------
                using (LibraryServiceClient proxy = new LibraryServiceClient(endpointName))
                {
                    proxy.List(null, out books);
                }
            }
            catch (Exception exp)
            {
                Request.PostError(exp, false);
            }

            return(PartialView(new List <Book>(books)));
        }
 /// <summary>
 /// 默认构造函数
 /// </summary>
 /// <param name="accountService">帐号服务接口</param>
 /// <param name="gloCache">全局缓存</param>
 public AccountController(IAccountService accountService,
                          GlobalCache gloCache)
 {
     this.accountService = accountService;
     this.gloCache       = gloCache;
     ViewBag.UserCount   = gloCache.UserCount();
 }
Exemple #17
0
        private void integralCtrl_Load(object sender, EventArgs e)
        {
            //获取积分参数信息并绑定文本

            List <ListItem <string> > config = GlobalCache.GetParameterConfig(ParameterConfigKey.IntegrationExchange);

            if (config != null && config.Count > 0)
            {
                this.numericUpDownIntegral.Value = Convert.ToDecimal(config[0].Value);
            }
            else
            {
                this.numericUpDownIntegral.Value = 0;
            }
            config = GlobalCache.GetParameterConfig(ParameterConfigKey.MoneyExchange);
            if (config != null && config.Count > 0)
            {
                this.numericUpDownMoneyExchange.Value = Convert.ToDecimal(config[0].Value);
            }
            else
            {
                this.numericUpDownMoneyExchange.Value = 100;
            }
            config = GlobalCache.GetParameterConfig(ParameterConfigKey.SupplierDiscount);
            if (config != null && config.Count > 0)
            {
                this.numericUpDownSupplierDiscount.Value = Convert.ToDecimal(config[0].Value);
            }
            else
            {
                this.numericUpDownSupplierDiscount.Value = 1;
            }
        }
Exemple #18
0
        public void GlobalCache_IncrementByOnMultiThreads_CorrectData()
        {
            //arrange
            IGlobalCache gc = new GlobalCache(_repo, 30);

            //act
            var t1 = Task.Run(() => { for (int i = 0; i < 10000; i++)
                                      {
                                          gc.IncrementValue("I1", 1);
                                      }
                              });
            var t2 = Task.Run(() => { for (int i = 0; i < 8000; i++)
                                      {
                                          gc.IncrementValue("I1", 2);
                                      }
                              });
            var t3 = Task.Run(() => { for (int i = 0; i < 5001; i++)
                                      {
                                          gc.IncrementValue("I1", -3);
                                      }
                              });

            Task.WaitAll(t1, t2, t3);

            //assert
            gc["I1"].Should().Be(10997); //10000 + 2*8000 - 3*5001
        }
Exemple #19
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var product = await _context.Products.SingleOrDefaultAsync(m => m.ID == id);

            if (!User.IsOwnProduct(product))
            {
                return(HiddenProductError());
            }

            if (await FailsLockedProductPolicy(product))
            {
                return(new ChallengeResult());
            }

            //EXP 9.6.17
            var filePaths = _context.FilePaths.Where(f => f.ProductID == id);

            foreach (FilePath fp in filePaths)
            {
                //This will be wasteful. Only significant if we have many images for a product
                if (!String.IsNullOrEmpty(fp.FileName))
                {
                    CloudBlockBlob blob = await GlobalCache.GetImageBlob(fp.FileName);

                    await blob.DeleteIfExistsAsync();
                }
            }
            _context.FilePaths.RemoveRange(filePaths);
            _context.Products.Remove(product);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public static object[,] MortgageLoan_CashFlows([ExcelArgument(Description = @"MortgageLoan Object")] string loan_)
        {
            IMortgageLoan loanout;

            GlobalCache.TryGetObject <IMortgageLoan>(loan_, out loanout);

            loanout.CashFlows();

            double[] BegBal      = loanout.Write(loanout.ReturnBegBalance());
            double[] Interest    = loanout.Write(loanout.ReturnInterest());
            double[] Principal   = loanout.Write(loanout.ReturnPrincipal());
            double[] Collections = loanout.Write(loanout.ReturnCashCollections());
            double[] EndBal      = loanout.Write(loanout.ReturnEndBalance());

            object[,] a = new object[MBSExcelDNA.Global.GlobalVar.GlobalMaxMortgageLoanMaturity, 5];
            for (int i = 0; i < (int)MBSExcelDNA.Global.GlobalVar.GlobalMaxMortgageLoanMaturity; i++)
            {
                a[i, 0] = BegBal[i];
                a[i, 1] = Interest[i];
                a[i, 2] = Principal[i];
                a[i, 3] = Collections[i];
                a[i, 4] = EndBal[i];
            }
            return(a);
        }
 public OfflineFileController(IRapidServerEngine engine, GlobalCache db)
 {
     this.rapidServerEngine = engine;
     this.globalCache = db;
     this.rapidServerEngine.FileController.FileRequestReceived += new ESPlus.Application.FileTransfering.CbFileRequestReceived(FileController_FileRequestReceived);
     this.rapidServerEngine.FileController.FileReceivingEvents.FileTransCompleted += new ESBasic.CbGeneric<ESPlus.FileTransceiver.TransferingProject>(FileReceivingEvents_FileTransCompleted);
     this.rapidServerEngine.FileController.FileSendingEvents.FileTransCompleted += new ESBasic.CbGeneric<ESPlus.FileTransceiver.TransferingProject>(FileSendingEvents_FileTransCompleted);
     this.rapidServerEngine.FileController.FileResponseReceived += new ESBasic.CbGeneric<ESPlus.FileTransceiver.TransferingProject, bool>(FileController_FileResponseReceived);
 }
        /// <summary>
        /// Creates a <see cref="RouteMappingHighLatencyLowCpu"/>
        /// </summary>
        public RouteMappingHighLatencyLowCpu()
        {
            m_lastStatusUpdate = ShortTime.Now;
            m_maxPendingMeasurements = 1000;
            m_routeLatency = OptimizationOptions.RoutingLatency;
            m_batchSize = OptimizationOptions.RoutingBatchSize;
            m_inboundQueue = new ConcurrentQueue<List<IMeasurement>>();

            m_task = new ScheduledTask(ThreadingMode.DedicatedBackground, ThreadPriority.AboveNormal);
            m_task.Running += m_task_Running;
            m_task.UnhandledException += m_task_UnhandledException;
            m_task.Disposing += m_task_Disposing;
            m_task.Start(m_routeLatency);

            m_onStatusMessage = x => { };
            m_onProcessException = x => { };
            m_globalCache = new GlobalCache(new Dictionary<IAdapter, Consumer>(), 0);
            RouteCount = m_globalCache.GlobalSignalLookup.Count(x => x != null);
        }
 /// <summary>
 /// Instances a new <see cref="RouteMappingDoubleBufferQueue"/>.
 /// </summary>
 public RouteMappingDoubleBufferQueue()
 {
     m_onStatusMessage = x => { };
     m_onProcessException = x => { };
     m_globalCache = new GlobalCache(new Dictionary<IAdapter, Consumer>(), 0);
     m_injectMeasurementsLocalCache = new LocalCache(this, null);
 }
        /// <summary>
        /// Patches the existing routing table with the supplied adapters.
        /// </summary>
        /// <param name="producerAdapters">all of the producers</param>
        /// <param name="consumerAdapters">all of the consumers</param>
        public void PatchRoutingTable(RoutingTablesAdaptersList producerAdapters, RoutingTablesAdaptersList consumerAdapters)
        {
            if (producerAdapters == null)
                throw new ArgumentNullException(nameof(producerAdapters));
            if (consumerAdapters == null)
                throw new ArgumentNullException(nameof(consumerAdapters));

            foreach (var producerAdapter in producerAdapters.NewAdapter)
            {
                IInputAdapter inputAdapter = producerAdapter as IInputAdapter;
                IActionAdapter actionAdapter = producerAdapter as IActionAdapter;
                if ((object)inputAdapter != null)
                    inputAdapter.NewMeasurements += Route;
                else if ((object)actionAdapter != null)
                    actionAdapter.NewMeasurements += Route;
            }

            foreach (var producerAdapter in producerAdapters.OldAdapter)
            {
                IInputAdapter inputAdapter = producerAdapter as IInputAdapter;
                IActionAdapter actionAdapter = producerAdapter as IActionAdapter;
                if ((object)inputAdapter != null)
                    inputAdapter.NewMeasurements -= Route;
                else if ((object)actionAdapter != null)
                    actionAdapter.NewMeasurements -= Route;
            }

            Dictionary<IAdapter, Consumer> consumerLookup = new Dictionary<IAdapter, Consumer>(m_globalCache.GlobalDestinationLookup);

            foreach (var consumerAdapter in consumerAdapters.NewAdapter)
            {
                consumerLookup.Add(consumerAdapter, new Consumer(consumerAdapter));
            }

            foreach (var consumerAdapter in consumerAdapters.OldAdapter)
            {
                consumerLookup.Remove(consumerAdapter);
            }

            m_globalCache = new GlobalCache(consumerLookup, m_globalCache.Version + 1);
            RouteCount = m_globalCache.GlobalSignalLookup.Count(x => x != null);

        }
        public void Initialize(GlobalCache db, IRapidServerEngine engine, OfflineFileController fileCtr)
        {
            this.globalCache = db;
            this.rapidServerEngine = engine;
            this.offlineFileController = fileCtr;

            this.rapidServerEngine.UserManager.SomeOneDisconnected += new ESBasic.CbGeneric<UserData, ESFramework.Server.DisconnectedType>(UserManager_SomeOneDisconnected);
            this.rapidServerEngine.ContactsController.BroadcastReceived += new ESBasic.CbGeneric<string, string, int, byte[]>(ContactsController_BroadcastReceived);
            this.rapidServerEngine.MessageReceived += new ESBasic.CbGeneric<string, int, byte[], string>(rapidServerEngine_MessageReceived);
        }
 public RemotingService(GlobalCache db ,IRapidServerEngine engine)
 {
     this.globalCache = db;
     this.rapidServerEngine = engine;
 }