Exemplo n.º 1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Garfield.Model.hr_post model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Garfield.Model.hr_post model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Garfield.Model.hr_post> DataTableToList(DataTable dt)
        {
            List <Garfield.Model.hr_post> modelList = new List <Garfield.Model.hr_post>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Garfield.Model.hr_post model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Garfield.Model.hr_post();
                    if (dt.Rows[n]["post_id"] != null && dt.Rows[n]["post_id"].ToString() != "")
                    {
                        model.post_id = int.Parse(dt.Rows[n]["post_id"].ToString());
                    }
                    if (dt.Rows[n]["post_name"] != null && dt.Rows[n]["post_name"].ToString() != "")
                    {
                        model.post_name = dt.Rows[n]["post_name"].ToString();
                    }
                    if (dt.Rows[n]["position_id"] != null && dt.Rows[n]["position_id"].ToString() != "")
                    {
                        model.position_id = int.Parse(dt.Rows[n]["position_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]["dep_id"] != null && dt.Rows[n]["dep_id"].ToString() != "")
                    {
                        model.dep_id = int.Parse(dt.Rows[n]["dep_id"].ToString());
                    }
                    if (dt.Rows[n]["depname"] != null && dt.Rows[n]["depname"].ToString() != "")
                    {
                        model.depname = dt.Rows[n]["depname"].ToString();
                    }
                    if (dt.Rows[n]["emp_id"] != null && dt.Rows[n]["emp_id"].ToString() != "")
                    {
                        model.emp_id = int.Parse(dt.Rows[n]["emp_id"].ToString());
                    }
                    if (dt.Rows[n]["emp_name"] != null && dt.Rows[n]["emp_name"].ToString() != "")
                    {
                        model.emp_name = dt.Rows[n]["emp_name"].ToString();
                    }
                    if (dt.Rows[n]["default_post"] != null && dt.Rows[n]["default_post"].ToString() != "")
                    {
                        model.default_post = int.Parse(dt.Rows[n]["default_post"].ToString());
                    }
                    if (dt.Rows[n]["note"] != null && dt.Rows[n]["note"].ToString() != "")
                    {
                        model.note = dt.Rows[n]["note"].ToString();
                    }
                    if (dt.Rows[n]["post_descript"] != null && dt.Rows[n]["post_descript"].ToString() != "")
                    {
                        model.post_descript = dt.Rows[n]["post_descript"].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);
        }