예제 #1
0
        private void AddProductEventHandler(object sender, ProductEventArgs e)
        {
            ProductModel productModel = bllProduct.GetModelByCode(e.ProductCode);

            if (productModel != null)
            {
                this.View.ShowMessageDialog("系统已存在产品编码为" + e.ProductCode + "的产品!");
                return;
            }
            ProductModel product = new ProductModel();

            product.FullTrayNum = e.FullNum;
            product.ProductCode = e.ProductCode;
            product.ProductName = e.ProductName;
            product.ProductUnit = e.ProductUnit;
            int addStatus = bllProduct.Add(product);

            if (addStatus != 1)
            {
                List <ProductModel> allProduct = bllProduct.GetModelList("");
                this.View.ShowProductData(allProduct);
                if (mainPre != null)
                {
                    mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, ECAMSModel.EnumLogType.提示, "产品添加成功!");
                }
                else
                {
                    mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, ECAMSModel.EnumLogType.提示, "产品添加失败!");
                }
            }
        }
예제 #2
0
        private void SaveProductEventHandler(object sender, ProductEventArgs e)
        {
            //ProductModel productModel = bllProduct.GetModelByCode(e.ProductCode);
            //if (productModel != null)
            //{
            //    this.View.ShowMessageDialog("系统已存在产品编码为" + e.ProductCode + "的产品!");
            //    return;
            //}
            ProductModel updateModel = new ProductModel();

            updateModel.ProductCode = e.ProductCode;
            updateModel.ProductName = e.ProductName;
            updateModel.ProductUnit = e.ProductUnit;
            updateModel.FullTrayNum = e.FullNum;
            bool status = bllProduct.UpdateByCode(updateModel);

            if (status == true)
            {
                List <ProductModel> allProduct = bllProduct.GetModelList("");
                this.View.ShowProductData(allProduct);
                this.View.ShowMessageDialog("更新产品成功!");
            }
            else
            {
                this.View.ShowMessageDialog("更新产品失败!");
            }
        }