private void Connection_ProductArrayChanged(object sender, EventArgs e) { this.Products = new List <CashShopProductListElement>(); this.BeautyShopProducts = new List <CashShopProductListElement>(); this.ProductByProductID = new Dictionary <int, CashShopProductListElement>(this.Connection.ProductArray.Count); this.ProductByItemClass = new Dictionary <string, CashShopProductListElement>(this.Connection.ProductArray.Count); this.ProductByCashShopItemKey = new Dictionary <CashShopItemKey, CashShopProductListElement>(this.Connection.ProductArray.Count); try { foreach (Product product in this.Connection.ProductArray) { Log <CashShopService> .Logger.InfoFormat("product - {0} : {1} ", product.ProductNo, product.ProductID); CashShopProductListElement cashShopProductListElement = new CashShopProductListElement(product); this.Products.Add(cashShopProductListElement); if (this.ProductByProductID.ContainsKey(cashShopProductListElement.ProductNo)) { Log <CashShopService> .Logger.ErrorFormat("Duplicate ProductNo[{0}]", cashShopProductListElement.ProductNo); } else { this.ProductByProductID.Add(cashShopProductListElement.ProductNo, cashShopProductListElement); } if (!this.ProductByItemClass.ContainsKey(cashShopProductListElement.ProductID)) { this.ProductByItemClass.Add(cashShopProductListElement.ProductID, cashShopProductListElement); } CashShopItemKey key = new CashShopItemKey(cashShopProductListElement.ProductID, cashShopProductListElement.SalePrice, (int)cashShopProductListElement.ProductExpire); if (this.ProductByCashShopItemKey.ContainsKey(key)) { Log <CashShopService> .Logger.InfoFormat("Duplicate CashShopItemKey[{0}/{1}/{2}]", cashShopProductListElement.ProductID, cashShopProductListElement.SalePrice, cashShopProductListElement.ProductExpire); } else { this.ProductByCashShopItemKey.Add(key, cashShopProductListElement); } if (this.BeautyShopCategories.ContainsKey(cashShopProductListElement.CategoryNo)) { this.BeautyShopProducts.Add(cashShopProductListElement); } } Log <CashShopService> .Logger.Info("Product Changed!"); foreach (int serviceID in base.LookUp.FindIndex("FrontendServiceCore.FrontendService")) { BroadcastPacket op = BroadcastPacket.Create <ChangedCashShopMessage>(new ChangedCashShopMessage()); base.RequestOperation(serviceID, op); } } catch (Exception ex) { Log <CashShopService> .Logger.Error(ex); } }
private void Connection_CategoryArrayChanged(object sender, EventArgs e) { if (ServiceCore.FeatureMatrix.IsEnable("BeautyShopItemSyncNISMS")) { string @string = ServiceCore.FeatureMatrix.GetString("BeautyShopCategoryByNISMS"); string[] array = @string.Split(new char[] { ';' }); if (array.Count <string>() == 2) { this.BeautyShopCategoryName = array[0]; this.BeautyShopIgnoreCategoryName = array[1]; } } this.Categories = new List <CashShopCategoryListElement>(); this.BeautyShopCategories = new Dictionary <int, CashShopCategoryListElement>(); foreach (Category category in this.Connection.CategoryArray) { Log <CashShopService> .Logger.InfoFormat("category - {0} : {1} ", category.CategoryNo, category.CategoryName); this.Categories.Add(new CashShopCategoryListElement(category)); if (category.CategoryName.Equals(this.BeautyShopCategoryName)) { this.BeautyShopCategoryNo = category.CategoryNo; this.BeautyShopCategories.Add(category.CategoryNo, new CashShopCategoryListElement(category)); } if (this.BeautyShopCategories.ContainsKey(category.ParentCategoryNo)) { if (category.CategoryName.Equals(this.BeautyShopIgnoreCategoryName)) { this.BeautyShopIgnoreCategoryNo = category.CategoryNo; } else { this.BeautyShopCategories.Add(category.CategoryNo, new CashShopCategoryListElement(category)); } } } Log <CashShopService> .Logger.Info("Categories Changed!"); foreach (int serviceID in base.LookUp.FindIndex("FrontendServiceCore.FrontendService")) { BroadcastPacket op = BroadcastPacket.Create <ChangedCashShopMessage>(new ChangedCashShopMessage()); base.RequestOperation(serviceID, op); } }