/// <summary> /// 获得数据列表 /// </summary> public List<DTcms.Model.StoreInCost> DataTableToList(DataTable dt) { List<DTcms.Model.StoreInCost> modelList = new List<DTcms.Model.StoreInCost>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { DTcms.Model.StoreInCost model; for (int n = 0; n < rowsCount; n++) { model = new DTcms.Model.StoreInCost(); if (dt.Rows[n]["StoreInOrderId"].ToString() != "") { model.StoreInOrderId = int.Parse(dt.Rows[n]["StoreInOrderId"].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 AddStoreInCost(StoreInCost storeInCost) { _storeInCosts.Add(storeInCost); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DTcms.Model.StoreInCost model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(DTcms.Model.StoreInCost model) { dal.Add(model); }
/// <summary> /// 获得数据列表 /// </summary> public List <DTcms.Model.StoreInCost> DataTableToList(DataTable dt) { List <DTcms.Model.StoreInCost> modelList = new List <DTcms.Model.StoreInCost>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { DTcms.Model.StoreInCost model; for (int n = 0; n < rowsCount; n++) { model = new DTcms.Model.StoreInCost(); if (dt.Rows[n]["StoreInOrderId"].ToString() != "") { model.StoreInOrderId = int.Parse(dt.Rows[n]["StoreInOrderId"].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); }