Example #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <university.Model.CCOM.Agency> DataTableToList(DataTable dt)
        {
            List <university.Model.CCOM.Agency> modelList = new List <university.Model.CCOM.Agency>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                university.Model.CCOM.Agency model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new university.Model.CCOM.Agency();
                    if (dt.Rows[n]["Agency_id"].ToString() != "")
                    {
                        model.Agency_id = int.Parse(dt.Rows[n]["Agency_id"].ToString());
                    }
                    model.Agency_name = dt.Rows[n]["Agency_name"].ToString();
                    if (dt.Rows[n]["Agency_father"].ToString() != "")
                    {
                        model.Agency_father = int.Parse(dt.Rows[n]["Agency_father"].ToString());
                    }
                    if (dt.Rows[n]["Agency_type"].ToString() != "")
                    {
                        model.Agency_type = int.Parse(dt.Rows[n]["Agency_type"].ToString());
                    }
                    if (dt.Rows[n]["Agency_status"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Agency_status"].ToString() == "1") || (dt.Rows[n]["Agency_status"].ToString().ToLower() == "true"))
                        {
                            model.Agency_status = true;
                        }
                        else
                        {
                            model.Agency_status = false;
                        }
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(university.Model.CCOM.Agency model)
 {
     return(dal.Update(model));
 }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(university.Model.CCOM.Agency model)
 {
     return(dal.Add(model));
 }