/// <summary> /// 获得数据列表 /// </summary> public List <DTcms.Model.Customer> DataTableToList(DataTable dt) { List <DTcms.Model.Customer> modelList = new List <DTcms.Model.Customer>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { DTcms.Model.Customer model; for (int n = 0; n < rowsCount; n++) { model = new DTcms.Model.Customer(); if (dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } model.Code = dt.Rows[n]["Code"].ToString(); model.Name = dt.Rows[n]["Name"].ToString(); model.LinkMan = dt.Rows[n]["LinkMan"].ToString(); model.LinkTel = dt.Rows[n]["LinkTel"].ToString(); model.LinkAddress = dt.Rows[n]["LinkAddress"].ToString(); model.Email = dt.Rows[n]["Email"].ToString(); model.Fax = dt.Rows[n]["Fax"].ToString(); if (dt.Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(dt.Rows[n]["Status"].ToString()); } model.Remark = dt.Rows[n]["Remark"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 获得数据列表 /// </summary> public List<DTcms.Model.Customer> DataTableToList(DataTable dt) { List<DTcms.Model.Customer> modelList = new List<DTcms.Model.Customer>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { DTcms.Model.Customer model; for (int n = 0; n < rowsCount; n++) { model = new DTcms.Model.Customer(); if (dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } model.Code = dt.Rows[n]["Code"].ToString(); model.Name = dt.Rows[n]["Name"].ToString(); model.LinkMan = dt.Rows[n]["LinkMan"].ToString(); model.LinkTel = dt.Rows[n]["LinkTel"].ToString(); model.LinkAddress = dt.Rows[n]["LinkAddress"].ToString(); model.Email = dt.Rows[n]["Email"].ToString(); model.Fax = dt.Rows[n]["Fax"].ToString(); if (dt.Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(dt.Rows[n]["Status"].ToString()); } model.Remark = dt.Rows[n]["Remark"].ToString(); modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DTcms.Model.Customer model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(DTcms.Model.Customer model) { return(dal.Add(model)); }