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

            if (rowsCount > 0)
            {
                Hownet.Model.Items model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Items();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.Text = dt.Rows[n]["Text"].ToString();
                    if (dt.Rows[n]["ParentID"].ToString() != "")
                    {
                        model.ParentID = int.Parse(dt.Rows[n]["ParentID"].ToString());
                    }
                    model.FormName = dt.Rows[n]["FormName"].ToString();
                    if (dt.Rows[n]["IsModule"].ToString() != "")
                    {
                        model.IsModule = int.Parse(dt.Rows[n]["IsModule"].ToString());
                    }
                    if (dt.Rows[n]["Level"].ToString() != "")
                    {
                        model.Level = int.Parse(dt.Rows[n]["Level"].ToString());
                    }
                    if (dt.Rows[n]["Orders"].ToString() != "")
                    {
                        model.Orders = int.Parse(dt.Rows[n]["Orders"].ToString());
                    }
                    if (dt.Rows[n]["IsBar"].ToString() != "")
                    {
                        model.IsBar = int.Parse(dt.Rows[n]["IsBar"].ToString());
                    }
                    model.Parameter = dt.Rows[n]["Parameter"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.Items model)
 {
     dal.Update(model);
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.Items model)
 {
     return(dal.Add(model));
 }