/// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidationManager.Validate(this.LayoutRoot))
            {
                return;
            }
            GiftCardFabricationMaster  item = new GiftCardFabricationMaster();
            List <GiftCardFabrication> list = new List <GiftCardFabrication>();

            item             = VM.ConvertVM <GiftCardFabricationVM, GiftCardFabricationMaster>();
            item.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode;
            bool checkQuantity = false;

            foreach (GiftCardFabricationItemVM gift in gridVM)
            {
                GiftCardFabrication g = new GiftCardFabrication();
                g.Product           = new ProductInfo();
                g.Product.ProductID = gift.ProductID;
                g.Quantity          = gift.Quantity;
                g.Product.SysNo     = gift.ProductSysNo.Value;
                g.MasterSysNo       = VM.SysNo.Value;
                g.SysNo             = gift.SysNo.Value;
                list.Add(g);
                if (gift.Quantity < 0)
                {
                    checkQuantity = false;
                    break;
                }
                if (gift.Quantity > 0)
                {
                    checkQuantity = true;
                }
            }
            if (!checkQuantity)
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("每种面值的礼品卡数量都不能小于0,并且礼品卡总数量必须大于0!", MessageType.Error);
                return;
            }
            item.GiftCardFabricationList = list;
            facade.UpdateGiftCardFabrications(item, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                CPApplication.Current.CurrentPage.Context.Window.Alert(ResGiftCardInfo.Information_OperateSuccessful, MessageType.Information);
                if (Dialog != null)
                {
                    Dialog.ResultArgs.Data         = null;
                    Dialog.ResultArgs.DialogResult = DialogResultType.OK;
                    Dialog.Close();
                }
            });
        }