Esempio n. 1
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            string name       = string.Empty;
            string parentNode = string.Empty;

            foreach (DataGridViewRow row in dgvTypicalCategory.Rows)
            {
                if ((bool)row.Cells[0].EditedFormattedValue == true &&
                    row.Cells["colName"].Value != null)
                {
                    name       = row.Cells["colName"].Value.ToString();
                    parentNode = row.Cells["colCurrentNode"].Value.ToString();
                    break;
                }
            }

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            try
            {
                if (ProcessCardIds != null && ProcessCardIds.Count > 0)
                {
                    foreach (string key in ProcessCardIds.Keys)
                    {
                        Guid cardid = new Guid(key);
                        bool result = TypicalProcessBLL.ExistTypcialProcessCard(cardid, int.Parse(parentNode));
                        if (!result)
                        {
                            TypicalProcess typical = new TypicalProcess();
                            typical.Name        = ProcessCardIds[key];
                            typical.CurrentNode = dt.Rows.Count + 1;
                            typical.BusinessId  = cardid;
                            typical.BType       = BusinessType.Card;
                            typical.ParentNode  = int.Parse(parentNode);
                            TypicalProcessBLL.AddTypicalProcess(typical);
                        }
                    }
                }
                else
                {
                    Guid cardid = new Guid(ProcessCardId);
                    bool result = TypicalProcessBLL.ExistTypcialProcessCard(cardid, int.Parse(parentNode));
                    if (!result)
                    {
                        TypicalProcess typical = new TypicalProcess();
                        typical.Name        = ProcessCardName;
                        typical.CurrentNode = dt.Rows.Count + 1;
                        typical.BusinessId  = cardid;
                        typical.BType       = BusinessType.Card;
                        typical.ParentNode  = int.Parse(parentNode);
                        TypicalProcessBLL.AddTypicalProcess(typical);
                    }
                }

                if (TypicalProcessFrm.typicalProcessForm != null)
                {
                    TypicalProcessFrm.typicalProcessForm.ChangeToTypical();
                }

                MessageBox.Show("卡片转为典型成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch
            {
                MessageBox.Show("卡片转为典型失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }