protected void Button_OK_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (TextBox_ProductName.Text == "")
            {
                strErr += "拍品名称为空!\\n";
            }
            if (TextBox_Count.Text == "" || !PageValidate.IsNumber(TextBox_Count.Text))
            {
                strErr += "拍品数量为空或者不是数字!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            PawnProductModel model = bll.GetModel(PawnProductID);

            if (FileUpload_ProductImage.FileName != "")
            {
                string[] ProductImages;
                if (MagicWorldImageRule.SaveProductMainImage(PawnProductID, FileUpload_ProductImage.PostedFile, out ProductImages))
                {
                    model.SmallImage  = ProductImages[0];
                    model.MediumImage = ProductImages[1];
                    //model.LargeImage = ProductImages[2];
                }
                else
                {
                    MessageBox.Show(this, "图片上传失败");
                    return;
                }
            }


            model.PawnProductName = TextBox_ProductName.Text;
            model.PawnPrice       = Convert.ToDecimal(TextBox_PawnPrice.Text);
            model.SellingPrice    = Convert.ToDecimal(TextBox_SellingPrice.Text);
            model.Brief           = TextBox_Brief.Text;
            //model.Keywords = TextBox_Keyword.Text;
            model.Stock      = Convert.ToInt32(TextBox_Count.Text);
            model.ChangeTime = DateTime.Now;
            model.Status     = (int)PawnProductStatus.已收当;

            bll.Update(model);
            Response.Redirect("List.aspx");
        }
        protected void Button_Add_Click(object sender, EventArgs e)
        {
            string ErrorMessage = String.Empty;

            if (String.IsNullOrEmpty(TextBox_RentName.Text))
            {
                ErrorMessage += "商品名称不能为空\\n";
            }
            if (String.IsNullOrEmpty(TextBox_Stock.Text) || !PageValidate.IsNumber(TextBox_Stock.Text))
            {
                ErrorMessage += "商品数量不正确\\n";
            }
            if (String.IsNullOrEmpty(TextBox_Keywords.Text))
            {
                ErrorMessage += "关键词不能为空\\n";
            }
            if (String.IsNullOrEmpty(TextBox_RentPrice.Text) || !PageValidate.IsDecimal(TextBox_RentPrice.Text))
            {
                ErrorMessage += "出租价格不正确\\n";
            }
            if (String.IsNullOrEmpty(TextBox_CashPledge.Text) || !PageValidate.IsDecimal(TextBox_CashPledge.Text))
            {
                ErrorMessage += "出租押金不正确\\n";
            }
            if (String.IsNullOrEmpty(TextBox_MaxRentDays.Text) || !PageValidate.IsNumber(TextBox_MaxRentDays.Text))
            {
                ErrorMessage += "最大出租时间不正确\\n";
            }
            if (String.IsNullOrEmpty(TextBox_Brief.Text))
            {
                ErrorMessage += "商品简介不能为空\\n";
            }
            if (String.IsNullOrEmpty(FileUpload_MainImage.FileName))
            {
                ErrorMessage += "商品图片不能为空\\n";
            }

            if (!String.IsNullOrEmpty(ErrorMessage))
            {
                MessageBox.Show(this, ErrorMessage);
                return;
            }

            int RentID = CommDataHelper.GetNewSerialNum(AppType.MagicWorld);

            string[] ProductImages;
            if (MagicWorldImageRule.SaveProductMainImage(RentID, FileUpload_MainImage.PostedFile, out ProductImages))
            {
                RentProductModel model = new RentProductModel();

                model.RentID      = RentID;
                model.RentName    = TextBox_RentName.Text;
                model.Stock       = Convert.ToInt32(TextBox_Stock.Text);
                model.Keywords    = TextBox_Keywords.Text.Replace(",", ",");
                model.CashPledge  = Convert.ToDecimal(TextBox_CashPledge.Text);
                model.RentPrice   = Convert.ToDecimal(TextBox_RentPrice.Text);
                model.MaxRentTime = Convert.ToInt32(TextBox_MaxRentDays.Text);
                model.Brief       = TextBox_Brief.Text;
                model.SmallImage  = ProductImages[0];
                model.MediumImage = ProductImages[1];

                model.CategoryID   = CategoryID;
                model.CategoryPath = Hidden_CategoryPath.Value;
                model.CreateTime   = DateTime.Now;
                model.UpdateTime   = DateTime.Now;
                model.Status       = (int)RentProductStatus.申请中;

                new RentProductBll().Add(model);

                PageControler.Publish(7, true);

                Response.Redirect("List.aspx");
            }
            else
            {
                MessageBox.Show(this, "图片上传失败!");
            }
        }
        protected void Button_Edit_Click(object sender, EventArgs e)
        {
            string ErrorMessage = String.Empty;

            if (String.IsNullOrEmpty(TextBox_RentName.Text))
            {
                ErrorMessage += "商品名称不能为空\\n";
            }
            if (String.IsNullOrEmpty(TextBox_Stock.Text) || !PageValidate.IsNumber(TextBox_Stock.Text))
            {
                ErrorMessage += "商品数量不正确\\n";
            }
            if (String.IsNullOrEmpty(TextBox_Keywords.Text))
            {
                ErrorMessage += "关键词不能为空\\n";
            }
            if (String.IsNullOrEmpty(TextBox_RentPrice.Text) || !PageValidate.IsDecimal(TextBox_RentPrice.Text))
            {
                ErrorMessage += "出租价格不正确\\n";
            }
            if (String.IsNullOrEmpty(TextBox_MaxRentDays.Text) || !PageValidate.IsNumber(TextBox_MaxRentDays.Text))
            {
                ErrorMessage += "最大出租天数不正确\\n";
            }
            if (String.IsNullOrEmpty(TextBox_Brief.Text))
            {
                ErrorMessage += "商品简介不能为空\\n";
            }

            if (!String.IsNullOrEmpty(ErrorMessage))
            {
                MessageBox.Show(this, ErrorMessage);
                return;
            }

            RentProductModel rent = bll.GetModel(RentID);

            if (!String.IsNullOrEmpty(FileUpload_MainImage.FileName))
            {
                string[] ProductImages;

                if (MagicWorldImageRule.SaveProductMainImage(rent.RentID, FileUpload_MainImage.PostedFile, out ProductImages))
                {
                    rent.SmallImage  = ProductImages[0];
                    rent.MediumImage = ProductImages[1];
                }
                else
                {
                    MessageBox.Show(this, "图片上传失败");
                    return;
                }
            }

            rent.RentName    = TextBox_RentName.Text;
            rent.RentPrice   = Convert.ToDecimal(TextBox_RentPrice.Text);
            rent.MaxRentTime = Convert.ToInt32(TextBox_MaxRentDays.Text);
            rent.Stock       = Convert.ToInt32(TextBox_Stock.Text);
            rent.Keywords    = TextBox_Keywords.Text;
            rent.Brief       = TextBox_Brief.Text;

            bll.Update(rent);

            PageControler.Publish(7, true);
            Response.Redirect("List.aspx");
        }