示例#1
0
        protected void btAdd_Click(object sender, EventArgs e)
        {
            BookInfoBLL    infoBLL    = new BookInfoBLL();
            BookInfoEntity infoEntity = new BookInfoEntity();

            infoEntity.TypeId       = int.Parse(hdTwoType.Value);
            infoEntity.BookCode     = txtBookCode.Text;
            infoEntity.BookName     = txtBookName.Text;
            infoEntity.BookPrice    = decimal.Parse(txtBookPrice.Text);
            infoEntity.BookDisCount = decimal.Parse(txtBookDisCount.Text);
            infoEntity.BookAuthor   = txtBookAuthor.Text;
            infoEntity.BookPress    = txtBookPress.Text;
            infoEntity.PressTime    = DateTime.Parse(txtPressTime.Text);
            infoEntity.PicPath      = hdPicPath.Value;
            infoEntity.SellCount    = 0;
            infoEntity.BookRemark   = txtBookRemark.Text;
            if (infoBLL.Add(infoEntity) == 1)
            {
                ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('添加成功!');</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('未知错误!');</script>");
            }
        }
示例#2
0
        public ActionResult Add(FormCollection fc)
        {
            BookInfo bk = new BookInfo();

            bk.BkName  = fc["BkName"];
            bk.BkPrice = Convert.ToDecimal(fc["BkPrice"]);
            bk.BkDate  = Convert.ToDateTime(fc["BkDate"]);
            bk.TypeId  = Convert.ToInt32(fc["BkType"]);
            BookInfoBLL.Add(bk);
            return(RedirectToAction("Index"));
        }
示例#3
0
        public ActionResult Add(BookInfo bookInfo)
        {
            bookInfoBLL.Add(bookInfo);

            return(Redirect(Url.Action("Index")));
        }