/// <summary> /// 获得数据列表 /// </summary> public List <RestaurantMIS.Model.PayOrderItem> DataTableToList(DataTable dt) { List <RestaurantMIS.Model.PayOrderItem> modelList = new List <RestaurantMIS.Model.PayOrderItem>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { RestaurantMIS.Model.PayOrderItem model; for (int n = 0; n < rowsCount; n++) { model = new RestaurantMIS.Model.PayOrderItem(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["PayOrderID"].ToString() != "") { model.PayOrderID = int.Parse(dt.Rows[n]["PayOrderID"].ToString()); } model.Category = dt.Rows[n]["Category"].ToString(); model.ItemName = dt.Rows[n]["ItemName"].ToString(); if (dt.Rows[n]["Price"].ToString() != "") { model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString()); } if (dt.Rows[n]["Amount"].ToString() != "") { model.Amount = int.Parse(dt.Rows[n]["Amount"].ToString()); } if (dt.Rows[n]["Sum"].ToString() != "") { model.Sum = decimal.Parse(dt.Rows[n]["Sum"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(RestaurantMIS.Model.PayOrderItem model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(RestaurantMIS.Model.PayOrderItem model) { dal.Add(model); }