コード例 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <XHD.Model.Sys_authority> DataTableToList(DataTable dt)
        {
            List <XHD.Model.Sys_authority> modelList = new List <XHD.Model.Sys_authority>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                XHD.Model.Sys_authority model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new XHD.Model.Sys_authority();
                    if (dt.Rows[n]["Role_id"] != null && dt.Rows[n]["Role_id"].ToString() != "")
                    {
                        model.Role_id = int.Parse(dt.Rows[n]["Role_id"].ToString());
                    }
                    if (dt.Rows[n]["Type"] != null && dt.Rows[n]["Type"].ToString() != "")
                    {
                        model.Type = int.Parse(dt.Rows[n]["Type"].ToString());
                    }
                    if (dt.Rows[n]["App_ids"] != null && dt.Rows[n]["App_ids"].ToString() != "")
                    {
                        model.App_ids = dt.Rows[n]["App_ids"].ToString();
                    }
                    if (dt.Rows[n]["Menu_ids"] != null && dt.Rows[n]["Menu_ids"].ToString() != "")
                    {
                        model.Menu_ids = dt.Rows[n]["Menu_ids"].ToString();
                    }
                    if (dt.Rows[n]["Button_ids"] != null && dt.Rows[n]["Button_ids"].ToString() != "")
                    {
                        model.Button_ids = dt.Rows[n]["Button_ids"].ToString();
                    }
                    if (dt.Rows[n]["Create_id"] != null && dt.Rows[n]["Create_id"].ToString() != "")
                    {
                        model.Create_id = int.Parse(dt.Rows[n]["Create_id"].ToString());
                    }
                    if (dt.Rows[n]["Create_date"] != null && dt.Rows[n]["Create_date"].ToString() != "")
                    {
                        model.Create_date = DateTime.Parse(dt.Rows[n]["Create_date"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
ファイル: Sys_authority.cs プロジェクト: chuing/Push114CRM
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<XHD.Model.Sys_authority> DataTableToList(DataTable dt)
 {
     List<XHD.Model.Sys_authority> modelList = new List<XHD.Model.Sys_authority>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         XHD.Model.Sys_authority model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new XHD.Model.Sys_authority();
             if(dt.Rows[n]["Role_id"]!=null && dt.Rows[n]["Role_id"].ToString()!="")
             {
                 model.Role_id=int.Parse(dt.Rows[n]["Role_id"].ToString());
             }
             if(dt.Rows[n]["App_ids"]!=null && dt.Rows[n]["App_ids"].ToString()!="")
             {
             model.App_ids=dt.Rows[n]["App_ids"].ToString();
             }
             if(dt.Rows[n]["Menu_ids"]!=null && dt.Rows[n]["Menu_ids"].ToString()!="")
             {
             model.Menu_ids=dt.Rows[n]["Menu_ids"].ToString();
             }
             if(dt.Rows[n]["Button_ids"]!=null && dt.Rows[n]["Button_ids"].ToString()!="")
             {
             model.Button_ids=dt.Rows[n]["Button_ids"].ToString();
             }
             if(dt.Rows[n]["Create_id"]!=null && dt.Rows[n]["Create_id"].ToString()!="")
             {
                 model.Create_id=int.Parse(dt.Rows[n]["Create_id"].ToString());
             }
             if(dt.Rows[n]["Create_date"]!=null && dt.Rows[n]["Create_date"].ToString()!="")
             {
                 model.Create_date=DateTime.Parse(dt.Rows[n]["Create_date"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
コード例 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(XHD.Model.Sys_authority model)
 {
     return(dal.Update(model));
 }
コード例 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(XHD.Model.Sys_authority model)
 {
     dal.Add(model);
 }