/// <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> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Delete_Click(object sender, RoutedEventArgs e) { foreach (var no in selectWarehouseName) { WMS_Warehouse_Bll.Delete_Warehouse(" WarehouseName = '" + no + "'"); } Page_Frush(); }
/// <summary> /// 保存按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Save_Click(object sender, RoutedEventArgs e) { if (editFlag == 1) { WMS_Warehouse_Bll.Insert_Warehouse(wms_Warehouse_Model); } else if (editFlag == 2) { WMS_Warehouse_Bll.Update_Warehouse(wms_Warehouse_Model, " WarehouseName = '" + warehouseName + "'"); } editFlag = 0; Page_Frush(); WarehouseDataGrid.CanUserAddRows = false; WarehouseDataGrid.IsReadOnly = true; }
/// <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); }