Пример #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BookManageSystem.Model.CtbUserInformation GetModel(string userName)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" userName,userPwd,userPurview,userAllName,userSort ");
            strSql.Append(" from tbUserInformation ");
            strSql.Append(" where userName='******' ");
            BookManageSystem.Model.CtbUserInformation model = new BookManageSystem.Model.CtbUserInformation();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.userName    = ds.Tables[0].Rows[0]["userName"].ToString();
                model.userPwd     = ds.Tables[0].Rows[0]["userPwd"].ToString();
                model.userPurview = ds.Tables[0].Rows[0]["userPurview"].ToString();
                model.userAllName = ds.Tables[0].Rows[0]["userAllName"].ToString();
                model.userSort    = ds.Tables[0].Rows[0]["userSort"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(BookManageSystem.Model.CtbUserInformation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tbUserInformation set ");
            if (model.userPwd != null)
            {
                strSql.Append("userPwd='" + model.userPwd + "',");
            }
            if (model.userPurview != null)
            {
                strSql.Append("userPurview='" + model.userPurview + "',");
            }
            if (model.userAllName != null)
            {
                strSql.Append("userAllName='" + model.userAllName + "',");
            }
            if (model.userSort != null)
            {
                strSql.Append("userSort='" + model.userSort + "',");
            }
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where userName='******' ");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Пример #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(BookManageSystem.Model.CtbUserInformation model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.userName != null)
            {
                strSql1.Append("userName,");
                strSql2.Append("'" + model.userName + "',");
            }
            if (model.userPwd != null)
            {
                strSql1.Append("userPwd,");
                strSql2.Append("'" + model.userPwd + "',");
            }
            if (model.userPurview != null)
            {
                strSql1.Append("userPurview,");
                strSql2.Append("'" + model.userPurview + "',");
            }
            if (model.userAllName != null)
            {
                strSql1.Append("userAllName,");
                strSql2.Append("'" + model.userAllName + "',");
            }
            if (model.userSort != null)
            {
                strSql1.Append("userSort,");
                strSql2.Append("'" + model.userSort + "',");
            }
            strSql.Append("insert into tbUserInformation(");
            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());
        }
Пример #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <BookManageSystem.Model.CtbUserInformation> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List <BookManageSystem.Model.CtbUserInformation> modelList = new List <BookManageSystem.Model.CtbUserInformation>();
            int rowsCount = ds.Tables[0].Rows.Count;

            if (rowsCount > 0)
            {
                BookManageSystem.Model.CtbUserInformation model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model             = new BookManageSystem.Model.CtbUserInformation();
                    model.userName    = ds.Tables[0].Rows[n]["userName"].ToString();
                    model.userPwd     = ds.Tables[0].Rows[n]["userPwd"].ToString();
                    model.userPurview = ds.Tables[0].Rows[n]["userPurview"].ToString();
                    model.userAllName = ds.Tables[0].Rows[n]["userAllName"].ToString();
                    model.userSort    = ds.Tables[0].Rows[n]["userSort"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BookManageSystem.Model.CtbUserInformation model)
 {
     dal.Update(model);
 }
Пример #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(BookManageSystem.Model.CtbUserInformation model)
 {
     dal.Add(model);
 }