/// <summary> /// 获得数据列表 /// </summary> public List <WebApi_Model.Orders> DataTableToList(DataTable dt) { List <WebApi_Model.Orders> modelList = new List <WebApi_Model.Orders>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { WebApi_Model.Orders model; for (int n = 0; n < rowsCount; n++) { model = new WebApi_Model.Orders(); if (dt.Rows[n]["Kid"] != null && dt.Rows[n]["Kid"].ToString() != "") { model.Kid = int.Parse(dt.Rows[n]["Kid"].ToString()); } if (dt.Rows[n]["CustomerKid"] != null && dt.Rows[n]["CustomerKid"].ToString() != "") { model.CustomerKid = int.Parse(dt.Rows[n]["CustomerKid"].ToString()); } if (dt.Rows[n]["OrderNumber"] != null && dt.Rows[n]["OrderNumber"].ToString() != "") { model.OrderNumber = dt.Rows[n]["OrderNumber"].ToString(); } if (dt.Rows[n]["TotalPrice"] != null && dt.Rows[n]["TotalPrice"].ToString() != "") { model.TotalPrice = decimal.Parse(dt.Rows[n]["TotalPrice"].ToString()); } if (dt.Rows[n]["AddTime"] != null && dt.Rows[n]["AddTime"].ToString() != "") { model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(WebApi_Model.Orders model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(WebApi_Model.Orders model) { return(dal.Add(model)); }