Ejemplo n.º 1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtSupplier_ID.Text))
            {
                strErr += "Supplier_ID格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int Product_ID  = int.Parse(this.lblProduct_ID.Text);
            int Supplier_ID = int.Parse(this.txtSupplier_ID.Text);


            ZhangWei.Model.Product_Supplier model = new ZhangWei.Model.Product_Supplier();
            model.Product_ID  = Product_ID;
            model.Supplier_ID = Supplier_ID;

            ZhangWei.BLL.Product_Supplier bll = new ZhangWei.BLL.Product_Supplier();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Ejemplo n.º 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            //if (!PageValidate.IsNumber(txtProductList_ID.Text))
            //{
            //    strErr += "ProductList_ID格式错误!\\n";
            //}
            if (DropDownList1.SelectedValue == "")
            {
                strErr += "请选择产品类别!\\n";
            }
            if (this.txtName.Text.Trim().Length == 0)
            {
                strErr += "名称不能为空!\\n";
            }
            //if (!PageValidate.IsNumber(txtProductSpec_ID.Text))
            //{
            //    strErr += "ProductSpec_ID格式错误!\\n";
            //}
            //if (!PageValidate.IsNumber(txtProductUnit_ID.Text))
            //{
            //    strErr += "ProductUnit_ID格式错误!\\n";
            //}
            if (!PageValidate.IsDecimal(txtPrice.Text))
            {
                strErr += "进价格式错误!应该为货币格式\\n";
            }
            //if (!PageValidate.IsNumber(txtEmployee_ID.Text))
            //{
            //    strErr += "Employee_ID格式错误!\\n";
            //}
            //if (!PageValidate.IsDateTime(txtCreateDate.Text))
            //{
            //    strErr += "CreateDate格式错误!\\n";
            //}
            //if (this.txtRemark.Text.Trim().Length == 0)
            //{
            //    strErr += "Remark不能为空!\\n";
            //}

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int Product_ID = int.Parse(this.lblProduct_ID.Text);
            //int ProductList_ID = int.Parse(this.txtProductList_ID.Text);
            int    ProductList_ID = int.Parse(this.DropDownList1.SelectedValue);
            string Name           = this.txtName.Text;
            //int ProductSpec_ID = int.Parse(this.txtProductSpec_ID.Text);
            int ProductSpec_ID = int.Parse(this.DropDownList2.SelectedValue);
            //int ProductUnit_ID = int.Parse(this.txtProductUnit_ID.Text);
            int      ProductUnit_ID = int.Parse(this.DropDownList3.SelectedValue);
            decimal  Price          = decimal.Parse(this.txtPrice.Text);
            decimal  Offering_Price = decimal.Parse(this.Offering_Price.Text);
            int      Employee_ID    = int.Parse(this.DropDownList4.SelectedValue);
            DateTime CreateDate     = DateTime.Parse(this.Label1.Text);
            string   Remark         = this.txtRemark.Text;
            string   shortname      = this.TextBox1.Text;


            ZhangWei.Model.Product model = new ZhangWei.Model.Product();
            model.Product_ID     = Product_ID;
            model.ProductList_ID = ProductList_ID;
            model.Name           = Name;
            model.ProductSpec_ID = ProductSpec_ID;
            model.ProductUnit_ID = ProductUnit_ID;
            model.Price          = Price;
            model.Offering_Price = Offering_Price;
            model.Employee_ID    = Employee_ID;
            model.CreateDate     = CreateDate;
            model.Remark         = Remark;
            model.spell          = spell.Text;
            model.s_spell        = s_spell.Text;
            model.shortname      = shortname;

            ZhangWei.BLL.Product bll = new ZhangWei.BLL.Product();
            bll.Update(model);
            ZhangWei.Model.Product_Supplier ml_ps = new BLL.Product_Supplier().GetModel(Product_ID);
            ZhangWei.BLL.Product_Supplier   bl_ps = new ZhangWei.BLL.Product_Supplier();
            ml_ps.Supplier_ID = Convert.ToInt32(this.DropDownList6.SelectedValue);
            bl_ps.Update(ml_ps);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }