Example #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Light.Model.roleinfo> DataTableToList(DataTable dt)
        {
            List <Light.Model.roleinfo> modelList = new List <Light.Model.roleinfo>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Light.Model.roleinfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Light.Model.roleinfo();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.rolename = dt.Rows[n]["rolename"].ToString();
                    model.remark   = dt.Rows[n]["remark"].ToString();
                    if (dt.Rows[n]["createman"].ToString() != "")
                    {
                        model.createman = int.Parse(dt.Rows[n]["createman"].ToString());
                    }
                    if (dt.Rows[n]["createtime"].ToString() != "")
                    {
                        model.createtime = DateTime.Parse(dt.Rows[n]["createtime"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Light.Model.roleinfo> DataTableToList(DataTable dt)
        {
            List<Light.Model.roleinfo> modelList = new List<Light.Model.roleinfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Light.Model.roleinfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Light.Model.roleinfo();
                                                    if(dt.Rows[n]["id"].ToString()!="")
                {
                    model.id=int.Parse(dt.Rows[n]["id"].ToString());
                }
                                                                                                                                                model.rolename= dt.Rows[n]["rolename"].ToString();
                                                                                                                                model.remark= dt.Rows[n]["remark"].ToString();
                                                                                                                if(dt.Rows[n]["createman"].ToString()!="")
                {
                    model.createman=int.Parse(dt.Rows[n]["createman"].ToString());
                }
                                                                                                                                if(dt.Rows[n]["createtime"].ToString()!="")
                {
                    model.createtime=DateTime.Parse(dt.Rows[n]["createtime"].ToString());
                }

                    modelList.Add(model);
                }
            }
            return modelList;
        }
Example #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Light.Model.roleinfo model)
 {
     return(dal.Update(model));
 }
Example #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void  Add(Light.Model.roleinfo model)
 {
     dal.Add(model);
 }