/// <summary> /// 添加仓库 /// </summary> /// <param name="wms_Warehouse_Model"></param> /// <returns></returns> public static int Insert_Warehouse(WMS_Warehouse_Model wms_Warehouse_Model) { using (var con = GetOpenConnection()) { return(con.Execute(WMS_Warehouse_Dal.Insert_Warehouse(wms_Warehouse_Model))); } }
/// <summary> /// 更新仓库 /// </summary> /// <param name="wms_Warehouse_Model"></param> /// <param name="condition"></param> /// <returns></returns> public static int Update_Warehouse(WMS_Warehouse_Model wms_Warehouse_Model, string condition) { using (var con = GetOpenConnection()) { return(con.Execute(WMS_Warehouse_Dal.Update_Warehouse(wms_Warehouse_Model, condition))); } }
/// <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="wms_Warehouse_Model"></param> /// <param name="condition"></param> /// <returns></returns> public static string Update_Warehouse(WMS_Warehouse_Model wms_Warehouse_Model, string condition) { string _updateSql = "UPDATE [WMS].[dbo].[WMS_Warehouse]" + "SET[WarehouseName] = '" + wms_Warehouse_Model.WarehouseName + "',[WarehouseNo] = '" + wms_Warehouse_Model.WarehouseNo + "',[Remark] = '" + wms_Warehouse_Model.Remark + "',[CreatPerson] = '" + wms_Warehouse_Model.CreatPerson + "',[CreatTime] = '" + wms_Warehouse_Model.CreatTime + "',[ModifyPerson] = '" + wms_Warehouse_Model.ModifyPerson + "',[ModifyTime] = '" + wms_Warehouse_Model.ModifyTime + "' WHERE " + condition; return(_updateSql); }
/// <summary> /// 添加仓库 /// </summary> /// <param name="wms_Warehouse_Model"></param> /// <returns></returns> public static string Insert_Warehouse(WMS_Warehouse_Model wms_Warehouse_Model) { string _insertSql = "INSERT INTO [WMS].[dbo].[WMS_Warehouse]" + "([WarehouseName],[WarehouseNo],[Remark],[CreatPerson]" + ",[CreatTime],[ModifyPerson],[ModifyTime])VALUES" + "('" + wms_Warehouse_Model.WarehouseName + "','" + wms_Warehouse_Model.WarehouseNo + "','" + wms_Warehouse_Model.Remark + "','" + wms_Warehouse_Model.CreatPerson + "','" + wms_Warehouse_Model.CreatTime + "','" + wms_Warehouse_Model.ModifyPerson + "','" + wms_Warehouse_Model.ModifyTime + "')"; return(_insertSql); }
/// <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); }
/// <summary> /// 编辑事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WarehouseDataGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { wms_Warehouse_Model = e.Row.Item as WMS_Warehouse_Model; warehouseName = wms_Warehouse_Model.WarehouseName; }