/// <summary> /// 搜索按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Search_Click(object sender, RoutedEventArgs e) { barcodeRuleBase.BarcodeList.Clear(); List <WMS_Barcode_Model> list = new List <WMS_Barcode_Model>(); DataTable dt = WMS_Barcode_Bll.Select_Barcode(" ProductionNo = '" + SearchText.Text.Trim() + "'"); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Barcode_Model wMS_Barcode_Model = new WMS_Barcode_Model { BarcodeLength = int.Parse(dt.Rows[i]["BarcodeLength"].ToString()), BarcodeRule = dt.Rows[i]["BarcodeRule"].ToString(), ProductionNo = dt.Rows[i]["ProductionNo"].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_Barcode_Model); } foreach (var model in list) { barcodeRuleBase.BarcodeList.Add(model); } this.BarcodeDataGrid.ItemsSource = barcodeRuleBase.BarcodeList; }
/// <summary> /// 获取列表 /// </summary> /// <returns></returns> public static List <WMS_Barcode_Model> GetBarcodeList() { List <WMS_Barcode_Model> list = new List <WMS_Barcode_Model>(); DataTable dt = WMS_Barcode_Bll.Select_Barcode(string.Empty); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Barcode_Model wms_Barcode_Model = new WMS_Barcode_Model { BarcodeLength = int.Parse(dt.Rows[i]["BarcodeLength"].ToString()), BarcodeRule = dt.Rows[i]["BarcodeRule"].ToString(), ProductionNo = dt.Rows[i]["ProductionNo"].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_Barcode_Model); } return(list); }