Exemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <returns>Admin集合</returns>
        public List <ClassLibrary.Model.Admin> GetModelList(string strWhere)
        {
            DataTable dt = GetData(strWhere);
            List <ClassLibrary.Model.Admin> modelList = new List <ClassLibrary.Model.Admin>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ClassLibrary.Model.Admin model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ClassLibrary.Model.Admin();
                    if (dt.Rows[n]["ID"] != DBNull.Value)
                    {
                        model.ID = Convert.ToInt32(dt.Rows[n]["ID"]);
                    }
                    if (dt.Rows[n]["UserName"] != DBNull.Value)
                    {
                        model.UserName = Convert.ToString(dt.Rows[n]["UserName"]);
                    }
                    if (dt.Rows[n]["Password"] != DBNull.Value)
                    {
                        model.Password = Convert.ToString(dt.Rows[n]["Password"]);
                    }
                    if (dt.Rows[n]["Power"] != DBNull.Value)
                    {
                        model.Power = Convert.ToString(dt.Rows[n]["Power"]);
                    }
                    if (dt.Rows[n]["CreatedTime"] != DBNull.Value)
                    {
                        model.CreatedTime = Convert.ToDateTime(dt.Rows[n]["CreatedTime"]);
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">model对象</param>
 public int Add(ClassLibrary.Model.Admin model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">model对象</param>
 /// <returns>影响行数</returns>
 public int Update(ClassLibrary.Model.Admin model)
 {
     return(dal.Update(model));
 }