static void Main(string[] args) { Console.WriteLine("1. CONTRACT with input data: 4097, new DateTime(2019, 12, 12)"); Console.WriteLine("2. CONTRACT with new input data"); Console.WriteLine(); Console.WriteLine("3. WORKER with input data: 4097, ..."); Console.WriteLine("4. WORKER with new input data"); string choice = Console.ReadLine(); if (choice == "1" || choice == "2") { UpdateContract.Process(choice); } else if (choice == "3" || choice == "4") { UpdateWorker.Process(choice); } else { Console.WriteLine("Wrong choice"); } Console.WriteLine("Press any key to close the console"); Console.ReadLine(); }
private void dgvData_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int id = (int)dgvData[0, e.RowIndex].Value; switch (Name) { case "dgv" + ClientName: string name = (string)dgvData[1, e.RowIndex].Value; string adress = (string)dgvData[2, e.RowIndex].Value; string phone = (string)dgvData[3, e.RowIndex].Value; string requisites = (string)dgvData[4, e.RowIndex].Value; string contactPerson = (string)dgvData[5, e.RowIndex].Value; UpdateClient updateClient = new UpdateClient(id, name, adress, phone, requisites, contactPerson); updateClient.ShowDialog(); break; case "dgv" + ContractName: DateTime conclusionDate = (DateTime)dgvData[1, e.RowIndex].Value; int clientId = (int)dgvData[2, e.RowIndex].Value; UpdateContract updateContract = new UpdateContract(id, conclusionDate, clientId); updateContract.ShowDialog(); break; case "dgv" + PaymentName: int sum = (int)dgvData[1, e.RowIndex].Value; DateTime date = (DateTime)dgvData[2, e.RowIndex].Value; int contractId = (int)dgvData[3, e.RowIndex].Value; UpdatePayment updatePayment = new UpdatePayment(id, sum, date, contractId); updatePayment.ShowDialog(); break; case "dgv" + RentName: int contrId = (int)dgvData[1, e.RowIndex].Value; int tradePointId = (int)dgvData[2, e.RowIndex].Value; DateTime rentalStart = (DateTime)dgvData[3, e.RowIndex].Value; DateTime rentalEnd = (DateTime)dgvData[4, e.RowIndex].Value; UpdateRent updateRent = new UpdateRent(id, contrId, tradePointId, rentalStart, rentalEnd); updateRent.ShowDialog(); break; case "dgv" + TradePointName: int floor = (int)dgvData[1, e.RowIndex].Value; bool conditioning = (bool)dgvData[2, e.RowIndex].Value; int cost = (int)dgvData[3, e.RowIndex].Value; UpdateTradePoint updateTradePoint = new UpdateTradePoint(id, floor, conditioning, cost); updateTradePoint.ShowDialog(); break; } Refresh(); }
public void updateContract(Contract c, UpdateContract update) { Contract newContract = c; bool b; switch (update) { case UpdateContract.meeting: //automotic change b = newContract.IntroductoryMeeting; newContract.IntroductoryMeeting = false == b; break; case UpdateContract.PMorPH: //automotic change b = newContract.PMorPH; newContract.PMorPH = false == b; break; case UpdateContract.signed: //automotic change b = newContract.signed; newContract.signed = false == b; break; case UpdateContract.SallaryPerHour: Console.WriteLine("enter the new Salary per Hour"); newContract.SallaryPerHour = Convert.ToInt32(Console.ReadLine()); break; case UpdateContract.SallaryPerMonths: Console.WriteLine("enter the new Salary per Months"); newContract.SallaryPerMonth = Convert.ToInt32(Console.ReadLine()); break; case UpdateContract.WeeklyHours: //do something break; } instance.UpdateContract(newContract); }