예제 #1
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Ajax.Model.UserState> DataTableToList(DataTable dt)
 {
     List<Ajax.Model.UserState> modelList = new List<Ajax.Model.UserState>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Ajax.Model.UserState model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Ajax.Model.UserState();
             if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
             {
             model.ID=dt.Rows[n]["ID"].ToString();
             }
             if(dt.Rows[n]["Name"]!=null && dt.Rows[n]["Name"].ToString()!="")
             {
             model.Name=dt.Rows[n]["Name"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
예제 #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Ajax.Model.UserState> DataTableToList(DataTable dt)
        {
            List <Ajax.Model.UserState> modelList = new List <Ajax.Model.UserState>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Ajax.Model.UserState model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Ajax.Model.UserState();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = dt.Rows[n]["ID"].ToString();
                    }
                    if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
                    {
                        model.Name = dt.Rows[n]["Name"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Ajax.Model.UserState model)
 {
     return(dal.Update(model));
 }
예제 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Ajax.Model.UserState model)
 {
     dal.Add(model);
 }