private void btnAction2ProgrammeSGM_Click(object sender, EventArgs e) { switch (btn2State) { case Btn2State.modifier: //Enable the fields enableProgrammeFields(true); //switch btn2 to annulerModif btn2State = Btn2State.annulerModif; btnAction2ProgrammeSGM.Text = "Annuler"; //switch btn1 to confirmerModif btn1State = Btn1State.confirmerModif; btnAction1ProgrammeSGM.Text = "Confirmer"; break; case Btn2State.annulerAjout: //messagebox of validation DialogResult dialogResult1 = MessageBox.Show("Êtes-vous certain de vouloir annuler l'ajout?", "SGM", MessageBoxButtons.YesNo); //if yes fill the field with the initial state if (dialogResult1 == DialogResult.Yes) { enableProgrammeFields(false); clearProgrammeFields(false); //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction2ProgrammeSGM.Text = "Modifier"; //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1ProgrammeSGM.Text = "Ajouter"; } //else do nothing break; case Btn2State.annulerModif: //messagebox of validation DialogResult dialogResult2 = MessageBox.Show("Êtes-vous certain de vouloir annuler les modifications?", "SGM", MessageBoxButtons.YesNo); //if yes fill the field with the initial state if (dialogResult2 == DialogResult.Yes) { enableProgrammeFields(false); clearProgrammeFields(false); //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction2ProgrammeSGM.Text = "Modifier"; //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1ProgrammeSGM.Text = "Ajouter"; } //else do nothing break; } }
private void btnAction1ProgrammeSGM_Click(object sender, EventArgs e) { switch (btn1State) { case Btn1State.ajouter: //clear all the fields enableProgrammeFields(true); clearProgrammeFields(true); //switch btn1 to confirmerAjout btn1State = Btn1State.confirmerAjout; btnAction1ProgrammeSGM.Text = "Confirmer"; //switch btn2 to annulerAjout btn2State = Btn2State.annulerAjout; btnAction2ProgrammeSGM.Text = "Annuler"; break; case Btn1State.confirmerAjout: crm.CreateProgramme(new Programme(new Guid(), txtCodeProgrammeSGM.Text, txtNomProgrammeSGM.Text, txtCycleProgrammeSGM.Text, txtDepartementProgrammeSGM.Text)); onloadProgrammeTab(); enableProgrammeFields(false); //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1ProgrammeSGM.Text = "Ajouter"; //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction2ProgrammeSGM.Text = "Modifier"; break; case Btn1State.confirmerModif: //throw the modification action to CRM crm.UpdateProgramme(new Programme(selectedProgrammeId, txtCodeProgrammeSGM.Text, txtNomProgrammeSGM.Text, txtCycleProgrammeSGM.Text, txtDepartementProgrammeSGM.Text)); onloadProgrammeTab(); enableProgrammeFields(false); //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1ProgrammeSGM.Text = "Ajouter"; //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction1ProgrammeSGM.Text = "Modifier"; break; } }
private void btnAction1EtudiantSGM_Click(object sender, EventArgs e) { switch (btn1State) { case Btn1State.ajouter: //clear all the fields enableEtudiantFields(true); clearEtudiantFields(true); //switch btn1 to confirmerAjout btn1State = Btn1State.confirmerAjout; btnAction1EtudiantSGM.Text = "Confirmer"; //switch btn2 to annulerAjout btn2State = Btn2State.annulerAjout; btnAction2EtudiantSGM.Text = "Annuler"; break; case Btn1State.confirmerAjout: crm.CreateEtudiant(new Etudiant(txtNomSGM.Text, new Guid(), txtPrenomSGM.Text, txtAdresseSGM.Text, txtVilleSGM.Text, txtPaysSGM.Text, txtCodeProgrammeSGM.Text)); onloadEtudiantTab(); enableEtudiantFields(false); //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1EtudiantSGM.Text = "Ajouter"; //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction2EtudiantSGM.Text = "Modifier"; break; case Btn1State.confirmerModif: //throw the modification action to CRM crm.UpdateEtudiant(new Etudiant(txtNomSGM.Text, selectedEtudiantId, txtPrenomSGM.Text, txtAdresseSGM.Text, txtVilleSGM.Text, txtPaysSGM.Text, txtCodePermanentSGM.Text)); onloadEtudiantTab(); enableEtudiantFields(false); //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1EtudiantSGM.Text = "Ajouter"; //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction1EtudiantSGM.Text = "Modifier"; break; } }
private void btnAction1EmployeSGM_Click(object sender, EventArgs e) { switch (btn1State) { case Btn1State.ajouter: //clear all the fields enableEmployeFields(true); clearEmployeFields(true); //switch btn1 to confirmerAjout btn1State = Btn1State.confirmerAjout; btnAction1EmployeSGM.Text = "Confirmer"; //switch btn2 to annulerAjout btn2State = Btn2State.annulerAjout; btnAction2EmployeSGM.Text = "Annuler"; break; case Btn1State.confirmerAjout: crm.CreateEmploye(new Employe(new Guid(), tbPrenomEmployeSGM.Text, tbNomEmployeSGM.Text, tbAdresseEmployeSGM.Text)); onloadEmployeTab(); enableEmployeFields(false); //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1EmployeSGM.Text = "Ajouter"; //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction2EmployeSGM.Text = "Modifier"; break; case Btn1State.confirmerModif: //throw the modification action to CRM crm.UpdateEmploye(new Employe(selectedEmployeId, tbPrenomEmployeSGM.Text, tbNomEmployeSGM.Text, tbAdresseEmployeSGM.Text)); onloadEmployeTab(); enableEmployeFields(false); //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1EmployeSGM.Text = "Ajouter"; //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction2EmployeSGM.Text = "Modifier"; break; } }
private void btnAction1MissionSGM_Click(object sender, EventArgs e) { switch (btn1State) { case Btn1State.ajouter: //clear all the fields enableMissionFields(true); clearMissionFields(true); //switch btn1 to confirmerAjout btn1State = Btn1State.confirmerAjout; btnAction1MissionSGM.Text = "Confirmer"; //switch btn2 to annulerAjout btn2State = Btn2State.annulerAjout; btnAction2MissionSGM.Text = "Annuler"; break; case Btn1State.confirmerAjout: crm.CreateMission(new Mission(new Guid(), tbNomMissionSGM.Text, tbPaysMissionSGM.Text, DateTime.ParseExact(tbDateDebutMissionSGM.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture), DateTime.ParseExact(tbDateFinMissionSGM.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture))); onloadMissionTab(); enableMissionFields(false); //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1MissionSGM.Text = "Ajouter"; //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction2MissionSGM.Text = "Modifier"; break; case Btn1State.confirmerModif: //throw the modification action to CRM crm.UpdateMission(new Mission(new Guid(), tbNomMissionSGM.Text, tbPaysMissionSGM.Text, DateTime.ParseExact(tbDateDebutMissionSGM.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture), DateTime.ParseExact(tbDateFinMissionSGM.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture))); onloadMissionTab(); enableMissionFields(false); //switch btn1 to ajouter btn1State = Btn1State.ajouter; btnAction1MissionSGM.Text = "Ajouter"; //switch btn2 to modifier btn2State = Btn2State.modifier; btnAction1MissionSGM.Text = "Modifier"; break; } }