Esempio n. 1
0
        private void simpleBtnSave_Click(object sender, EventArgs e)
        {
            SortedList <List <AssembleItem>, List <AssembleDetail> > assembleItemList = assembleAdd1.GetAssembleItemList();

            if (assembleItemList == null || assembleItemList.Count == 0 || assembleItemList.Keys[0].Count == 0)
            {
                return;
            }

            //新建组合商品
            ReturnType type = ItemService.IsAssembleStockItemExisted(assembleItemList.Keys[0][0].OuterID, assembleItemList.Keys[0][0].SkuProps);

            if (type == ReturnType.NotExisted)
            {
                if (ItemService.AddAssembleItemDetails(assembleItemList.Keys[0], assembleItemList.Values[0]) == ReturnType.Success)
                {
                    XtraMessageBox.Show("新建组合商品成功", Constants.SYSTEM_PROMPT);
                }
                else
                {
                    XtraMessageBox.Show("新建组合商品失败", Constants.SYSTEM_PROMPT);
                }
                //清空组件值
                if (assembleAdd1.InitProps(false) == false)
                {
                    this.Close();
                }
            }
            else
            {
                if (type == ReturnType.PropertyExisted)
                {
                    XtraMessageBox.Show("组合属性重复,请重新选择", Constants.SYSTEM_PROMPT);
                }
                else
                {
                    XtraMessageBox.Show("商品编码重复,请重输", Constants.SYSTEM_PROMPT);
                }
            }
        }