Esempio n. 1
0
 private void ShowInfo(int Bid)
 {
     Shop.BLL.BookInfo   bll   = new Shop.BLL.BookInfo();
     Shop.Model.BookInfo model = bll.GetModel(Bid);
     this.lblBid.Text         = model.Bid.ToString();
     this.lblTitle.Text       = model.Title;
     this.lblTitleHot.Text    = model.TitleHot;
     this.lblPriceOld.Text    = model.PriceOld.ToString();
     this.lblPriceNew.Text    = model.PriceNew.ToString();
     this.lblAuthor.Text      = model.Author;
     this.lblPublisher.Text   = model.Publisher;
     this.lblPublishDate.Text = model.PublishDate.ToString();
     this.lblOnSaleDate.Text  = model.OnSaleDate.ToString();
     this.lblISBN.Text        = model.ISBN;
     this.lblTypeId.Text      = model.TypeId;
     this.lblDetails.Text     = model.Details;
     this.lblImgTitle.Text    = model.ImgTitle;
 }
Esempio n. 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtTitle.Text.Trim().Length == 0)
            {
                strErr += "Title不能为空!\\n";
            }
            if (this.txtTitleHot.Text.Trim().Length == 0)
            {
                strErr += "TitleHot不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtPriceOld.Text))
            {
                strErr += "PriceOld格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPriceNew.Text))
            {
                strErr += "PriceNew格式错误!\\n";
            }
            if (this.txtAuthor.Text.Trim().Length == 0)
            {
                strErr += "Author不能为空!\\n";
            }
            if (this.txtPublisher.Text.Trim().Length == 0)
            {
                strErr += "Publisher不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtPublishDate.Text))
            {
                strErr += "PublishDate格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtOnSaleDate.Text))
            {
                strErr += "OnSaleDate格式错误!\\n";
            }
            if (this.txtISBN.Text.Trim().Length == 0)
            {
                strErr += "ISBN不能为空!\\n";
            }
            if (this.txtTypeId.Text.Trim().Length == 0)
            {
                strErr += "TypeId不能为空!\\n";
            }
            if (this.txtDetails.Text.Trim().Length == 0)
            {
                strErr += "Details不能为空!\\n";
            }
            if (this.txtImgTitle.Text.Trim().Length == 0)
            {
                strErr += "ImgTitle不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      Bid         = int.Parse(this.lblBid.Text);
            string   Title       = this.txtTitle.Text;
            string   TitleHot    = this.txtTitleHot.Text;
            decimal  PriceOld    = decimal.Parse(this.txtPriceOld.Text);
            decimal  PriceNew    = decimal.Parse(this.txtPriceNew.Text);
            string   Author      = this.txtAuthor.Text;
            string   Publisher   = this.txtPublisher.Text;
            DateTime PublishDate = DateTime.Parse(this.txtPublishDate.Text);
            DateTime OnSaleDate  = DateTime.Parse(this.txtOnSaleDate.Text);
            string   ISBN        = this.txtISBN.Text;
            string   TypeId      = this.txtTypeId.Text;
            string   Details     = this.txtDetails.Text;
            string   ImgTitle    = this.txtImgTitle.Text;


            Shop.Model.BookInfo model = new Shop.Model.BookInfo();
            model.Bid         = Bid;
            model.Title       = Title;
            model.TitleHot    = TitleHot;
            model.PriceOld    = PriceOld;
            model.PriceNew    = PriceNew;
            model.Author      = Author;
            model.Publisher   = Publisher;
            model.PublishDate = PublishDate;
            model.OnSaleDate  = OnSaleDate;
            model.ISBN        = ISBN;
            model.TypeId      = TypeId;
            model.Details     = Details;
            model.ImgTitle    = ImgTitle;

            Shop.BLL.BookInfo bll = new Shop.BLL.BookInfo();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }