/// <summary> /// 搜索按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Search_Click(object sender, RoutedEventArgs e) { warehouseBase.WarehouseList.Clear(); List <WMS_Warehouse_Model> list = new List <WMS_Warehouse_Model>(); DataTable dt = WMS_Warehouse_Bll.Select_Warehouse(" WarehouseName = '" + SearchText.Text.Trim() + "'"); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Warehouse_Model wMS_Warehouse_Model = new WMS_Warehouse_Model { WarehouseName = dt.Rows[i]["WarehouseName"].ToString(), WarehouseNo = dt.Rows[i]["WarehouseNo"].ToString(), Remark = dt.Rows[i]["Remark"].ToString(), CreatPerson = dt.Rows[i]["CreatPerson"].ToString(), CreatTime = dt.Rows[i]["CreatTime"].ToString(), ModifyPerson = dt.Rows[i]["ModifyPerson"].ToString(), ModifyTime = dt.Rows[i]["ModifyTime"].ToString() }; list.Add(wMS_Warehouse_Model); } foreach (var model in list) { warehouseBase.WarehouseList.Add(model); } this.WarehouseDataGrid.ItemsSource = warehouseBase.WarehouseList; }
/// <summary> /// 获取列表 /// </summary> /// <returns></returns> public static List <WMS_Warehouse_Model> GetWarehouseList() { List <WMS_Warehouse_Model> list = new List <WMS_Warehouse_Model>(); DataTable dt = WMS_Warehouse_Bll.Select_Warehouse(string.Empty); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Warehouse_Model wms_Warehouse_Model = new WMS_Warehouse_Model { WarehouseName = dt.Rows[i]["WarehouseName"].ToString(), WarehouseNo = dt.Rows[i]["WarehouseNo"].ToString(), Remark = dt.Rows[i]["Remark"].ToString(), CreatPerson = dt.Rows[i]["CreatPerson"].ToString(), CreatTime = dt.Rows[i]["CreatTime"].ToString(), ModifyPerson = dt.Rows[i]["ModifyPerson"].ToString(), ModifyTime = dt.Rows[i]["ModifyTime"].ToString() }; list.Add(wms_Warehouse_Model); } return(list); }