Beispiel #1
0
        public void AddSets()
        {
            HCSWF_set_choose chooseDialog = new HCSWF_set_choose(PdCode);

            chooseDialog.ShowDialog();
            if (chooseDialog.SelectItems != null)
            {
                bool isExist = false;
                setDataGrid.ClearSelection();
                for (int i = 0; i < chooseDialog.SelectItems.Count; i++)
                {
                    DataRow item = chooseDialog.SelectItems[i] as DataRow;

                    foreach (DataGridViewRow row in setDataGrid.Rows)
                    {
                        if (row.Cells["setBarCodeCol"] != null && row.Cells["setBarCodeCol"].Value != null &&
                            item["bar_code"] != null && row.Cells["setBarCodeCol"].Value.ToString() == item["bar_code"].ToString())
                        {
                            isExist      = true;
                            row.Selected = isExist;
                            break;
                        }
                    }
                    if (!isExist)
                    {
                        int rowIndex = setDataGrid.Rows.Add();
                        setDataGrid.Rows[rowIndex].Cells["setBarCodeCol"].Value = item["bar_code"];
                        if (item["id"] != null)
                        {
                            setDataGrid.Rows[rowIndex].Cells["setIdCol"].Value = item["id"];
                        }
                        if (item["ca_name"] != null)
                        {
                            setDataGrid.Rows[rowIndex].Cells["setNameCol"].Value = item["ca_name"];
                        }
                        if (item["pa_type"] != null)
                        {
                            setDataGrid.Rows[rowIndex].Cells["setTypeCol"].Value = item["pa_type"];
                        }
                        if (item["pa_priorty"] != null)
                        {
                            setDataGrid.Rows[rowIndex].Cells["setPriortyCol"].Value = item["pa_priorty"];
                        }
                        if (item["wa_pr_Name"] != null)
                        {
                            setDataGrid.Rows[rowIndex].Cells["washingPCol"].Value = item["wa_pr_Name"];
                        }
                        if (item["st_pr_Name"] != null)
                        {
                            setDataGrid.Rows[rowIndex].Cells["sterilizerPCol"].Value = item["st_pr_Name"];
                        }
                        if (item["cost_center_name"] != null)
                        {
                            setDataGrid.Rows[rowIndex].Cells["costCNameCol"].Value = item["cost_center_name"];
                        }
                        setDataGrid.Rows[rowIndex].Tag = item;
                    }
                }
            }
        }
Beispiel #2
0
        public virtual void AddSets()
        {
            DataGridView setDataGrid = CnasUtilityTools.FindControl <DataGridView>(this, "setDataGrid");

            if (setDataGrid != null)
            {
                HCSWF_set_choose chooseDialog = new HCSWF_set_choose(PdCode);
                chooseDialog.ShowDialog();
                if (chooseDialog.SelectItems != null)
                {
                    setDataGrid.ClearSelection();
                    for (int i = 0; i < chooseDialog.SelectItems.Count; i++)
                    {
                        DataRow item    = chooseDialog.SelectItems[i] as DataRow;
                        bool    isExist = false;

                        foreach (DataGridViewRow row in setDataGrid.Rows)
                        {
                            if (setDataGrid.Columns.Contains("setBarCodeCol") && row.Cells["setBarCodeCol"] != null &&
                                row.Cells["setBarCodeCol"].Value != null && item["bar_code"] != null &&
                                row.Cells["setBarCodeCol"].Value.ToString() == item["bar_code"].ToString())
                            {
                                isExist      = true;
                                row.Selected = isExist;
                                break;
                            }
                        }
                        if (!isExist)
                        {
                            int rowIndex = DataConverter.ConvertSetData(setDataGrid, item);
                            setDataGrid.Rows[rowIndex].Selected = true;
                            string bccCode = setDataGrid.Rows[rowIndex].Cells["setBarCodeCol"].Value.ToString();
                            string bcuCode = string.Empty;
                            if (item.Table.Columns.Contains("bcuCode") && !(item["bcuCode"] is DBNull))
                            {
                                bcuCode = item["bcuCode"].ToString();
                            }
                            string key = string.IsNullOrEmpty(bcuCode) ? bccCode : CnasUtilityTools.ConcatTwoString(bcuCode, bccCode);
                            if (!ScanBarCodes.ContainsKey(key))
                            {
                                ScanBarCodes.Add(key, key.Substring(0, 3));
                            }
                        }
                    }
                    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);
            }
        }