/// <summary> /// 获得数据列表 /// </summary> public List <Garfield.Model.CRM_product_category> DataTableToList(DataTable dt) { List <Garfield.Model.CRM_product_category> modelList = new List <Garfield.Model.CRM_product_category>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Garfield.Model.CRM_product_category model; for (int n = 0; n < rowsCount; n++) { model = new Garfield.Model.CRM_product_category(); if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["product_category"] != null && dt.Rows[n]["product_category"].ToString() != "") { model.product_category = dt.Rows[n]["product_category"].ToString(); } if (dt.Rows[n]["parentid"] != null && dt.Rows[n]["parentid"].ToString() != "") { model.parentid = int.Parse(dt.Rows[n]["parentid"].ToString()); } if (dt.Rows[n]["product_icon"] != null && dt.Rows[n]["product_icon"].ToString() != "") { model.product_icon = dt.Rows[n]["product_icon"].ToString(); } if (dt.Rows[n]["isDelete"] != null && dt.Rows[n]["isDelete"].ToString() != "") { model.isDelete = int.Parse(dt.Rows[n]["isDelete"].ToString()); } if (dt.Rows[n]["Delete_id"] != null && dt.Rows[n]["Delete_id"].ToString() != "") { model.Delete_id = int.Parse(dt.Rows[n]["Delete_id"].ToString()); } if (dt.Rows[n]["Delete_time"] != null && dt.Rows[n]["Delete_time"].ToString() != "") { model.Delete_time = DateTime.Parse(dt.Rows[n]["Delete_time"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Garfield.Model.CRM_product_category model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Garfield.Model.CRM_product_category model) { return(dal.Add(model)); }