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

            if (rowsCount > 0)
            {
                XHD.Model.hr_position model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new XHD.Model.hr_position();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["position_name"] != null && dt.Rows[n]["position_name"].ToString() != "")
                    {
                        model.position_name = dt.Rows[n]["position_name"].ToString();
                    }
                    if (dt.Rows[n]["position_order"] != null && dt.Rows[n]["position_order"].ToString() != "")
                    {
                        model.position_order = int.Parse(dt.Rows[n]["position_order"].ToString());
                    }
                    if (dt.Rows[n]["position_level"] != null && dt.Rows[n]["position_level"].ToString() != "")
                    {
                        model.position_level = dt.Rows[n]["position_level"].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());
                    }
                    if (dt.Rows[n]["isDelete"] != null && dt.Rows[n]["isDelete"].ToString() != "")
                    {
                        model.isDelete = int.Parse(dt.Rows[n]["isDelete"].ToString());
                    }
                    if (dt.Rows[n]["Delete_time"] != null && dt.Rows[n]["Delete_time"].ToString() != "")
                    {
                        model.Delete_time = DateTime.Parse(dt.Rows[n]["Delete_time"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<XHD.Model.hr_position> DataTableToList(DataTable dt)
 {
     List<XHD.Model.hr_position> modelList = new List<XHD.Model.hr_position>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         XHD.Model.hr_position model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new XHD.Model.hr_position();
             if(dt.Rows[n]["id"]!=null && dt.Rows[n]["id"].ToString()!="")
             {
                 model.id=int.Parse(dt.Rows[n]["id"].ToString());
             }
             if(dt.Rows[n]["position_name"]!=null && dt.Rows[n]["position_name"].ToString()!="")
             {
             model.position_name=dt.Rows[n]["position_name"].ToString();
             }
             if(dt.Rows[n]["position_order"]!=null && dt.Rows[n]["position_order"].ToString()!="")
             {
             model.position_order=dt.Rows[n]["position_order"].ToString();
             }
             if(dt.Rows[n]["position_level"]!=null && dt.Rows[n]["position_level"].ToString()!="")
             {
             model.position_level=dt.Rows[n]["position_level"].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());
             }
             if(dt.Rows[n]["isDelete"]!=null && dt.Rows[n]["isDelete"].ToString()!="")
             {
                 model.isDelete=int.Parse(dt.Rows[n]["isDelete"].ToString());
             }
             if(dt.Rows[n]["Delete_time"]!=null && dt.Rows[n]["Delete_time"].ToString()!="")
             {
                 model.Delete_time=DateTime.Parse(dt.Rows[n]["Delete_time"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
예제 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(XHD.Model.hr_position model)
 {
     return(dal.Update(model));
 }
예제 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(XHD.Model.hr_position model)
 {
     return(dal.Add(model));
 }