private void btnUpdateOrder_Click(object sender, EventArgs e) { int id = int.Parse(lblTechID.Text); string name = txtTechName.Text; string surname = txtTechSurname.Text; string specialization = cmbSpecialization.Text; string deployed = txtTechDeployed.Text; string deploymentDate = dtpDeployDate.Value.ToString("dd/MM/yyyy"); TechnicalStaff ts = new TechnicalStaff(); ts.UpdateBLTechnical(id, name, surname, specialization, deployed, deploymentDate); MessageBox.Show(deploymentDate); FormManagement fm = new FormManagement(); fm.RefreshPage(); UpdateTechForm utf = new UpdateTechForm(); utf.Close(); }
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(); }