Example #1
0
 public static void LogItemAdd(int itemid, ItemAddType type, long count)
 {
     if (!TxtRecord)
     {
         return;
     }
     lock (ItemAdd)
     {
         try
         {
             if (ItemAdd.ContainsKey(itemid))
             {
                 ItemAdd[itemid][type] += count;
             }
             else
             {
                 Dictionary <ItemAddType, long> temp = new Dictionary <ItemAddType, long>();
                 foreach (object obj in Enum.GetValues(typeof(ItemAddType)))
                 {
                     temp.Add((ItemAddType)obj, 0);
                 }
                 ItemAdd[itemid] = temp;
                 temp[type]     += count;
             }
         }
         catch (Exception ex)
         {
             log.Error(ex);
         }
     }
 }
Example #2
0
        /// <summary>
        /// 添加商品到控件。
        /// </summary>
        /// <param name="gridControl"></param>
        /// <param name="itemList"></param>
        /// <param name="addType"></param>
        private void AddProductToDataGrid(Newegg.Oversea.Silverlight.Controls.Data.DataGrid gridControl, List <ProductItemVM> itemList, ItemAddType addType)
        {
            UCProductSearch ucPicker = new UCProductSearch();

            ucPicker.SelectionMode = SelectionMode.Multiple;
            StringBuilder sb = new StringBuilder();

            ucPicker.DialogHandler = CurrentWindow.ShowDialog(ECCentral.Portal.UI.MKT.Resources.ResBatchCreateSaleGift.Info_PickProducts, ucPicker, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    if (args.Data == null)
                    {
                        return;
                    }

                    List <ProductVM> selectedList = args.Data as List <ProductVM>;
                    foreach (ProductVM product in selectedList)
                    {
                        if (itemList.Where(p => p.ProductSysNo == product.SysNo).ToList().Count > 0)
                        {
                            sb.AppendLine(string.Format(ResBatchCreateSaleGift.ResourceManager.GetString("Warn_GoodsExsistInList", CurrentCulture), product.ProductID));
                            continue;
                        }

                        if (addType == ItemAddType.Product)
                        {
                            if (product.Status.Value != BizEntity.IM.ProductStatus.Active)
                            {
                                sb.AppendLine(string.Format(ECCentral.Portal.UI.MKT.Resources.ResBatchCreateSaleGift.Info_ProductMustBeActive, product.ProductID));//商品必须为上架商品。
                                continue;
                            }
                        }
                        else if (addType == ItemAddType.Gift)
                        {
                            if (product.Status.Value != BizEntity.IM.ProductStatus.InActive_UnShow)
                            {
                                sb.AppendLine(string.Format(ECCentral.Portal.UI.MKT.Resources.ResBatchCreateSaleGift.Info_ProductMustBeUnDisplay, product.ProductID));//商品必须为不展示商品。
                                continue;
                            }
                        }
                        else
                        {
                        }

                        ProductItemVM item = new ProductItemVM();
                        item.IsChecked     = false;
                        item.ProductID     = product.ProductID;
                        item.ProductSysNo  = product.SysNo;
                        item.ProductName   = product.ProductName;
                        item.AvailableQty  = product.AvailableQty;
                        item.ConsignQty    = product.ConsignQty;
                        item.UnitCost      = product.UnitCost;
                        item.CurrentPrice  = product.CurrentPrice;

                        itemList.Add(item);
                    }

                    gridControl.ItemsSource = itemList;

                    if (sb.Length > 0)
                    {
                        CurrentWindow.Alert(sb.ToString());
                    }
                }
            });
        }
Example #3
0
 public static void LogItemAdd(int itemid, ItemAddType type, long count)
 {
     if (!TxtRecord)
         return;
     lock (ItemAdd)
     {
         try
         {
             if (ItemAdd.ContainsKey(itemid))
             {
                 ItemAdd[itemid][type] += count;
             }
             else
             {
                 Dictionary<ItemAddType, long> temp = new Dictionary<ItemAddType, long>();
                 foreach (object obj in Enum.GetValues(typeof(ItemAddType)))
                 {
                     temp.Add((ItemAddType)obj, 0);
                 }
                 ItemAdd[itemid] = temp;
                 temp[type] += count;
             }
         }
         catch (Exception ex)
         {
             log.Error(ex);
         }
     }
 }