コード例 #1
0
        public void incarcaFisiereXML(ListBox lb_elevi, ListBox lb_perechi, string filePath)
        {
            XDocument doc = XDocument.Load(filePath);

            string date_start  = null;
            string date_finish = null;

            try
            {
                date_start  = doc.Root.FirstAttribute.Value;
                date_finish = doc.Root.LastAttribute.Value;
            }
            catch { }

            AnScolar asc = new AnScolar();

            asc.start  = Convert.ToDateTime(date_start);
            asc.finish = Convert.ToDateTime(date_finish);
            vacanteHelper.SetAnScolar = asc;

            List <Vacante> lista_vacante = vacanteHelper.GetListaVacante;

            var vacante = doc.Descendants("vacanta");

            foreach (var v in vacante)
            {
                Vacante temp = new Vacante();
                temp.id     = Convert.ToInt32(v.Attribute("id").Value);
                temp.tip    = Convert.ToChar(v.Attribute("tip").Value);
                temp.start  = Convert.ToDateTime(v.Attribute("start").Value);
                temp.finish = Convert.ToDateTime(v.Attribute("finish").Value);
                lista_vacante.Add(temp);
            }

            var elevi = doc.Descendants("elev");

            foreach (var e in elevi)
            {
                lb_elevi.Items.Add(e.Value);
            }

            var perechi = doc.Descendants("pereche");

            foreach (var p in perechi)
            {
                lb_perechi.Items.Add(p.Value);
            }
        }
コード例 #2
0
        public void adaugaVacanta(char tip, DateTime start, DateTime finish, DataGridView dgv)
        {
            int     id   = genereazaIDVacanta();
            Vacante temp = new Vacante();

            temp.id     = id;
            temp.tip    = tip;
            temp.start  = start;
            temp.finish = finish;
            lista_vacante.Add(temp);

            //incarca cate o vacanta in DGV, fix dupa adaugare
            incarcaVacanteDGV(id, tip, start, finish, dgv);

            SaveFileHelper.unsavedChanges = true;
        }