Exemple #1
0
        }//Populate the list of Service objects

        private void btnEdit_Click(object sender, EventArgs e)
        {
            //Here we call from the Service logic

            if (txtDescription.Text.Equals(""))
            {
                MessageBox.Show("Please enter updated service description details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data validation
            if (txtDuration.Text.Equals(""))//Data Validation
            {
                MessageBox.Show("Please enter updated service duration details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data Validation
            else
            {
                this.service.Description      = txtDescription.Text;
                this.service.ExpectedDuration = int.Parse(txtDuration.Text);

                Sl.UpdateService(this.service);
                MessageBox.Show("Service successfully Updated", " Edit",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                Hide();
                frmServiceContract form = new frmServiceContract();
                form.ShowDialog();
            } //End of Else
        }     //Update service
Exemple #2
0
        }//Populate the list of Service objects

        private void btnAddService_Click(object sender, EventArgs e)
        {
            //Here we call from the Service Contract logic

            if (txtSDescript.Text.Equals(""))
            {
                MessageBox.Show("Please enter service description details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data validation
            if (txtSDuration.Text.Equals(""))//Data Validation
            {
                MessageBox.Show("Please enter service duration details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data Validation
            else
            {
                description = txtSDescript.Text;
                duration    = int.Parse(txtSDuration.Text);
                newService  = new Service(description, duration);

                Sl.AddService(newService);
                MessageBox.Show("Service successfully Added", " ADD",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                //Perform Fom transition
                Hide();
                frmServiceContract form = new frmServiceContract();
                form.ShowDialog();
            } //Add the Service
        }     //Validate inputs and add service
        }//Load the Services into the list view when form loads

        private void btnServiceRemove_Click(object sender, EventArgs e)
        {
            bool Valid = true;


            //If a item is selected in the list view perform delete
            if (lstServiceView.SelectedItems.Count > 0)
            {
                //Ask user for conformation
                DialogResult deleteI = MessageBox.Show("Are you sure you want to delete this Service?", "WARNING: DELETE Service",
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                //Get user for conformation


                if (deleteI == DialogResult.Yes)
                {
                    Service RService = lstServiceView.SelectedItems[0].Tag as Service;

                    //Parse the object to the Service logic to perform action

                    try
                    {
                        //Sl.ServiceInPckage(RService);
                        if (Sl.ServiceInPackage(RService) == false)
                        {
                            Sl.Removeservice(RService);
                        }
                    }
                    catch (ServiceExistsException ex)
                    {
                        MessageBox.Show(string.Format("DELETION ANOMOLY {0}", ex));

                        Valid = false;
                    }
                    if (Valid == true)
                    {
                        MessageBox.Show("Service successfully deleted", " DELETED",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        lstServiceView.Clear();
                    }

                    //Hide this form and dispay the Dialog for the Service Contract Manu
                    Hide();
                    frmServiceContract form = new frmServiceContract();
                    form.ShowDialog();
                    LoadServices();
                }
            }
            else
            {
                MessageBox.Show("No Record was selected", "SELECTION",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }//Remove a service With Custom Exception
        private void btnAddPackage1_Click(object sender, EventArgs e)
        {
            //Here we call from the Service Contract logic
            if (txtPDiscript.Text.Equals(""))
            {
                MessageBox.Show("Please enter Package description details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data validation
            if (txtPName.Text.Equals(""))
            {
                MessageBox.Show("Please enter package name details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data Validation
            if (cmbPService.SelectedIndex < 0)
            {
                MessageBox.Show("Please Select a Service", "EMPTY VALUE!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (cmbPSLA.SelectedIndex < 0)
            {
                MessageBox.Show("Please Select a Service Level Agreemnt", "EMPTY VALUE!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Description = txtPDiscript.Text;
                Name        = txtPName.Text;

                service = Placeholder_Service_List[cmbPService.SelectedIndex];
                sla     = Placeholder_SLA_List[cmbPSLA.SelectedIndex];
                EQC     = Placeholder_EQC_List[cbxEquitptmentCatagory.SelectedIndex];


                /*
                 * ! You were here last
                 *
                 */



                newPackage = new Package(Name, Description, service, sla, EQC);

                P_L.Addpackage(newPackage);

                MessageBox.Show("Service successfully Added", " ADD",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                //Perform Fom transition
                Hide();
                frmServiceContract form = new frmServiceContract();
                form.ShowDialog();
            }
        }//Add a Package
        }//Remove Package form CS

        private void btnSCOk_Click(object sender, EventArgs e)
        {
            if (txtDescription.Text.Equals(""))
            {
                MessageBox.Show("Please enter Service Contract description ", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (txtCost.Text.Equals(""))
            {
                MessageBox.Show("Please enter Service Contract cost ", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (txtStat.Text.Equals(""))
            {
                MessageBox.Show("Please enter Service Contract status", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (Identtifier.Equals(""))
            {
                MessageBox.Show("Please generate a Identifier", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //Add the packages , add the identifiers ,Create SC

                ServiceContract SC = new ServiceContract
                                     (
                    txtDescription.Text,
                    double.Parse(txtCost.Text),
                    dtDateFinal.Value,
                    dtDateTer.Value,
                    txtStat.Text,
                    Identtifier
                                     );

                SC_L.CreateServiceContract(SC);

                foreach (Package p in NewPackagesForSC)
                {
                    SC_L.AddPackage(p, SC);
                }

                MessageBox.Show("Service successfully Service Contract", " ADD",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                //Perform Fom transition
                Hide();
                frmServiceContract form = new frmServiceContract();
                form.ShowDialog();
            }
        }
        }//Load the SLA into the list view when form loads

        private void btnRemove_Click(object sender, EventArgs e)
        {
            //If a item is selected in the list view perform delete

            bool Valid = true;

            //If a item is selected in the list view perform delete
            if (lstSLA.SelectedItems.Count > 0)
            {
                //Ask user for conformation
                DialogResult deleteI = MessageBox.Show("Are you sure you want to delete this SLA?", "WARNING: DELETE Package",
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                //Get user for conformation


                if (deleteI == DialogResult.Yes)
                {
                    ServiceLevelAgreement RSLA = lstSLA.SelectedItems[0].Tag as ServiceLevelAgreement;

                    //Parse the object to the Service logic to perform action

                    try
                    {
                        SLAL.DeleteSLA(RSLA);
                    }
                    catch (SLAExistsException ex)
                    {
                        MessageBox.Show(string.Format("DELETION ANOMOLY {0}", ex));

                        Valid = false;
                    }
                    if (Valid == true)
                    {
                        MessageBox.Show("SLA successfully deleted", " DELETED",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        lstSLA.Clear();
                    }

                    frmServiceContract form = new frmServiceContract();
                    DialogResult       res  = form.ShowDialog();
                    LoadServices();
                }
            }
            else
            {
                MessageBox.Show("No Record was selected", "SELECTION",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }//Remove SLA
        }//Construct the SLA FROm and arse a cliet from frmservice Contract

        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtSLaDescription.Text.Equals(""))
            {
                MessageBox.Show("Please enter updated SLA description details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data validation
            else
            {
                this.Sla.Description = txtSLaDescription.Text;
                SLA_L.UpdateSla(this.Sla);
                MessageBox.Show("SLA successfully Updated", " Edit",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                Hide();
                frmServiceContract form = new frmServiceContract();
                form.ShowDialog();
            } //End of Else
        }     //UPdate and validate the SLa
        }//Populate Combo boxes and load list of packages

        private void btnEditPackage_Click(object sender, EventArgs e)
        {
            if (txtPDiscript.Text.Equals(""))
            {
                MessageBox.Show("Please enter Package Description", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (txtPName.Text.Equals(""))
            {
                MessageBox.Show("Please enter package Name", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (cmbPService.Items.Count < 0)
            {
                MessageBox.Show("Please Select a Service", "EMPTY VALUE!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (cmbPSLA.Items.Count < 0)
            {
                MessageBox.Show("Please Select a Service Level Agreemnt", "EMPTY VALUE!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                this.ParsedPckage.Description = txtPDiscript.Text;
                this.ParsedPckage.Name        = txtPName.Text;

                this.ParsedPckage.Service = Placeholder_Service_List[cmbPService.SelectedIndex];
                this.ParsedPckage.Sla     = Placeholder_SLA_List[cmbPSLA.SelectedIndex];

                P_L.EditPackage(this.ParsedPckage);

                MessageBox.Show("Service successfully Updated", " ADD",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                //Perform Fom transition
                Hide();
                frmServiceContract form = new frmServiceContract();
                form.ShowDialog();
            }
        }//Edit the Package
        }//Load the SLA from SLA logic

        private void btnAddSLA_Click(object sender, EventArgs e)
        {
            //Here we call from the SLA Contract logic

            if (txtSLADescript.Text.Equals(""))
            {
                MessageBox.Show("Please enter Service Level Agreement description details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data validation
            else
            {
                SlaDescription = txtSLADescript.Text;
                NewSla         = new ServiceLevelAgreement(SlaDescription);

                Sl.AddSLA(NewSla);
                MessageBox.Show("Service successfully Added", " ADD",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                Hide();
                frmServiceContract form = new frmServiceContract();
                form.ShowDialog();
            } //Add the SLA
        }     //Validate inputs and add SLA