Ejemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Garfield.Model.hr_position> DataTableToList(DataTable dt)
        {
            List <Garfield.Model.hr_position> modelList = new List <Garfield.Model.hr_position>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Garfield.Model.hr_position model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Garfield.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);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Garfield.Model.hr_position model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Garfield.Model.hr_position model)
 {
     return(dal.Add(model));
 }