/// <summary> /// 获得数据列表 /// </summary> public List <ZhangWei.Model.SaleOrder> DataTableToList(DataTable dt) { List <ZhangWei.Model.SaleOrder> modelList = new List <ZhangWei.Model.SaleOrder>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZhangWei.Model.SaleOrder model; for (int n = 0; n < rowsCount; n++) { model = new ZhangWei.Model.SaleOrder(); if (dt.Rows[n]["SaleOrder_ID"] != null && dt.Rows[n]["SaleOrder_ID"].ToString() != "") { model.SaleOrder_ID = int.Parse(dt.Rows[n]["SaleOrder_ID"].ToString()); } if (dt.Rows[n]["WriteDate"] != null && dt.Rows[n]["WriteDate"].ToString() != "") { model.WriteDate = DateTime.Parse(dt.Rows[n]["WriteDate"].ToString()); } if (dt.Rows[n]["InsureDate"] != null && dt.Rows[n]["InsureDate"].ToString() != "") { model.InsureDate = DateTime.Parse(dt.Rows[n]["InsureDate"].ToString()); } if (dt.Rows[n]["EndDate"] != null && dt.Rows[n]["EndDate"].ToString() != "") { model.EndDate = DateTime.Parse(dt.Rows[n]["EndDate"].ToString()); } if (dt.Rows[n]["Dept_ID"] != null && dt.Rows[n]["Dept_ID"].ToString() != "") { model.Dept_ID = int.Parse(dt.Rows[n]["Dept_ID"].ToString()); } if (dt.Rows[n]["Customer_ID"] != null && dt.Rows[n]["Customer_ID"].ToString() != "") { model.Customer_ID = int.Parse(dt.Rows[n]["Customer_ID"].ToString()); } if (dt.Rows[n]["Employee_ID"] != null && dt.Rows[n]["Employee_ID"].ToString() != "") { model.Employee_ID = int.Parse(dt.Rows[n]["Employee_ID"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ZhangWei.Model.SaleOrder model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ZhangWei.Model.SaleOrder model) { return(dal.Add(model)); }