Exemplo n.º 1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            AssetDAO objAsseDAO = new AssetDAO();
            SelectedNodesCollection objSelectednode = tree.SelectedNodes;

            if (buttonOK.Text == "Apply" && bApply == true)
            {
                int iCount = objSelectednode.Count;
                for (int i = 0; i < iCount; i++)
                {
                    string strTag = objSelectednode[i].Tag.ToString();
                    if (GetSupportContractDetails(strTag))
                    {
                        objAsseDAO.AddSupportContract(m_objSupportContract);
                    }
                }
                tree.SelectedNodes.Clear();
                ClearControlsSupportContract();
                FillControlsOnLoad();
                FillSupportContractComboBox();
                FillSuppliersComboBox();
                checkBoxSupportContract.Checked = false;
                InitialiseSupportContractTab();
                MessageBox.Show("Support Contract Successfully Added for the Selected Assets.", "AuditWizard", MessageBoxButtons.OK, MessageBoxIcon.Information);
                buttonOK.Text = "OK";
                bApply        = false;
            }

            else if (MessageBox.Show("Do you wish to Deploy Support Contract to other Assets?\nTo deploy, highlight required assets in Network View using Ctrl key", "AuditWizard", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                buttonOK.Text = "Apply";
                bApply        = true;
                GetSupportContractDetails();
            }
            else
            {
                if (GetSupportContractDetails())
                {
                    objAsseDAO.AddSupportContract(m_objSupportContract);

                    ClearControlsSupportContract();
                    FillControlsOnLoad();
                    FillSupportContractComboBox();
                    FillSuppliersComboBox();
                    checkBoxSupportContract.Checked = false;
                    InitialiseSupportContractTab();
                }
                MessageBox.Show("Support Contract Successfully Added", "AuditWizard", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }