private void btnRetrieve_Click(object sender, EventArgs e) { Interpreter terp = new Interpreter(); InterpreterMgr terpMgr = new InterpreterMgr(); terp = terpMgr.RetrieveInterpreter(terp); txtName.Text = terp.Name; txtAddressOne.Text = terp.Address1; txtAddressTwo.Text = terp.Address2; txtCity.Text = terp.City; txtState.Text = terp.State; txtZip.Text = terp.Zip; txtPhone.Text = terp.Phone; txtEmail.Text = terp.Email; txtYears.Text = terp.YearsOfExperience.ToString(); txtCertification.Text = terp.HighestLevelCertification; }
private void RetrieveInterpreter() { string storageFile = Path.Combine(Environment.CurrentDirectory, "Interpreter.bin"); FileInfo storageFileInfo = new FileInfo(storageFile); if (storageFileInfo.Exists == true) { Interpreter terp = new Interpreter(); InterpreterMgr terpMgr = new InterpreterMgr(); terp = terpMgr.RetrieveInterpreter(terp); lblInterpreter.Text = terp.Name; } else { lblInterpreter.Text = "No Interpreter Found. Create A New Interpreter File."; } }
private void btnSave_Click(object sender, EventArgs e) { Interpreter terp = new Interpreter(); terp.Name = txtName.Text; terp.Address1 = txtAddressOne.Text; terp.Address2 = txtAddressTwo.Text; terp.City = txtCity.Text; terp.State = txtState.Text; terp.Zip = txtZip.Text; terp.Phone = txtPhone.Text; terp.Email = txtEmail.Text; terp.HighestLevelCertification = txtCertification.Text; int i = 0; bool isNumeric = int.TryParse(txtYears.Text, out i); if (isNumeric == true) { terp.YearsOfExperience = Int32.Parse(txtYears.Text); } else { MessageBox.Show("You have entered non-numerical character in Years of Experience textbox. Enter numeric character."); txtYears.Text = ""; return; } InterpreterMgr terpMgr = new InterpreterMgr(); terpMgr.StoreNewInterpreter(terp); AssignmentForm assign = (AssignmentForm)Owner; assign.UpdateInterpreterFromInterpreterForm(txtName.Text); AfterTheSave(); Close(); }