Example #1
0
        public void SetIndexCadru(int indexCadruSet)
        {
            try
            {
                bunifuDropdown2.Enabled = false;
                ListaAniMaterii         = new List <AnStudiu>();//o alocam de fiecare data
                ListaDetaliiGrupe       = new List <GrupaDetails>();

                this.indexCadru = indexCadruSet;

                var catalog = new CatalogEntities1();
                var materii = from c in catalog.Materies
                              where c.Profesor1ID == indexCadru || c.Profesor2ID == indexCadru || c.Asistent1ID == indexCadru || c.Asisten2ID == indexCadru
                              select c;

                bunifuDropdown1.Clear();
                foreach (var m in materii)//cautam pentru fiecare materie predata, toate grupele si luam anii
                {
                    var grupa = from g in catalog.Grupas
                                join c in catalog.AnScolars
                                on g.AnScolarID equals c.AnScolarID
                                where g.GrupaID == m.GrupaID
                                select new
                    {
                        AnPrimar       = c.AnPrimar,
                        AnSecundar     = c.AnSecundar,
                        NumeGrupa      = g.Nume,
                        IdGrupa        = g.GrupaID,
                        IdAn           = g.AnScolarID,
                        AnGrupa        = g.An,
                        SpecializareID = g.SpecializareID
                    };

                    if (grupa.Count() != 0)
                    { //daca s-a gasit un element, deoarece este o singura grupa cu id-ul respectiv
                        this.addAnMaterieLista(grupa.First().AnPrimar, grupa.First().AnSecundar);
                        //adaugam grupaID si anId in clasa
                        this.addDetaliuGrupaLista(grupa.First().IdGrupa, grupa.First().IdAn, grupa.First().NumeGrupa, grupa.First().AnGrupa, grupa.First().SpecializareID);//ne ajuta pentru dupa ce selecteaza anul
                    }
                }
                //trebuie sa sortam ListaAniMaterii
                // ListaAniMaterii.Sort();
                ListaAniMaterii.Sort((x, y) => x.an1.CompareTo(y.an1));


                foreach (AnStudiu k in this.ListaAniMaterii)//adaugam anii in care preda materii
                {
                    string addAn = k.an1.ToString() + "-" + k.an2.ToString();
                    bunifuDropdown1.AddItem(addAn);
                }

                bunifuDropdown2.Clear();//stergem dropdown-ul cu grupe pentru reconstruire
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        private void bunifuDropdown3_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown3.selectedIndex != -1)
                { //inseamna ca s-a selectat un an scolar
                    IDAn = new List <int>();
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown4.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    this.IdAnScolarSelectat     = IdAnScolari.ElementAt(bunifuDropdown3.selectedIndex);

                    //luam toate grupele care au AnScolarIdSelectat si SpecializareIdSelectata si returnam numai anii care exista
                    var catalog = new CatalogEntities1();
                    var grupe   = from g in catalog.Grupas
                                  where g.AnScolarID == IdAnScolarSelectat && g.SpecializareID == IdSpecializareSelectat
                                  select g;
                    //adaugam anii grupelo in dropDown4 ( sa fie adaugati o singura data)
                    foreach (var g in grupe)
                    {
                        AdaugareAnDropDown(g.An);
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        private void bunifuDropdown4_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown4.selectedIndex != -1)
                { //daca a fost selectat un AN
                    IdGrupe = new List <int>();
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    this.AnSelectat             = IDAn.ElementAt(bunifuDropdown4.selectedIndex);//este direct anul pe care l-a selectat


                    //adaugam toate grupele corespunzatoare An,AnScolarID,SpecializareID
                    var catalog = new CatalogEntities1();
                    var grupe   = from g in catalog.Grupas
                                  where g.An == AnSelectat && g.AnScolarID == IdAnScolarSelectat && g.SpecializareID == IdSpecializareSelectat
                                  select g;
                    foreach (var g in grupe)//adaugam fiecare grupa in dropDown5
                    {
                        AddGrupeDropDown(g.Nume, g.GrupaID);
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #4
0
        int idSpecializareSelectata;//tinem minte ce Specializare a fost selectata
        private void bunifuDropdown2_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown2.selectedIndex != -1)
                { //daca a fost selectat ceva
                    bunifuDropdown4.Clear();
                    bunifuDropdown3.Clear();
                    IdAniScolari = new List <int>();
                    this.idSpecializareSelectata = IdSpecializari.ElementAt(bunifuDropdown2.selectedIndex);

                    ////punem sa afisam toti aniiScolari: 2015-2016...
                    var catalog  = new CatalogEntities1();
                    var AnScolar = from c in catalog.AnScolars
                                   select c;
                    //adaugam indexii anilor si anii in dropdown
                    string anScolar_string = "";
                    foreach (var anscl in AnScolar)
                    {
                        anScolar_string = anscl.AnPrimar.ToString() + "-" + anscl.AnSecundar.ToString();
                        adaugareAniScoloariDropDown(anScolar_string, anscl.AnScolarID);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        private void bunifuDropdown2_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown2.selectedIndex != -1)
                {
                    IdAnScolari = new List <int>();
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown3.Clear();
                    bunifuDropdown4.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    this.IdSpecializareSelectat = IdSpecializari.ElementAt(bunifuDropdown2.selectedIndex);

                    var catalog = new CatalogEntities1();
                    var ani     = from a in catalog.AnScolars
                                  select a;
                    foreach (var a in ani)//adaugam fiecare an in dropDown3
                    {
                        AddAnScolarDropDown(a.AnPrimar, a.AnSecundar, a.AnScolarID);
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #6
0
        private void bunifuDropdown2_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown1.selectedIndex != -1 && bunifuDropdown2.selectedIndex != -1)//daca au fost selectate amandoua dropDown-urile
                {
                    bunifuCustomDataGrid1.Rows.Clear();
                    this.idSpecializareSelectata = SpecializariId.ElementAt(bunifuDropdown1.selectedIndex);
                    this.idAnScolarSelectat      = IdAniScolari.ElementAt(bunifuDropdown2.selectedIndex);

                    var catalog = new CatalogEntities1();
                    var student = from c in catalog.Students
                                  where c.SpecializareID == idSpecializareSelectata && c.AnScolarDeInceputID == idAnScolarSelectat
                                  select c;

                    foreach (var st in student)
                    { //adaugam in dataGrid
                        this.AddStudentDataGrid(st.Nume, st.Prenume);
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        public void AdaugareAniDropDown()
        {
            try
            {
                bunifuDropdown2.Clear();
                IDAniScolari = new List <int>();
                var catalog    = new CatalogEntities1();
                var aniScolari = from a in catalog.AnScolars
                                 select a;
                foreach (var a in aniScolari)
                {
                    bunifuDropdown2.AddItem(a.AnPrimar + "-" + a.AnSecundar);
                    IDAniScolari.Add(a.AnScolarID);
                }

                //adauga ani I II III IV
                bunifuDropdown3.Clear();
                for (int i = 0; i < 4; i++)
                {
                    bunifuDropdown3.AddItem(Ani[i]);
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #8
0
        int AnSelectat;//anul pe care il selecteaza : 1,2,3,4
        private void bunifuDropdown3_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown3.selectedIndex != -1)
                {
                    this.AnSelectat = IdAni.ElementAt(bunifuDropdown3.selectedIndex);
                    //afisam toate grupele cu an-ul selectat, anscolarIdSelectat, SpecializareId-Selectata
                    var catalog = new CatalogEntities1();
                    var grupe   = from c in catalog.Grupas
                                  where c.An == AnSelectat && c.AnScolarID == idAnScolarSelectat && c.SpecializareID == idSpecializareSelectata
                                  select c;

                    foreach (var grupa in grupe)
                    {
                        //adaugam in gridview
                        this.adaugareGrupaGridView(grupa.Nume);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        public void ResetAllTools()
        {
            try
            {
                IdDepartamente = new List <int>();
                bunifuCustomDataGrid1.Rows.Clear();
                bunifuDropdown1.Clear();
                bunifuDropdown2.Clear();
                bunifuDropdown3.Clear();
                bunifuDropdown4.Clear();
                bunifuDropdown5.Clear();
                bunifuDropdown6.Clear();
                bunifuMaterialTextbox1.Text = "";
                bunifuMaterialTextbox2.Text = "";

                //adaugam in primul dropDown toate departamentele care corespund id-ului facultatii
                var catalog      = new CatalogEntities1();
                var departamente = from d in catalog.Departamnets
                                   where d.FacultateID == this.idFacultate
                                   select d;
                foreach (var dep in departamente)
                {
                    //adaugam departamente in dropdown
                    this.AddDepartamentDropDown(dep.Nume, dep.DepartamentID);
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #10
0
 int IdDepartamentSelectat;//tinem minte ce departament a fost selectat
 private void bunifuDropdown1_onItemSelected(object sender, EventArgs e)
 {
     try
     {
         if (bunifuDropdown1.selectedIndex != -1)//daca a fost selectat ceva
         {
             bunifuDropdown3.Clear();
             bunifuDropdown4.Clear();
             bunifuDropdown2.Clear();
             IdSpecializari        = new List <int>();
             IdDepartamentSelectat = idDepartamente.ElementAt(bunifuDropdown1.selectedIndex);
             var catalog      = new CatalogEntities1();
             var specializare = from c in catalog.Specializares//luam toate specializarile care apartin departamentului
                                where c.DepartamentID == IdDepartamentSelectat
                                select c;
             //adaugam specializarile in al doilea dropDown
             foreach (var spec in specializare)
             {
                 adaugareSpecializariDropDown(spec.Nume, spec.SpecializareID);
             }
         }
     }
     catch (Exception ex)
     {
         FormError newForm = new FormError();
         newForm.SetText(ex.ToString());
         newForm.ShowDialog();
     }
 }
Example #11
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            //resetam toate toolurile
            bunifuDropdown1.Clear();
            bunifuDropdown2.Clear();
            bunifuDropdown3.Clear();
            bunifuMaterialTextbox3.Text = "";
            bunifuCustomDataGrid1.Rows.Clear();
            bunifuMaterialTextbox4.Text = "";
            bunifuMaterialTextbox5.Text = "";
            bunifuMaterialTextbox6.Text = "";
            bunifuMaterialTextbox7.Text = "";
            try
            {
                if (bunifuMaterialTextbox1.Text != "" && bunifuMaterialTextbox1.Text != "Adaugati Nume!" && bunifuMaterialTextbox2.Text != "" && bunifuMaterialTextbox2.Text != "Adaugati Prenume" && bunifuMaterialTextbox1.Text != "Acest student nu exista!" && bunifuMaterialTextbox2.Text != "Acest student nu exista!")
                {
                    this.NumeSelectat    = bunifuMaterialTextbox1.Text;
                    this.PrenumeSelectat = bunifuMaterialTextbox2.Text;

                    //cautam toti studentii cu numele respectiv si afisam CNP-urile
                    var catalog  = new CatalogEntities1();
                    var studenti = from s in catalog.Students
                                   where s.Nume.Equals(NumeSelectat) && s.Prenume.Equals(PrenumeSelectat)
                                   select s;
                    //verificam daca exista acest student
                    if (studenti.Count() != 0)
                    {                               //inseamna ca exista
                        foreach (var s in studenti) //adaugam CNP-urile in primul DropDown
                        {
                            this.AddCNPDropDown(s.CNP);
                        }
                    }
                    else
                    {
                        bunifuMaterialTextbox1.Text = "Acest student nu exista!";
                        bunifuMaterialTextbox2.Text = "Acest student nu exista!";
                    }
                }
                else
                {
                    if (bunifuMaterialTextbox1.Text == "")
                    {
                        bunifuMaterialTextbox1.Text = "Adaugati Nume!";
                    }
                    if (bunifuMaterialTextbox2.Text == "")
                    {
                        bunifuMaterialTextbox2.Text = "Adaugati Prenume";
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        public void add_materie(string numeMaterie, string prof1, string prof2, string asistent1, string asistent2, string procentCurs, string procentLab, string procentTeme, string procentProiect, string Examen, string credite, string notaCurs, string notaLaborator, string notaProiect, string notaFinala)
        {
            try
            {
                bunifuCustomDataGrid1.Rows.Add();
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[0].Value = numeMaterie;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[1].Value = return_numeCadru(prof1);            //cautam numele profesorului1 dupa id in functie
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[2].Value = return_numeCadru(prof2);            //cautam numele profesorului1 dupa id in functie
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[3].Value = return_numeCadru(asistent1);        //cautam numele profesorului1 dupa id in functie
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[4].Value = return_numeCadru(asistent2);        //cautam numele profesorului1 dupa id in functie
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[5].Value = procentCurs;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[6].Value = procentLab;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[7].Value = procentTeme;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[8].Value = procentProiect;
                Bitmap cale = null;
                if (Examen == "True")
                {
                    cale = new Bitmap("Green_Exam.png");
                }
                else
                {
                    cale = new Bitmap("Red_Exam.png");
                }

                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[9].Value  = cale;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[10].Value = credite;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[11].Value = notaCurs;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[12].Value = notaLaborator;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[13].Value = notaProiect;
                bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[14].Value = notaFinala;
                if (notaFinala != "-")
                {//inseamna ca a pus nota
                    int Medie = Int32.Parse(notaFinala);
                    if (Medie >= 5)
                    {//admis
                        cale = new Bitmap("Pass_Exam.png");
                        bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[15].Value = cale;
                    }
                    else
                    {
                        cale = new Bitmap("Failed_Exam.png");
                        bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[15].Value = cale;
                    }
                }
                else
                {
                    cale = new Bitmap("Failed_Exam.png");
                    bunifuCustomDataGrid1.Rows[bunifuCustomDataGrid1.Rows.Count - 1].Cells[15].Value = cale;
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #13
0
        private void bunifuDropdown1_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown1.selectedIndex != -1)
                { //inseamna ca a fost selectat un CNP
                    this.CNPSelectat = bunifuDropdown1.selectedValue;
                    //Resetam toate toolurile
                    bunifuDropdown2.Clear();
                    bunifuDropdown3.Clear();
                    bunifuMaterialTextbox3.Text = "";
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuMaterialTextbox4.Text = "";
                    bunifuMaterialTextbox5.Text = "";
                    bunifuMaterialTextbox6.Text = "";
                    bunifuMaterialTextbox7.Text = "";

                    ListaGrupe_AnScolar = new List <Grupa_AnScolar>();

                    //cautam grupele in care este studentul si luam anii scolari
                    var catalog = new CatalogEntities1();
                    var grupe   = from g in catalog.StudentiGrupas
                                  join s in catalog.Students
                                  on g.StudentID equals s.StudentID
                                  join gr in catalog.Grupas
                                  on g.GrupaID equals gr.GrupaID
                                  where s.CNP.Equals(CNPSelectat)
                                  select new
                    {
                        IdAnscolar = gr.AnScolarID,
                        GrupaId    = gr.GrupaID,
                        IdStudent  = s.StudentID
                    };
                    if (grupe.Count() != 0)
                    {
                        this.IdStudentSelectat = grupe.First().IdStudent;
                    }
                    foreach (var g in grupe)//adaugam id-ul grupei cu id-ul anului corespunzator in lista
                    {
                        //in acelasi timp le adaugam si in dropdown2
                        this.AddGrupa_AnScolar(g.GrupaId, g.IdAnscolar);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #14
0
 private void bunifuFlatButton4_Click(object sender, EventArgs e)
 {
     try
     {
         Form1.gui.Bring_Student_Afisare_Materii();
     }
     catch (Exception ex)
     {
         FormError newForm = new FormError();
         newForm.SetText(ex.ToString());
         newForm.ShowDialog();
     }
 }
Example #15
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     try
     {
         Export.Excel(StudentId, GrupaId, Semestru, ReturnFilename(StudentId));
     }
     catch (Exception ex)
     {
         FormError newForm = new FormError();
         newForm.SetText(ex.ToString());
         newForm.ShowDialog();
     }
 }
        int IdDepartamentSelectat;//tinem minte ce departament a fost selectat
        private void bunifuDropdown1_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                //dupa ce selectam Departamentul:
                if (bunifuDropdown1.selectedIndex != -1)
                { //daca a fost selectat departamentul
                    bunifuFlatButton3.Enabled = false;
                    bunifuCheckbox1.Checked   = false;
                    Bitmap cale = new Bitmap("Failed_Exam.png");
                    bunifuFlatButton1.Iconimage = cale;
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown2.Clear();
                    bunifuDropdown3.Clear();
                    bunifuDropdown4.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuDropdown7.Clear();
                    bunifuDropdown8.Clear();
                    bunifuDropdown9.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    bunifuMaterialTextbox3.Text = "";
                    bunifuMaterialTextbox4.Text = "";
                    bunifuMaterialTextbox5.Text = "";
                    bunifuMaterialTextbox6.Text = "";
                    this.ResetCheckBox();
                    IdSpecializari             = new List <int>();
                    this.IdDepartamentSelectat = idDepartamente.ElementAt(bunifuDropdown1.selectedIndex);

                    var catalog      = new CatalogEntities1();
                    var specializare = from c in catalog.Specializares//luam toate specializarile care apartin departamentului
                                       where c.DepartamentID == IdDepartamentSelectat
                                       select c;
                    //adaugam specializarile in al doilea dropDown
                    foreach (var spec in specializare)
                    {
                        adaugareSpecializariDropDown(spec.Nume, spec.SpecializareID);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        int idSpecializareSelectata;//tinem minte ce Specializare a fost selectata

        private void bunifuDropdown2_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown2.selectedIndex != -1)
                { //daca a fost selectat ceva
                    bunifuFlatButton3.Enabled = false;
                    Bitmap cale = new Bitmap("Failed_Exam.png");
                    bunifuFlatButton1.Iconimage = cale;
                    bunifuCheckbox1.Checked     = false;
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown3.Clear();
                    bunifuDropdown4.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuDropdown7.Clear();
                    bunifuDropdown8.Clear();
                    bunifuDropdown9.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    bunifuMaterialTextbox3.Text = "";
                    bunifuMaterialTextbox4.Text = "";
                    bunifuMaterialTextbox5.Text = "";
                    bunifuMaterialTextbox6.Text = "";
                    this.ResetCheckBox();
                    IdAniScolari = new List <int>();
                    this.idSpecializareSelectata = IdSpecializari.ElementAt(bunifuDropdown2.selectedIndex);

                    ////punem sa afisam toti aniiScolari: ex:2015-2016...
                    var catalog  = new CatalogEntities1();
                    var AnScolar = from c in catalog.AnScolars
                                   select c;
                    //adaugam indexii anilor si anii in dropdown
                    string anScolar_string = "";
                    foreach (var anscl in AnScolar)
                    {
                        anScolar_string = anscl.AnPrimar.ToString() + "-" + anscl.AnSecundar.ToString();
                        adaugareAniScoloariDropDown(anScolar_string, anscl.AnScolarID);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        int IdGrupaSelectata;//tinem minte Id-ul grupei care a fost selectata
        private void bunifuDropdown5_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                //dupa ce selecteaza grupa afisam toate materiile corespunzatoare cu ce am selectat
                if (bunifuDropdown5.selectedIndex != -1)
                {
                    //Resetam totul
                    bunifuFlatButton3.Enabled = false;
                    Bitmap cale = new Bitmap("Failed_Exam.png");
                    bunifuFlatButton1.Iconimage = cale;
                    bunifuCheckbox1.Checked     = false;
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown6.Clear();
                    bunifuDropdown7.Clear();
                    bunifuDropdown8.Clear();
                    bunifuDropdown9.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    bunifuMaterialTextbox3.Text = "";
                    bunifuMaterialTextbox4.Text = "";
                    bunifuMaterialTextbox5.Text = "";
                    bunifuMaterialTextbox6.Text = "";
                    this.ResetCheckBox();
                    this.IdGrupaSelectata = IndexiGrupa.ElementAt(bunifuDropdown5.selectedIndex);
                    //afisam toate materiile din grupa respectiva
                    var catalog = new CatalogEntities1();
                    var materii = from c in catalog.Materies
                                  where c.GrupaID == this.IdGrupaSelectata
                                  select c;


                    foreach (var mat in materii)
                    {
                        //adaugam in gridview
                        this.AdaugareMateriiGridView(mat.NumeMaterie);
                    }
                    bunifuMaterialTextbox1.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #19
0
        private void bunifuDropdown2_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown2.selectedIndex != -1)
                { //daca a fost selectat un anScolar
                    this.IdAnScolarSelectat = ListaGrupe_AnScolar.ElementAt(bunifuDropdown2.selectedIndex).IDAnScolar;
                    this.IdGrupaSelectata   = ListaGrupe_AnScolar.ElementAt(bunifuDropdown2.selectedIndex).IDGrupa;
                    //resetam toate tool-urile
                    bunifuDropdown3.Clear();
                    bunifuMaterialTextbox3.Text = "";
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuMaterialTextbox4.Text = "";
                    bunifuMaterialTextbox5.Text = "";
                    bunifuMaterialTextbox6.Text = "";
                    bunifuMaterialTextbox7.Text = "";
                    this.IdMaterii = new List <int>();

                    //cautam toate materiile grupei selectate
                    var catalog = new CatalogEntities1();
                    var materii = from m in catalog.Materies
                                  where m.GrupaID == IdGrupaSelectata
                                  select m;
                    foreach (var m in materii)
                    { //adaugam materia in dropdown
                      //adaugam in datagrid

                        var note = from n in catalog.Notas
                                   where n.MaterieID == m.MaterieID && n.StudentID == IdStudentSelectat && n.AnScolarID == IdAnScolarSelectat
                                   select n;
                        foreach (var n in note)//adaugam notele in dataGridView
                        {
                            this.AddNoteDataGridView(m.NumeMaterie, n.Sesiune, (int)n.NotaCurs, (int)n.NotaLaborator, (int)n.NotaProiect, (int)n.NotaFinala);
                        }
                        //end adaugare in datagrid

                        this.AddMateriiDropDown(m.NumeMaterie, m.MaterieID);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        private void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            try
            {
                if (bunifuMaterialTextbox1.Text != "" && bunifuMaterialTextbox1.Text != "Adaugati Nume!" && bunifuMaterialTextbox2.Text != "" && bunifuMaterialTextbox2.Text != "Adaugati Prenume!" && bunifuMaterialTextbox1.Text != "Acest Student Nu Exista!" && bunifuMaterialTextbox2.Text != "Acest Student Nu Exista!")
                {
                    bunifuDropdown6.Clear();
                    string NumeStudent    = bunifuMaterialTextbox1.Text;
                    string PrenumeStudent = bunifuMaterialTextbox2.Text;
                    //daca un nume si un prenume au fost adaugate, cautam toti studentii cu aceste nume si returnam cnp-urile (in caz ca sunt mai mutli cu acelasi nume si prenume)
                    var catalog  = new CatalogEntities1();
                    var studenti = from s in catalog.Students
                                   where s.Nume.Equals(NumeStudent) && s.Prenume.Equals(PrenumeStudent)
                                   select s;

                    if (studenti.Count() != 0)
                    {                                //inseamna ca exista
                        foreach (var st in studenti) //adaugam cnp-urile in dropdown6
                        {
                            this.AddCNPDropDown(st.CNP);
                        }
                    }
                    else//nu exista studentul cautat
                    {
                        bunifuMaterialTextbox1.Text = "Acest Student Nu Exista!";
                        bunifuMaterialTextbox2.Text = "Acest Student Nu Exista!";
                    }
                }
                else
                {
                    if (bunifuMaterialTextbox1.Text == "")
                    {
                        bunifuMaterialTextbox1.Text = "Adaugati Nume!";
                    }
                    if (bunifuMaterialTextbox2.Text == "")
                    {
                        bunifuMaterialTextbox2.Text = "Adaugati Prenume!";
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #21
0
        private void bunifuDropdown1_Student_Sesiunea_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                int anCautat = AnInceputStudent + anSelectat_int;
                Form1.gui.Reset_StudentMateriiView();
                //luam toate materiile care apartin grupei si au si sesiunea selectata

                if (bunifuDropdown1_Student_Sesiunea.selectedIndex != -1)
                {
                    string sesiune_SelectataString = bunifuDropdown1_Student_Sesiunea.selectedValue;
                    sesiune_Selectata = Int32.Parse(sesiune_SelectataString);

                    var catalog       = new CatalogEntities1();
                    var lista_materii = from m in catalog.Materies
                                        where m.GrupaID == grupaCautata_Student && m.Sesiune == sesiune_Selectata
                                        select m;

                    foreach (var materie in lista_materii)
                    {
                        //luam si nota materiei respective
                        var nota = from n in catalog.Notas
                                   join a in catalog.AnScolars
                                   on n.AnScolarID equals a.AnScolarID
                                   where (n.StudentID == indexStudent) && (n.MaterieID == materie.MaterieID)// && ((a.AnPrimar ==anCautat) ||(a.AnSecundar ==anCautat))
                                   orderby n.NotaFinala descending
                                   select n;

                        //adaugam materia cu tot cu note
                        if (nota.Count() != 0)//daca exisa nota sau nu pentru materia respectiva
                        {
                            Form1.gui.AddMaterie_Student(materie.NumeMaterie, materie.Profesor1ID.ToString(), materie.Profesor2ID.ToString(), materie.Asistent1ID.ToString(), materie.Asisten2ID.ToString(), materie.ProcentCurs.ToString(), materie.ProcentLaborator.ToString(), materie.ProcentTeme.ToString(), materie.ProcentProiect.ToString(), materie.Examen.ToString(), materie.Credite.ToString(), nota.First().NotaCurs.ToString(), nota.First().NotaLaborator.ToString(), nota.First().NotaProiect.ToString(), nota.First().NotaFinala.ToString());
                        }
                        else//daca inca nu exita nota
                        {
                            Form1.gui.AddMaterie_Student(materie.NumeMaterie, materie.Profesor1ID.ToString(), materie.Profesor2ID.ToString(), materie.Asistent1ID.ToString(), materie.Asisten2ID.ToString(), materie.ProcentCurs.ToString(), materie.ProcentLaborator.ToString(), materie.ProcentTeme.ToString(), materie.ProcentProiect.ToString(), materie.Examen.ToString(), materie.Credite.ToString(), "-", "-", "-", "-");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
        int AnSelectat;//anul pe care il selecteaza : 1,2,3,4
        private void bunifuDropdown4_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                if (bunifuDropdown4.selectedIndex != -1)
                {
                    IndexiGrupa = new List <int>();
                    //Resetam totul
                    bunifuCheckbox1.Checked   = false;
                    bunifuFlatButton3.Enabled = false;
                    Bitmap cale = new Bitmap("Failed_Exam.png");
                    bunifuFlatButton1.Iconimage = cale;
                    bunifuCustomDataGrid1.Rows.Clear();
                    bunifuDropdown5.Clear();
                    bunifuDropdown6.Clear();
                    bunifuDropdown7.Clear();
                    bunifuDropdown8.Clear();
                    bunifuDropdown9.Clear();
                    bunifuMaterialTextbox1.Text = "";
                    bunifuMaterialTextbox2.Text = "";
                    bunifuMaterialTextbox3.Text = "";
                    bunifuMaterialTextbox4.Text = "";
                    bunifuMaterialTextbox5.Text = "";
                    bunifuMaterialTextbox6.Text = "";
                    this.ResetCheckBox();
                    this.AnSelectat = IdAni.ElementAt(bunifuDropdown4.selectedIndex);
                    //afisam toate grupele cu an-ul selectat, anscolarIdSelectat, SpecializareId-Selectata
                    var catalog = new CatalogEntities1();
                    var grupe   = from c in catalog.Grupas
                                  where c.An == AnSelectat && c.AnScolarID == idAnScolarSelectat && c.SpecializareID == idSpecializareSelectata
                                  select c;

                    foreach (var grupa in grupe)
                    {
                        //adaugam in gridview
                        this.adaugareGrupeDropDown(grupa.Nume, grupa.GrupaID);
                    }
                }
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.ToString());
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #23
0
 public void addDetaliuGrupaLista(int GrupaIdDet, int AnIdDet, string NumeGrupaDet, int AnGrupaDet, int SpecializareIDdet)
 {
     try
     {
         if (!ExistGrupaDetails(GrupaIdDet, AnIdDet))
         {
             GrupaDetails temp = new GrupaDetails(GrupaIdDet, AnIdDet, NumeGrupaDet, AnGrupaDet, SpecializareIDdet);
             ListaDetaliiGrupe.Add(temp);
         }
     }
     catch (Exception ex)
     {
         FormError newForm = new FormError();
         newForm.SetText(ex.ToString());
         newForm.ShowDialog();
     }
 }
Example #24
0
 public void setIdGrupaSelectata(int IdGrupa)
 {
     try
     {
         this.idGrupaSelectata = IdGrupa;
         this.id_Materii       = new List <int>();                            //sa tinem minte id-urile materiilor in ordinea din gridview
         foreach (DataGridViewColumn column in bunifuCustomDataGrid1.Columns) //facem sa nu poata fii sortate deoarece se incurca indexii
         {
             column.SortMode = DataGridViewColumnSortMode.NotSortable;
         }
     }
     catch (Exception ex)
     {
         FormError newForm = new FormError();
         newForm.SetText(ex.ToString());
         newForm.ShowDialog();
     }
 }
Example #25
0
        private void bunifuFlatButton1_CautaMaterii_Click(object sender, EventArgs e)
        {
            try
            {
                Form1.gui.ResetGridViewMaterii_Cadru();

                //verificam daca a selectat ambele campuri
                if (bunifuDropdown1.selectedIndex != -1 && bunifuDropdown2.selectedIndex != -1)
                {
                    //Construim lista de materii
                    int IndexGrupaSelectata = bunifuDropdown2.selectedIndex;
                    int IdGrupaCautata      = ListaId_grupaDropDown.ElementAt(IndexGrupaSelectata);

                    //setam id-ul grupei selectate
                    Form1.gui.setIdGrupaSelectata(IdGrupaCautata);

                    //adaugam materiile
                    var catalog = new CatalogEntities1();
                    var materii = from m in catalog.Materies
                                  where m.GrupaID == IdGrupaCautata && (m.Profesor1ID == indexCadru || m.Profesor2ID == indexCadru || m.Asistent1ID == indexCadru || m.Asisten2ID == indexCadru)
                                  select m;

                    foreach (var materieAdd in materii)
                    {
                        Form1.gui.AddMaterii_Cadru(materieAdd.MaterieID, materieAdd.NumeMaterie, materieAdd.ProcentCurs.ToString(), materieAdd.ProcentLaborator.ToString(), materieAdd.ProcentTeme.ToString(), materieAdd.ProcentProiect.ToString(), materieAdd.Examen, materieAdd.Credite.ToString(), materieAdd.Sesiune.ToString());
                    }
                    Form1.gui.Bring_CadruAfisareMaterii();
                }
                else if (bunifuDropdown1.selectedIndex == -1)
                {
                    bunifuDropdown1.NomalColor = Color.Red;
                }
                else if (bunifuDropdown2.selectedIndex == -1)
                {
                    bunifuDropdown2.NomalColor = Color.Red;
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #26
0
        private void bunifuDropdown1_onItemSelected(object sender, EventArgs e)
        {
            try
            {
                this.ListaId_grupaDropDown = new List <int>();//alocam lista de id-uri care corespund cu indexii din dropdown
                bunifuDropdown2.Clear();
                bunifuDropdown2.Enabled = true;

                int anSelectatIndex = bunifuDropdown1.selectedIndex;
                int an1Selectat     = ListaAniMaterii.ElementAt(anSelectatIndex).an1;
                int an2Selectat     = ListaAniMaterii.ElementAt(anSelectatIndex).an2;


                var    catalog         = new CatalogEntities1();
                string numeGrupaSpaces = "";
                int    IdForAdd        = 0;//id-ul care se va adauga in lista pt dropDown
                foreach (GrupaDetails g in ListaDetaliiGrupe)
                {
                    var anGrupa = from c in catalog.AnScolars//luam anii corespunzatori id-ului
                                  where c.AnScolarID == g.AnId
                                  select c;

                    foreach (var anGrupaCautat in anGrupa)
                    {
                        if (anGrupaCautat.AnPrimar == an1Selectat && anGrupaCautat.AnSecundar == an2Selectat)
                        { //se potriveste si anul
                            IdForAdd = g.GrupaId;
                            ListaId_grupaDropDown.Add(IdForAdd);
                            numeGrupaSpaces = removeSpaces(g.NumeGrupa);
                            bunifuDropdown2.AddItem(numeGrupaSpaces + "\r\n   Anul: " + g.AnGrupa + "\r\n   " + g.SpecializareGrupa);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #27
0
 private void bunifuFlatButton1_anScolar_Click(object sender, EventArgs e)
 {
     try
     {
         Form1.gui.Bring_AdminAdaugaAnScolarFirstPage();
         //aici adaugam toti anii existenti in tabela si mai adaugam si atunci cand adauga
         var catalog    = new CatalogEntities1();
         var aniScolari = from c in catalog.AnScolars
                          select c;
         foreach (var an in aniScolari)
         {
             Form1.gui.AdaugareAnScolar_Admin(an.AnPrimar, an.AnSecundar);
         }
     }
     catch (Exception ex)
     {
         FormError newForm = new FormError();
         newForm.SetText(ex.ToString());
         newForm.ShowDialog();
     }
 }
Example #28
0
        private void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            try
            {
                Form1.gui.Bring_AdminAdaugareSpecializare();

                var catalog     = new CatalogEntities1();
                var departament = from c in catalog.Departamnets//luam toate departamentele din aceasta facultate
                                  where c.FacultateID == IdFacultate
                                  select c;
                foreach (var dep in departament)
                {
                    Form1.gui.AdaugareDepartament_DropDown(dep.Nume, dep.DepartamentID);
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #29
0
        private void bunifuFlatButton2_AddDepartament_Click(object sender, EventArgs e)
        {
            try
            {
                Form1.gui.Bring_AdminAdaugaDepartament();
                Form1.gui.SetFacultateId_AdDepartament(IdFacultate);

                var catalog     = new CatalogEntities1();
                var departament = from c in catalog.Departamnets
                                  select c;
                foreach (var dep in departament)
                {
                    Form1.gui.AdminAddDepartament(dep.Nume);
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }
Example #30
0
        int SefDepartamentID;//daca e 0 inseamna ca nu e sefDepartament
        public void SetSefDepartament_Cadre(int IdSefDepartament)
        {
            try
            {
                this.SefDepartamentID = IdSefDepartament;
                this.IdFacultate      = 0;
                if (SefDepartamentID == 0 && DecanID == 0)
                {
                    bunifuFlatButton3.Enabled = false;
                }
                else if (SefDepartamentID != 0 && DecanID == 0)//daca nu e decan
                {
                    string DepartamentNumeSelectat = "";
                    bunifuFlatButton3.Enabled = true;
                    //cautam la ce departament este
                    var catalog     = new CatalogEntities1();
                    var departament = from d in catalog.Departamnets
                                      where d.SefDepartament == SefDepartamentID
                                      select d;
                    if (departament.Count() != 0)
                    {
                        this.DepartamentId_SefDepartament = departament.First().DepartamentID;
                        this.IdFacultate        = departament.First().FacultateID;
                        DepartamentNumeSelectat = departament.First().Nume;
                    }
                    //dupa ce am aflat departament id --> il bagam si il selectam automat
                    Form1.gui.Cadru_firstPageStatistici_AddDepartamentAutoSelect(DepartamentNumeSelectat, DepartamentId_SefDepartament);


                    //anii scolari ii bagam la bring
                }
            }
            catch (Exception ex)
            {
                FormError newForm = new FormError();
                newForm.SetText(ex.ToString());
                newForm.ShowDialog();
            }
        }