/// <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); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(LPWeb.Model.UserGoals model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LPWeb.Model.UserGoals model) { return(dal.Add(model)); }