/// <summary> /// 添加发放明细的方法 /// </summary> /// <param name="book">PlanBook实体类</param> /// <param name="nums">自定义的一个int类型的数组</param> public void InsertGrantBook(PlanBook book, int[] nums) { string str = string.Join(",", nums); string sql = string.Format("INSERT INTO GrantBook(PlanBookID, StudentInfoID, SchoolTermID, GetBookNum) SELECT {0} AS Expr1, StudentInfo.StudentInfoID , {1} AS Expr1, 1 AS Expr1 FROM StudentInfo where StudentInfo.StudentInfoID in({2})", book.PlanBookID, book.SchoolTermID, str); DBHelpers.UpdateInfo(sql); }
public void InsertStudentInfo(StudentInfoBusiness studentInfo) { string sql = "insert into StudentInfo values(@StudentClassID,@StudentName,@StudentNumber,@StudentSex,@StudentMarket)"; SqlParameter[] parameter = { new SqlParameter("@StudentClassID", studentInfo.StudentClassID), new SqlParameter("@StudentName", studentInfo.StudentName), new SqlParameter("@StudentNumber", studentInfo.StudentNumber), new SqlParameter("@StudentSex", studentInfo.StudentSex), new SqlParameter("@StudentMarket", studentInfo.StudentMarket) }; DBHelpers.UpdateInfo(sql, parameter); }
public void UpdateStudentInfo(StudentInfoBusiness studentInfo) { string sql = string.Format("update studentInfo set StudentClassID=@StudentClassID,StudentName=@StudentName,StudentNumber=@StudentNumber,StudentSex=@StudentSex,StudentMarket=@StudentMarket where StudentInfoID=@StudentInfoID"); SqlParameter[] parameter = { new SqlParameter("@StudentClassID", studentInfo.StudentClassID), new SqlParameter("@StudentName", studentInfo.StudentName), new SqlParameter("@StudentNumber", studentInfo.StudentNumber), new SqlParameter("@StudentSex", studentInfo.StudentSex), new SqlParameter("@StudentMarket", studentInfo.StudentMarket), new SqlParameter("@StudentInfoID", studentInfo.StudentInfoID) }; DBHelpers.UpdateInfo(sql, parameter); }
public void UpdateBookStock(BookStock bookstock) { string sql = "Update BookStock set ArriveQuantity=@ArriveQuantity,NoArriveQuantity=@NoArriveQuantity,NetPrice=@NetPrice,Discount=@Discount,Arrived='true' where BookStock.PlanBookID = (select PlanBook.PlanBookID from PlanBook where ISBN=@ISBN)"; SqlParameter[] parameter = { new SqlParameter("@ArriveQuantity", SqlDbType.Int), new SqlParameter("@NoArriveQuantity", SqlDbType.Int), new SqlParameter("@NetPrice", SqlDbType.Float), new SqlParameter("@Discount", SqlDbType.Float), new SqlParameter("@ISBN", SqlDbType.VarChar) }; parameter[0].Value = bookstock.ArriveQuantity; parameter[1].Value = bookstock.NoArriveQuantity; parameter[2].Value = bookstock.NetPrice; parameter[3].Value = bookstock.Discount; parameter[4].Value = bookstock.ISBN; DBHelpers.UpdateInfo(sql, parameter); }
/// <summary> /// 删除发放明细的方法 /// </summary> /// <param name="grantId">教材发放明细的编号</param> public void DeleteGrantBookByGrantID(int grantId) { string sql = string.Format("delete from GrantBook where GrantID={0}", grantId); DBHelpers.UpdateInfo(sql); }
/// <summary> /// 修改未到教材 /// </summary> /// <param name="txt"></param> public void UpdateBookStock(string txt) { string sql = string.Format("Update BookStock set ArriveQuantity+={0},NoArriveQuantity-={1} where StockBookID={2}", txt, txt, CommonStatic.BookStockID); DBHelpers.UpdateInfo(sql); }