Пример #1
0
        //Display the technical Staff Name
        private void GetDisplayTechStaff()
        {
            TechnicalStaff        ts            = new TechnicalStaff();
            List <TechnicalStaff> techStaffData = ts.GetBLTechnical();
            int count = 0;
            int index = -1;

            foreach (TechnicalStaff item in techStaffData)
            {
                string deployed = item.Deployed.ToString();


                if (deployed[0] == 'N')
                {
                    index = count;
                }
                else
                {
                    count++;
                }
            }
            string techName   = techStaffData[index].Name;
            string techSurnam = techStaffData[index].Surname;

            lblTechnicianName.Text = techName + " " + techSurnam;
        }
Пример #2
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            //Gather all necessary values

            string contactUID       = lblUID.Text;
            string type             = lblContractType.Text;
            string term             = lblTerm.Text;
            string products         = lblProducts.Text;
            string serviceName      = lblService.Text;
            string installationDate = lblinstalDate.Text;
            string expirationDate   = lblExpirationDate.Text;
            string maintenancePlane = lblMaintenance.Text;
            string clientName       = lblName.Text;
            string clientSurname    = lblSurnamesig.Text;
            string clientAddress    = lblAddress.Text;
            int    totalCost        = int.Parse(lblTotalPrice.Text);
            int    cancellationFee  = int.Parse(lblCancelPrice.Text);
            string address          = lblAddress.Text;

            Contract cr = new Contract();


            //Set the appointment for technical stafff

            TechnicalStaff        ts            = new TechnicalStaff();
            List <TechnicalStaff> techStaffData = ts.GetBLTechnical();
            int count = 0;
            int index = -1;

            foreach (TechnicalStaff item in techStaffData)
            {
                string deployed = item.Deployed.ToString();


                if (deployed[0] == 'N')
                {
                    index = count;
                }
                else
                {
                    count++;
                }
            }
            int    technicalID  = techStaffData[index].TechnicalID;
            string techName     = techStaffData[index].Name;
            string techSurnam   = techStaffData[index].Surname;
            string techSpec     = techStaffData[index].Specialization;
            string techDeployed = "YES";
            string techStaff    = installationDate;

            ts.UpdateBLTechnical(technicalID, techName, techSurnam, techSpec, techDeployed, techStaff);

            //Set the client contract to active and expiration date

            Client        cl          = new Client();
            List <Client> clientData  = cl.GetCustomer();
            int           countClient = 0;
            int           indexClient = -1;

            foreach (Client itemclient in clientData)
            {
                string obetainedclientUID = itemclient.ClientID;

                if (obetainedclientUID == ClientUID)
                {
                    indexClient = countClient;
                }
                else
                {
                    countClient++;
                }
            }


            string Contact = clientData[indexClient].Contact;
            string email   = clientData[indexClient].Email;
            string clientActiveContract = "YES";
            string clientExpiration     = expirationDate;



            cl.UpdateBLCustomer(ClientUID, clientName, clientSurname, address, Contact, email, clientActiveContract, clientExpiration);

            //Store contract values n the database

            cr.InsertBLContract(contactUID, type, term, products, serviceName, installationDate, expirationDate, maintenancePlane, totalCost, cancellationFee, clientName, clientSurname, address);


            this.Close();
        }