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

            if (rowsCount > 0)
            {
                Garfield.Model.hr_department model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Garfield.Model.hr_department();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["d_name"] != null && dt.Rows[n]["d_name"].ToString() != "")
                    {
                        model.d_name = dt.Rows[n]["d_name"].ToString();
                    }
                    if (dt.Rows[n]["parentid"] != null && dt.Rows[n]["parentid"].ToString() != "")
                    {
                        model.parentid = int.Parse(dt.Rows[n]["parentid"].ToString());
                    }
                    if (dt.Rows[n]["parentname"] != null && dt.Rows[n]["parentname"].ToString() != "")
                    {
                        model.parentname = dt.Rows[n]["parentname"].ToString();
                    }
                    if (dt.Rows[n]["d_type"] != null && dt.Rows[n]["d_type"].ToString() != "")
                    {
                        model.d_type = dt.Rows[n]["d_type"].ToString();
                    }
                    if (dt.Rows[n]["d_icon"] != null && dt.Rows[n]["d_icon"].ToString() != "")
                    {
                        model.d_icon = dt.Rows[n]["d_icon"].ToString();
                    }
                    if (dt.Rows[n]["d_fuzeren"] != null && dt.Rows[n]["d_fuzeren"].ToString() != "")
                    {
                        model.d_fuzeren = dt.Rows[n]["d_fuzeren"].ToString();
                    }
                    if (dt.Rows[n]["d_tel"] != null && dt.Rows[n]["d_tel"].ToString() != "")
                    {
                        model.d_tel = dt.Rows[n]["d_tel"].ToString();
                    }
                    if (dt.Rows[n]["d_fax"] != null && dt.Rows[n]["d_fax"].ToString() != "")
                    {
                        model.d_fax = dt.Rows[n]["d_fax"].ToString();
                    }
                    if (dt.Rows[n]["d_add"] != null && dt.Rows[n]["d_add"].ToString() != "")
                    {
                        model.d_add = dt.Rows[n]["d_add"].ToString();
                    }
                    if (dt.Rows[n]["d_email"] != null && dt.Rows[n]["d_email"].ToString() != "")
                    {
                        model.d_email = dt.Rows[n]["d_email"].ToString();
                    }
                    if (dt.Rows[n]["d_miaoshu"] != null && dt.Rows[n]["d_miaoshu"].ToString() != "")
                    {
                        model.d_miaoshu = dt.Rows[n]["d_miaoshu"].ToString();
                    }
                    if (dt.Rows[n]["d_order"] != null && dt.Rows[n]["d_order"].ToString() != "")
                    {
                        model.d_order = int.Parse(dt.Rows[n]["d_order"].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);
        }