/// <summary> /// 插入货架 /// </summary> /// <param name="wms_Shelf_Model"></param> /// <returns></returns> public static int Insert_Shelf(WMS_Shelf_Model wms_Shelf_Model) { using (var con = GetOpenConnection()) { return(con.Execute(WMS_Shelf_Dal.Insert_Shelf(wms_Shelf_Model))); } }
/// <summary> /// 更新货架 /// </summary> /// <param name="wms_Shelf_Model"></param> /// <param name="condition"></param> /// <returns></returns> public static int Update_Shelf(WMS_Shelf_Model wms_Shelf_Model, string condition) { using (var con = GetOpenConnection()) { return(con.Execute(WMS_Shelf_Dal.Update_Shelf(wms_Shelf_Model, condition))); } }
/// <summary> /// 搜索按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Search_Click(object sender, RoutedEventArgs e) { shelfBase.ShelfList.Clear(); List <WMS_Shelf_Model> list = new List <WMS_Shelf_Model>(); DataTable dt = WMS_Shelf_Bll.Select_Shelf(" ShelfName = '" + SearchText.Text.Trim() + "'"); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Shelf_Model wMS_Shelf_Model = new WMS_Shelf_Model { ShelfName = dt.Rows[i]["ShelfName"].ToString(), ShelfNo = dt.Rows[i]["ShelfNo"].ToString(), AreaNo = dt.Rows[i]["AreaNo"].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_Shelf_Model); } foreach (var model in list) { shelfBase.ShelfList.Add(model); } this.ShelfDataGrid.ItemsSource = shelfBase.ShelfList; }
/// <summary> /// 插入货架 /// </summary> /// <param name="wms_Shelf_Model"></param> /// <returns></returns> public static string Insert_Shelf(WMS_Shelf_Model wms_Shelf_Model) { string _insertSql = "INSERT INTO [WMS].[dbo].[WMS_Shelf]" + "([ShelfName],[ShelfNo],[AreaNo],[WarehouseNo]" + ",[Remark],[CreatPerson],[CreatTime],[ModifyPerson]" + ",[ModifyTime]) VALUES('" + wms_Shelf_Model.ShelfName + "','" + wms_Shelf_Model.ShelfNo + "','" + wms_Shelf_Model.AreaNo + "','" + wms_Shelf_Model.WarehouseNo + "','" + wms_Shelf_Model.Remark + "','" + wms_Shelf_Model.CreatPerson + "','" + wms_Shelf_Model.CreatTime + "','" + wms_Shelf_Model.ModifyPerson + "','" + wms_Shelf_Model.ModifyTime + "')"; return(_insertSql); }
/// <summary> /// 更新货架 /// </summary> /// <param name="wms_Shelf_Model"></param> /// <param name="condition"></param> /// <returns></returns> public static string Update_Shelf(WMS_Shelf_Model wms_Shelf_Model, string condition) { string _updateSql = "UPDATE [WMS].[dbo].[WMS_Shelf]" + "SET[ShelfName] = '" + wms_Shelf_Model.ShelfName + "',[ShelfNo] = '" + wms_Shelf_Model.ShelfNo + "',[AreaNo] = '" + wms_Shelf_Model.AreaNo + "',[WarehouseNo] = '" + wms_Shelf_Model.WarehouseNo + "',[Remark] = '" + wms_Shelf_Model.Remark + "',[CreatPerson] = '" + wms_Shelf_Model.CreatPerson + "',[CreatTime] = '" + wms_Shelf_Model.CreatTime + "',[ModifyPerson] = '" + wms_Shelf_Model.ModifyPerson + "',[ModifyTime] = '" + wms_Shelf_Model.ModifyTime + "' WHERE " + condition; return(_updateSql); }
/// <summary> /// 获取列表 /// </summary> /// <returns></returns> public static List <WMS_Shelf_Model> GetShelfList() { List <WMS_Shelf_Model> list = new List <WMS_Shelf_Model>(); DataTable dt = WMS_Shelf_Bll.Select_Shelf(string.Empty); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Shelf_Model wms_Shelf_Model = new WMS_Shelf_Model { ShelfName = dt.Rows[i]["ShelfName"].ToString(), ShelfNo = dt.Rows[i]["ShelfNo"].ToString(), AreaNo = dt.Rows[i]["AreaNo"].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_Shelf_Model); } return(list); }
/// <summary> /// 编辑事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ShelfDataGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { wms_Shelf_Model = e.Row.Item as WMS_Shelf_Model; shelfName = wms_Shelf_Model.ShelfName; }