/// <summary> /// 获得数据列表 /// </summary> public List <CustomerService.Model.Argument> DataTableToList(DataTable dt) { List <CustomerService.Model.Argument> modelList = new List <CustomerService.Model.Argument>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { CustomerService.Model.Argument model; for (int n = 0; n < rowsCount; n++) { model = new CustomerService.Model.Argument(); if (dt.Rows[n]["GUID"] != null && dt.Rows[n]["GUID"].ToString() != "") { model.GUID = new Guid(dt.Rows[n]["GUID"].ToString()); } if (dt.Rows[n]["aName"] != null && dt.Rows[n]["aName"].ToString() != "") { model.aName = dt.Rows[n]["aName"].ToString(); } if (dt.Rows[n]["type"] != null && dt.Rows[n]["type"].ToString() != "") { model.type = dt.Rows[n]["type"].ToString(); } if (dt.Rows[n]["createDate"] != null && dt.Rows[n]["createDate"].ToString() != "") { model.createDate = DateTime.Parse(dt.Rows[n]["createDate"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(CustomerService.Model.Argument model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(CustomerService.Model.Argument model) { return(dal.Update(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List<CustomerService.Model.Argument> DataTableToList(DataTable dt) { List<CustomerService.Model.Argument> modelList = new List<CustomerService.Model.Argument>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { CustomerService.Model.Argument model; for (int n = 0; n < rowsCount; n++) { model = new CustomerService.Model.Argument(); if(dt.Rows[n]["GUID"]!=null && dt.Rows[n]["GUID"].ToString()!="") { model.GUID=new Guid(dt.Rows[n]["GUID"].ToString()); } if(dt.Rows[n]["aName"]!=null && dt.Rows[n]["aName"].ToString()!="") { model.aName=dt.Rows[n]["aName"].ToString(); } if(dt.Rows[n]["type"]!=null && dt.Rows[n]["type"].ToString()!="") { model.type=dt.Rows[n]["type"].ToString(); } if(dt.Rows[n]["createDate"]!=null && dt.Rows[n]["createDate"].ToString()!="") { model.createDate=DateTime.Parse(dt.Rows[n]["createDate"].ToString()); } modelList.Add(model); } } return modelList; }