Beispiel #1
0
        private void btnAddSLA_Click(object sender, EventArgs e)
        {
            ContractsManagment managment  = new ContractsManagment();
            Validations        validation = new Validations();
            Boolean            flag       = validation.validateSLACreation(pnlAddSLA);

            String name    = txtName.Text;
            String descrip = rtbDescription.Text;
            String tarif   = txtTarif.Text;
            String code    = cmbType.Text + "," + cmbImportance.Text;

            if (flag)
            {
                flag = managment.AddSLA(name, descrip, tarif, code);
                if (flag)
                {
                    MessageBox.Show("A new SLA was registered", "Creation Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Failed to create SLA", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //ResetBoxes();
                }
            }
            else
            {
                MessageBox.Show("A mistake was made when entering details please try again", "Syntax Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void ContractsEditForm_Load(object sender, EventArgs e)
        {
            tmrTime.Start();
            lblID.Text = Globals.StaffID;

            ContractsManagment contractsM = new ContractsManagment();

            SLAs = contractsM.GetListSLAs();

            foreach (var item in SLAs)
            {
                cmbSLAs.Items.Add(item.SLAID1 + " " + item.Name);
            }
        }
Beispiel #3
0
        private void btnEditSLA_Click(object sender, EventArgs e)
        {
            switch (cmbData.Text)
            {
            case "Name":
            {
                SLA.Name = txtNewData.Text;
            }
            break;

            case "Description":
            {
                SLA.Description = txtNewData.Text;
            }
            break;

            case "Tarif":
            {
                SLA.Tarif = txtNewData.Text;
            }
            break;

            default:
            {
                MessageBox.Show("Please select data to edit in the drop down menu", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            break;
            }

            bool flag = new ContractsManagment().EditSLA(SLA);

            if (flag)
            {
                MessageBox.Show("New SLA data was registered", "Update Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("There was a error updating SLA data", "Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }