/// <summary> /// 获得数据列表 /// </summary> public List<DTcms.Model.StoreOutCost> DataTableToList(DataTable dt) { List<DTcms.Model.StoreOutCost> modelList = new List<DTcms.Model.StoreOutCost>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { DTcms.Model.StoreOutCost model; for (int n = 0; n < rowsCount; n++) { model = new DTcms.Model.StoreOutCost(); if (dt.Rows[n]["StoreOutOrderId"].ToString() != "") { model.StoreOutOrderId = int.Parse(dt.Rows[n]["StoreOutOrderId"].ToString()); } model.Name = dt.Rows[n]["Name"].ToString(); if (dt.Rows[n]["Count"].ToString() != "") { model.Count = decimal.Parse(dt.Rows[n]["Count"].ToString()); } if (dt.Rows[n]["UnitPrice"].ToString() != "") { model.UnitPrice = decimal.Parse(dt.Rows[n]["UnitPrice"].ToString()); } if (dt.Rows[n]["TotalPrice"].ToString() != "") { model.TotalPrice = decimal.Parse(dt.Rows[n]["TotalPrice"].ToString()); } if (dt.Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(dt.Rows[n]["Status"].ToString()); } if (dt.Rows[n]["PaidTime"].ToString() != "") { model.PaidTime = DateTime.Parse(dt.Rows[n]["PaidTime"].ToString()); } model.Admin = dt.Rows[n]["Admin"].ToString(); model.Customer = dt.Rows[n]["Customer"].ToString(); if (dt.Rows[n]["HasBeenInvoiced"].ToString() != "") { if ((dt.Rows[n]["HasBeenInvoiced"].ToString() == "1") || (dt.Rows[n]["HasBeenInvoiced"].ToString().ToLower() == "true")) { model.HasBeenInvoiced = true; } else { model.HasBeenInvoiced = false; } } if (dt.Rows[n]["InvoicedTime"].ToString() != "") { model.InvoicedTime = DateTime.Parse(dt.Rows[n]["InvoicedTime"].ToString()); } model.InvoicedOperator = dt.Rows[n]["InvoicedOperator"].ToString(); model.Remark = dt.Rows[n]["Remark"].ToString(); modelList.Add(model); } } return modelList; }
public void AddStoreOutCost(StoreOutCost storeOutCost) { _storeOutCosts.Add(storeOutCost); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DTcms.Model.StoreOutCost model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(DTcms.Model.StoreOutCost model) { dal.Add(model); }
/// <summary> /// 获得数据列表 /// </summary> public List <DTcms.Model.StoreOutCost> DataTableToList(DataTable dt) { List <DTcms.Model.StoreOutCost> modelList = new List <DTcms.Model.StoreOutCost>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { DTcms.Model.StoreOutCost model; for (int n = 0; n < rowsCount; n++) { model = new DTcms.Model.StoreOutCost(); if (dt.Rows[n]["StoreOutOrderId"].ToString() != "") { model.StoreOutOrderId = int.Parse(dt.Rows[n]["StoreOutOrderId"].ToString()); } model.Name = dt.Rows[n]["Name"].ToString(); if (dt.Rows[n]["Count"].ToString() != "") { model.Count = decimal.Parse(dt.Rows[n]["Count"].ToString()); } if (dt.Rows[n]["UnitPrice"].ToString() != "") { model.UnitPrice = decimal.Parse(dt.Rows[n]["UnitPrice"].ToString()); } if (dt.Rows[n]["TotalPrice"].ToString() != "") { model.TotalPrice = decimal.Parse(dt.Rows[n]["TotalPrice"].ToString()); } if (dt.Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(dt.Rows[n]["Status"].ToString()); } if (dt.Rows[n]["PaidTime"].ToString() != "") { model.PaidTime = DateTime.Parse(dt.Rows[n]["PaidTime"].ToString()); } model.Admin = dt.Rows[n]["Admin"].ToString(); model.Customer = dt.Rows[n]["Customer"].ToString(); if (dt.Rows[n]["HasBeenInvoiced"].ToString() != "") { if ((dt.Rows[n]["HasBeenInvoiced"].ToString() == "1") || (dt.Rows[n]["HasBeenInvoiced"].ToString().ToLower() == "true")) { model.HasBeenInvoiced = true; } else { model.HasBeenInvoiced = false; } } if (dt.Rows[n]["InvoicedTime"].ToString() != "") { model.InvoicedTime = DateTime.Parse(dt.Rows[n]["InvoicedTime"].ToString()); } model.InvoicedOperator = dt.Rows[n]["InvoicedOperator"].ToString(); model.Remark = dt.Rows[n]["Remark"].ToString(); modelList.Add(model); } } return(modelList); }