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

            if (rowsCount > 0)
            {
                Model.tb_type model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.tb_type();
                    if (dt.Rows[n]["t_id"] != null && dt.Rows[n]["t_id"].ToString() != "")
                    {
                        model.t_id = int.Parse(dt.Rows[n]["t_id"].ToString());
                    }
                    if (dt.Rows[n]["t_paid"] != null && dt.Rows[n]["t_paid"].ToString() != "")
                    {
                        model.t_paid = int.Parse(dt.Rows[n]["t_paid"].ToString());
                    }
                    if (dt.Rows[n]["t_no"] != null && dt.Rows[n]["t_no"].ToString() != "")
                    {
                        model.t_no = dt.Rows[n]["t_no"].ToString();
                    }
                    if (dt.Rows[n]["t_name"] != null && dt.Rows[n]["t_name"].ToString() != "")
                    {
                        model.t_name = dt.Rows[n]["t_name"].ToString();
                    }
                    if (dt.Rows[n]["t_desc"] != null && dt.Rows[n]["t_desc"].ToString() != "")
                    {
                        model.t_desc = dt.Rows[n]["t_desc"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.tb_type model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Model.tb_type model)
 {
     return(dal.Add(model));
 }