public virtual void AppendTempBCCSet() { DataGridView setDataGrid = CnasUtilityTools.FindControl <DataGridView>(this, "setDataGrid"); if (setDataGrid != null) { string tempBCCs = string.Empty; for (int i = 0; i < ScanBarCodes.Count; i++) { string key = ScanBarCodes.GetKey(i).ToString(); if (key.Contains(":BCC") || key.StartsWith("BCC")) { string bccCode = key.Substring(key.IndexOf("BCC"), 13); if (BarCodeHelper.IsOrderSet(bccCode) || BarCodeHelper.IsTempSet(bccCode)) { tempBCCs += string.Format("{0},", bccCode); } } } if (!string.IsNullOrEmpty(tempBCCs)) { tempBCCs = tempBCCs.TrimEnd(','); SortedList condition = new SortedList(); tempBCCs = tempBCCs.Replace(",", "','"); condition.Add(1, PdCode); condition.Add(2, "0"); condition.Add(3, tempBCCs); string testSql = RemoteClient.RemotInterface.CheckSelectData("HCS-workset-tempBCC-sec001", condition); DataTable data = RemoteClient.RemotInterface.SelectData("HCS-workset-tempBCC-sec001", condition); if (data != null) { foreach (DataRow item in data.Rows) { int rowIndex = -1; string bccCode = Convert.ToString(item["bar_code"]); if (item.Table.Columns.Contains("bar_code") && item["bar_code"] != null) { rowIndex = DataConverter.ConvertSetData(setDataGrid, item); } if (BarCodeHelper.IsOrderSet(bccCode) && item.Table.Columns.Contains("order_type") && setDataGrid.Columns.Contains("setTypeCol") && rowIndex >= 0) { setDataGrid.Rows[rowIndex].Cells["setTypeCol"].Value = item["order_type"]; } } } } } }
public void DeleteSelection() { if (setDataGrid.SelectedRows != null && setDataGrid.SelectedRows.Count > 0) { if (setDataGrid.SelectedRows.Count == setDataGrid.Rows.Count) { MessageBox.Show("请确保订单中含有器械包", "信息提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } string warnmingMessage = "请确认是否把一下器械包移出该订单?\r\n"; foreach (DataGridViewRow item in setDataGrid.SelectedRows) { if (item.Cells["setNameCol"] != null) { warnmingMessage += item.Cells["setNameCol"].Value + "\r\n"; } } if (MessageBox.Show(warnmingMessage, "信息提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { for (int i = 0; i < setDataGrid.SelectedRows.Count; i++) { if (setDataGrid.SelectedRows[i].Cells["setBarCodeCol"] != null) { string setBarCode = setDataGrid.SelectedRows[i].Cells["setBarCodeCol"].Value.ToString(); for (int j = 0; j < ScanBarCodes.Count; j++) { if (setBarCode == ScanBarCodes.GetKey(j).ToString()) { ScanBarCodes.RemoveAt(j); j--; } } setDataGrid.Rows.Remove(setDataGrid.SelectedRows[i]); } } } setDataGrid.Rows[0].Selected = true; } }
public virtual void DeleteSets() { DataGridView setDataGrid = CnasUtilityTools.FindControl <DataGridView>(this, "setDataGrid"); if (setDataGrid != null) { if (setDataGrid.SelectedRows != null && setDataGrid.SelectedRows.Count > 0) { if (setDataGrid.SelectedRows.Count == setDataGrid.Rows.Count) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("setgridhasdata", EnumPromptMessage.warning), "信息提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } string warnmingMessage = PromptMessageXmlHelper.Instance.GetPromptMessage("cfmsetremove", EnumPromptMessage.warning); List <string> removedBarCode = new List <string>(); foreach (DataGridViewRow item in setDataGrid.SelectedRows) { if (setDataGrid.Columns.Contains("setNameCol") && item.Cells["setNameCol"] != null) { warnmingMessage += string.Format("\r\n名称: {0}", item.Cells["setNameCol"].Value); } if (item.Cells["setBarCodeCol"].Value != null) { removedBarCode.Add(item.Cells["setBarCodeCol"].Value.ToString()); } } if (MessageBox.Show(warnmingMessage, "信息提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { int selectedCount = setDataGrid.SelectedRows.Count; foreach (DataGridViewRow item in setDataGrid.SelectedRows) { string setBarCode = item.Cells["setBarCodeCol"].Value.ToString(); if (removedBarCode.Contains(setBarCode)) { for (int j = 0; j < ScanBarCodes.Count; j++) { if (ScanBarCodes.GetKey(j).ToString().Contains(setBarCode)) { ScanBarCodes.RemoveAt(j); j--; } } setDataGrid.Rows.Remove(item); } } } TextBox setNumTxt = CnasUtilityTools.FindControl <TextBox>(this, "setNumTxt"); if (setNumTxt != null) { setNumTxt.Text = setDataGrid.RowCount.ToString(); } } else { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("notfindSetGrid", EnumPromptMessage.error), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }