Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BookManageSystem.Model.CtbBookSort GetModel(int bookSortID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" bookSortID,bookSortRemark ");
            strSql.Append(" from tbBookSort ");
            strSql.Append(" where bookSortID=" + bookSortID + " ");
            BookManageSystem.Model.CtbBookSort model = new BookManageSystem.Model.CtbBookSort();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["bookSortID"].ToString() != "")
                {
                    model.bookSortID = int.Parse(ds.Tables[0].Rows[0]["bookSortID"].ToString());
                }
                model.bookSortRemark = ds.Tables[0].Rows[0]["bookSortRemark"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(BookManageSystem.Model.CtbBookSort model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tbBookSort set ");
            if (model.bookSortRemark != null)
            {
                strSql.Append("bookSortRemark='" + model.bookSortRemark + "',");
            }
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where bookSortID=" + model.bookSortID + " ");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <BookManageSystem.Model.CtbBookSort> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List <BookManageSystem.Model.CtbBookSort> modelList = new List <BookManageSystem.Model.CtbBookSort>();
            int rowsCount = ds.Tables[0].Rows.Count;

            if (rowsCount > 0)
            {
                BookManageSystem.Model.CtbBookSort model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new BookManageSystem.Model.CtbBookSort();
                    if (ds.Tables[0].Rows[n]["bookSortID"].ToString() != "")
                    {
                        model.bookSortID = int.Parse(ds.Tables[0].Rows[n]["bookSortID"].ToString());
                    }
                    model.bookSortRemark = ds.Tables[0].Rows[n]["bookSortRemark"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(BookManageSystem.Model.CtbBookSort model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.bookSortID != null)
            {
                strSql1.Append("bookSortID,");
                strSql2.Append("" + model.bookSortID + ",");
            }
            if (model.bookSortRemark != null)
            {
                strSql1.Append("bookSortRemark,");
                strSql2.Append("'" + model.bookSortRemark + "',");
            }
            strSql.Append("insert into tbBookSort(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BookManageSystem.Model.CtbBookSort model)
 {
     dal.Update(model);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(BookManageSystem.Model.CtbBookSort model)
 {
     dal.Add(model);
 }