private void ButtonFind_Click(object sender, EventArgs e) { FormOfEducation form = FormOfEducation.partTimeForm; if (!CheckingInfo.CheckCorectness(textYear.Text)) { MessageBox.Show("Invalid year!"); } else { if (RBExtramural.Checked) { form = FormOfEducation.extramuralForm; } else if (RBIntramural.Checked) { form = FormOfEducation.intramuralForm; } int year = Int32.Parse(textYear.Text); Hide(); RequestFindForm reqForm = new RequestFindForm(form, year); reqForm.Show(); } }
private void ButtonChoose_Click(object sender, EventArgs e) { TypeOfRequest req = TypeOfRequest.getInfo; if (RButtonAdd.Checked) { req = TypeOfRequest.addInfo; } else if (RButtonUpdate.Checked) { req = TypeOfRequest.updateInfo; } if (!CheckingInfo.CheckAccess(user.Type, req)) { MessageBox.Show("Access is denied!"); } else { switch (req) { case TypeOfRequest.getInfo: { this.Hide(); FindInfo form = new FindInfo(); form.Show(); break; } case TypeOfRequest.addInfo: { this.Hide(); AddInfo form = new AddInfo(); form.Show(); break; } case TypeOfRequest.updateInfo: { this.Hide(); UpdateInfo form = new UpdateInfo(); form.Show(); break; } default: break; } } }
private void ButtonUpdLeader_Click(object sender, EventArgs e) { string name = textBoxLeader.Text; string year = textBoxYear.Text; if (name.Length != 0 && CheckingInfo.CheckCorectness(year)) { if (UpdatingInformation.UpdateHistory(name, Int32.Parse(year))) { MessageBox.Show("Successfully update!"); } else { MessageBox.Show("Oops... Something went wrong! Try again."); } } else { MessageBox.Show("Incorrect info!"); } }
private void ButtonAdd_Click(object sender, EventArgs e) { Department dep = null; Faculty fac = null; Speciality spec = null; Head head = null; int year = 0; string address = ""; string phone = ""; string site = ""; FormOfEducation edForm = FormOfEducation.intramuralForm; if (textBoxDep.Text.Length != 0) { dep = new Department(GetInfo.DepMaxCode() + 1, textBoxDep.Text); } if (textBoxFac.Text.Length != 0) { fac = new Faculty(GetInfo.FacMaxCode() + 1, textBoxFac.Text); } if (textBoxSpec.Text.Length != 0) { spec = new Speciality(GetInfo.SpecMaxCode() + 1, textBoxFac.Text); } if (textBoxYear.Text.Length != 0 && CheckingInfo.CheckCorectness(textBoxYear.Text)) { year = Int32.Parse(textBoxYear.Text); } if (textBoxName.Text.Length != 0 && textBoxRank.Text.Length != 0 && textBoxDegree.Text.Length != 0) { head = new Head(year, textBoxName.Text, textBoxDegree.Text, textBoxRank.Text); } if (textBoxAddress.Text.Length != 0) { address = textBoxAddress.Text; } if (textBoxPhone.Text.Length != 0) { phone = textBoxPhone.Text; } if (textBoxSite.Text.Length != 0) { site = textBoxSite.Text; } if (RBExtramural.Checked) { edForm = FormOfEducation.extramuralForm; } if (RBPart.Checked) { edForm = FormOfEducation.partTimeForm; } if (AddingInformation.AddInfo(dep, spec, fac, head, address, phone, site, year, edForm)) { MessageBox.Show("Successfully added!"); } else { MessageBox.Show("Error! Try again"); } }