Beispiel #1
0
        public ActionResult upDateSave(Book.Model.T_Base_Book book)
        {
            Book.BLL.T_Base_Book updatebook = new Book.BLL.T_Base_Book();
            int result = updatebook.upDate(book);

            return(Redirect("/Book/Index"));
        }
Beispiel #2
0
        public ActionResult UpdateSave(Book.Model.T_Base_Book book)
        {
            Book.BLL.T_Base_Book bll = new BLL.T_Base_Book();
            int result = bll.Update(book);

            return(Redirect("Index"));
        }
Beispiel #3
0
        public int Update(Book.Model.T_Base_Book book)
        {
            Book.DAL.T_Base_Book dal = new DAL.T_Base_Book();
            int result = dal.Update(book);

            return(result);
        }
Beispiel #4
0
 public int Add(Book.Model.T_Base_Book book)
 {
     Book.DAL.T_Base_Book dal = new DAL.T_Base_Book();
     //用DAL层提供的添加方法添加
     dal.Add(book);
     return(0);
 }
Beispiel #5
0
        public Book.Model.T_Base_Book GetModel(int Id)
        {
            SqlConnection co = new SqlConnection();

            co.ConnectionString = "server=10.132.239.3;uid=sa;pwd=Jsj123456;database=152111160209";
            co.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = co;
            cmd.CommandText = "select * from t_base_book where id=@Id";
            cmd.Parameters.AddWithValue("@Id", Id);
            SqlDataReader dr = cmd.ExecuteReader();

            Book.Model.T_Base_Book book = null;
            while (dr.Read())
            {
                book           = new Book.Model.T_Base_Book();
                book.Id        = Convert.ToInt32(dr["Id"]);
                book.BookName  = Convert.ToString(dr["BookName"]);
                book.PressName = Convert.ToString(dr["PressName"]);
                book.Author    = Convert.ToString(dr["Author"]);
                book.Version   = Convert.ToInt32(dr["Version"]);
                book.SN        = Convert.ToString(dr["SN"]);
                book.Price     = Convert.ToDecimal(dr["Price"]);
            }
            dr.Close();
            co.Close();
            return(book);
        }
Beispiel #6
0
        public int upDate(Book.Model.T_Base_Book book)
        {
            int result = 0;

            Book.DAL.T_Base_Book dal = new DAL.T_Base_Book();
            result = dal.upDate(book);
            return(result);
        }
Beispiel #7
0
        public int Add(Book.Model.T_Base_Book book)
        {
            SqlConnection co = new SqlConnection();

            co.ConnectionString = "server=10.132.239.3;uid=sa;pwd=Jsj123456;database=15211160113";
            co.Open();
            SqlCommand cm = new SqlCommand();

            cm.Connection  = co;
            cm.CommandText = "Insert into T_Base_Book(BookName,PressName,SN,Author,Version,Price) values (@BookName,@PressName,@SN,@Author,@Version,@Price)";
            cm.Parameters.AddWithValue("@BookName", book.BookName);
            cm.Parameters.AddWithValue("@PressName", book.PressName);
            cm.Parameters.AddWithValue("@SN", book.SN);
            cm.Parameters.AddWithValue("@Author", book.Author);
            cm.Parameters.AddWithValue("@Version", book.Version);
            cm.Parameters.AddWithValue("@Price", book.Price);
            int result = cm.ExecuteNonQuery();

            co.Close();
            return(result);
        }
Beispiel #8
0
        public int upDate(Book.Model.T_Base_Book book)
        {
            SqlConnection co = new SqlConnection();

            co.ConnectionString = "server=10.132.239.3;uid=sa;pwd=Jsj123456;database=152111160209";
            co.Open();
            SqlCommand cm = new SqlCommand();

            cm.Connection  = co;
            cm.CommandText = "update t_base_book set BookName=@BookName, Author=@Author, PressName=@PressName,[Version]=@Version,Price=@Price,SN=@SN where Id=@Id";
            cm.Parameters.AddWithValue("@BookName", book.BookName);
            cm.Parameters.AddWithValue("@Author", book.Author);
            cm.Parameters.AddWithValue("@PressName", book.PressName);
            cm.Parameters.AddWithValue("@Version", book.Version);
            cm.Parameters.AddWithValue("@Price", book.Price);
            cm.Parameters.AddWithValue("@SN", book.SN);
            cm.Parameters.AddWithValue("@Id", book.Id);
            int result = cm.ExecuteNonQuery();

            co.Close();
            return(result);
        }
Beispiel #9
0
 public ActionResult update(int Id)
 {
     Book.Model.T_Base_Book book = (new Book.BLL.T_Base_Book()).GetModel(Id);
     ViewBag.Book = book;
     return(View());
 }