Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.UserGoals> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.UserGoals> modelList = new List <LPWeb.Model.UserGoals>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.UserGoals model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.UserGoals();
                    if (dt.Rows[n]["GoalId"].ToString() != "")
                    {
                        model.GoalId = int.Parse(dt.Rows[n]["GoalId"].ToString());
                    }
                    if (dt.Rows[n]["UserId"].ToString() != "")
                    {
                        model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString());
                    }
                    if (dt.Rows[n]["LowRange"].ToString() != "")
                    {
                        model.LowRange = decimal.Parse(dt.Rows[n]["LowRange"].ToString());
                    }
                    if (dt.Rows[n]["MediumRange"].ToString() != "")
                    {
                        model.MediumRange = decimal.Parse(dt.Rows[n]["MediumRange"].ToString());
                    }
                    if (dt.Rows[n]["HighRange"].ToString() != "")
                    {
                        model.HighRange = decimal.Parse(dt.Rows[n]["HighRange"].ToString());
                    }
                    if (dt.Rows[n]["GoalType"].ToString() != "")
                    {
                        model.Month = int.Parse(dt.Rows[n]["Month"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LPWeb.Model.UserGoals model)
 {
     dal.Update(model);
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LPWeb.Model.UserGoals model)
 {
     return(dal.Add(model));
 }