/// <summary> /// 获得数据列表 /// </summary> public List <Leadin.Model.DesignTemplate> DataTableToList(DataTable dt) { List <Leadin.Model.DesignTemplate> modelList = new List <Leadin.Model.DesignTemplate>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Leadin.Model.DesignTemplate model; for (int n = 0; n < rowsCount; n++) { model = new Leadin.Model.DesignTemplate(); if (dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } model.Num = dt.Rows[n]["Num"].ToString(); model.Title = dt.Rows[n]["Title"].ToString(); model.SubTitle = dt.Rows[n]["SubTitle"].ToString(); model.StrKey = dt.Rows[n]["StrKey"].ToString(); model.Price = dt.Rows[n]["Price"].ToString(); model.Cycle = dt.Rows[n]["Cycle"].ToString(); model.DesignRemark = dt.Rows[n]["DesignRemark"].ToString(); model.PrintRemark = dt.Rows[n]["PrintRemark"].ToString(); model.DetailRemark = dt.Rows[n]["DetailRemark"].ToString(); model.ImgUrl = dt.Rows[n]["ImgUrl"].ToString(); model.Tools = dt.Rows[n]["Tools"].ToString(); if (dt.Rows[n]["SortNum"].ToString() != "") { model.SortNum = int.Parse(dt.Rows[n]["SortNum"].ToString()); } if (dt.Rows[n]["StateInfo"].ToString() != "") { model.StateInfo = int.Parse(dt.Rows[n]["StateInfo"].ToString()); } if (dt.Rows[n]["IsHot"].ToString() != "") { model.IsHot = int.Parse(dt.Rows[n]["IsHot"].ToString()); } if (dt.Rows[n]["IsIndex"].ToString() != "") { model.IsIndex = int.Parse(dt.Rows[n]["IsIndex"].ToString()); } if (dt.Rows[n]["IsRec"].ToString() != "") { model.IsRec = int.Parse(dt.Rows[n]["IsRec"].ToString()); } if (dt.Rows[n]["AddTime"].ToString() != "") { model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Leadin.Model.DesignTemplate model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Leadin.Model.DesignTemplate model) { return(dal.Add(model)); }