示例#1
0
 public void save()
 {
     DBConnect proc = new DBConnect();
     if (this.id < 0)
     {
         proc.addPoste(nom, description);
         id = Convert.ToInt32(proc.getLastStuff("Poste").Rows[0]["last_insert_rowid()"].ToString());
     }
     else
     {
         proc.modifyPoste(id, nom, description);
     }
 }
示例#2
0
 public void save()
 {
     DBConnect proc = new DBConnect();
     int id = -1;
     if (id < 0)
     {
         proc.addPoste(pname, pdesc);
         //id = Convert.ToInt32(proc.getLastStuff("Poste").Rows[0]["last_insert_rowid()"].ToString());
     }
     else
     {
         proc.modifyPoste(id, pname, pdesc);
     }
 }
示例#3
0
        public void save()
        {
            int id = -1;
            DBConnect proc = new DBConnect();
            if (id < 0)
            {
                proc.addTeam(ename, edesc);
                //id = Convert.ToInt32(proc.getLastStuff("Team").Rows[0]["last_insert_rowid()"].ToString());
            }
            else
            {
                proc.modifyTeam(id, ename, edesc);

                proc.deleteTeamProfile(id);
            }
        }
示例#4
0
        public void save()
        {
            DBConnect proc = new DBConnect();
            if (this.id < 0)
            {
                proc.addTeam(nom, description);
                id = Convert.ToInt32(proc.getLastStuff("Team").Rows[0]["last_insert_rowid()"].ToString());
            }
            else
            {
                proc.modifyTeam(id, nom, description);

                proc.deleteTeamProfile(id);
            }

            foreach (Ressource lui in profils)
            {
                proc.addTeamProfile(id, lui.getId(), -1);
            }
        }
示例#5
0
        public void save(Boolean removeP = false)
        {
            DBConnect proc = new DBConnect();
            if (this.id <= 0 || (this.isPreset && removeP))
            {
                proc.addBlock(debut.ToString("yyyy-MM-dd HH:mm:ss"), fin.ToString("yyyy-MM-dd HH:mm:ss"), typeBloc, isPreset);
                id = Convert.ToInt32(proc.getLastStuff("Block").Rows[0]["idBlock"].ToString());
                isPreset = false;

            }
            else
            {
                proc.modifyBlock(debut.ToString("yyyy-MM-dd HH:mm:ss"), fin.ToString("yyyy-MM-dd HH:mm:ss"), id, isPreset);

                proc.deleteRessource(id);

            }
            foreach (RessourceEntree lui in ressourcesVoulus)
            {

                if (lui.voulue is Equipe)
                    proc.addRessource(id, 0, lui.voulue.getId(), lui.nbVoulue);
                else
                    proc.addRessource(id, lui.voulue.getId(), 0, lui.nbVoulue);
            }
        }
示例#6
0
 private void button1_Click(object sender, EventArgs e)
 {
     dbc = new DBConnect();// enabling the DB conection
     bouton_requete.Enabled = true;
        // MessageBox.Show(this, "connecté");
 }
示例#7
0
        private void treeView_modemploye_AfterSelect(object sender, TreeViewEventArgs e)
        {
            Profil ressource = null;
            Chilkat.Xml xmlProfiles = new Chilkat.Xml();
            xmlProfiles.LoadXmlFile("profiles.xml");

            Chilkat.Xml xmlPoste7 = new Chilkat.Xml();
            xmlPoste7.LoadXmlFile("postes.xml");
            treeView_postdispo.Nodes.Clear();
            treeView_postechoisi.Nodes.Clear();
            FillTree(treeView_postdispo.Nodes, xmlPoste7);

            String textInForm;
            textInForm = treeView_modemploye.SelectedNode.Text.ToString();
            String id;
            int idprofil;
            id = findRessourceXML(textInForm, xmlProfiles);

            if (id != null)
            {
                profilSelected = (Profil)loader.findRessource(Convert.ToInt32(id), loader.profilCharge);
                ressource = profilSelected;
                idprofil = ressource.getId();
                numemp_textbox.Text = ressource.getId().ToString();
                nom_textbox.Text = ressource.getNom();
                prenom_textbox.Text = ressource.getPrenom();
                courriel_textbox.Text = ressource.getEmail();
                telephone_textbox.Text = ressource.getNumTelephone();
                DataTable datatable;
                DataTable datatable2;
                DBConnect proc = new DBConnect();
                datatable = proc.getPosteProfil2(idprofil);
                int pid;
                String pname;

                for(int i = 0; i < datatable.Rows.Count; i++)
                {

                    pid = Convert.ToInt32(datatable.Rows[i]["idPoste"]);
                    datatable2 = proc.getPoste2(pid);
                    pname = datatable2.Rows[0]["nom"].ToString();

                    //pname = datatable.Rows[i].ToString();

                    System.Windows.Forms.TreeNode name;
                    name = new System.Windows.Forms.TreeNode(pname);
                    this.treeView_postechoisi.Nodes.Add(pname);

                    for (int j = 0; j < treeView_postdispo.Nodes.Count; j++)
                    {
                        if (treeView_postdispo.Nodes[j].Text.ToString() == pname)
                        {
                            treeView_postdispo.Nodes[j].Remove();
                        }
                    }

                    this.treeView_postdispo.Nodes.Remove(name);

                }

            }
        }
示例#8
0
        private void supprimer_button_Click(object sender, EventArgs e)
        {
            DBConnect proc = new DBConnect();
            int idprofil = Convert.ToInt32(numemp_textbox.Text.ToString());
            String nom = nom_textbox.Text.ToString();
            String prenom = prenom_textbox.Text.ToString();
            String email = courriel_textbox.Text.ToString();
            String telephone = telephone_textbox.Text.ToString();

            proc.deleteEmploye(idprofil, nom, prenom, email, telephone);
            numemp_textbox.Text = "";
            nom_textbox.Text = "";
            prenom_textbox.Text = "";
            courriel_textbox.Text = "";
            telephone_textbox.Text = "";

            CreateXml.CreateProfileXml();
            Chilkat.Xml xmlProfiles7 = new Chilkat.Xml();
            xmlProfiles7.LoadXmlFile("profiles.xml");
            Chilkat.Xml xmlPoste19 = new Chilkat.Xml();
            xmlPoste19.LoadXmlFile("postes.xml");

            treeView_modemploye.Nodes.Clear();
            treeView_postdispo.Nodes.Clear();
            treeView_postechoisi.Nodes.Clear();
            FillTree(treeView_modemploye.Nodes, xmlProfiles7);
            FillTree(treeView_postdispo.Nodes, xmlPoste19);
        }
示例#9
0
        public void modifierBlock(Bloc leBloc)
        {
            string hDebut = leBloc.getDebut().Hour + "";
            string hFin = (leBloc.getFin().Hour + 1) + "";
            bool preset = leBloc.getPreset();

            DateTime debut = leBloc.getDebut();
            DateTime fin = leBloc.getFin();

            ModificationBloc modifbloc = new ModificationBloc(hDebut, hFin, preset, blocs);
            modifbloc.ShowDialog();

            if (modifbloc.isValide())
            {
                if (modifbloc.getCommande() == 0)
                {
                    //Modification d'un bloc
                    //Compute Nouvelle Date ** Ajouter validation **

                    int dateDebut = int.Parse(modifbloc.getHd());
                    int dateFin = int.Parse(modifbloc.getHf());

                    DateTime tempDebut = new DateTime(debut.Year, debut.Month, debut.Day, dateDebut, debut.Minute, debut.Second);
                    DateTime tempFin = new DateTime(fin.Year, fin.Month, fin.Day, dateFin - 1, fin.Minute, fin.Second);

                    Bloc leBloc2 = leBloc;
                    leBloc2.setDebut(tempDebut);
                    leBloc2.setFin(tempFin);
                    leBloc2.setPreset(modifbloc.getPreset());

                    if (modifbloc.placementValide(leBloc2))
                    {

                        if (loader != null && loader.modifierBloc(leBloc, leBloc2))
                        { //Ajout du bloc confirmé

                        } //
                        else
                        {
                            if (loader != null)
                                MessageBox.Show("Bloc introuvable");
                            else
                            {

                                if (profil != null && laGrille.isPref && profil.modifierBloc(leBloc, leBloc2, true))
                                { //lolnigger

                                }
                                else
                                {
                                    if (profil != null && !laGrille.isPref && profil.modifierBloc(leBloc, leBloc2, false))
                                    { //lolnigger

                                    }
                                }

                            }

                        }
                    }
                    else
                    {

                    }
                }

                else
                //Suppression d'un Bloc
                {
                    if (profil == null)
                        loader.supprimerBloc(leBloc);
                    else
                    {
                        if (loader == null && laGrille.isPref)
                            profil.getPref().Remove(leBloc);
                        else
                        {
                            if (loader == null && !laGrille.isPref)
                                profil.getDispo().Remove(leBloc);
                        }

                    }

                DBConnect uneConnect = new DBConnect();
                uneConnect.deleteBlock(leBloc.getId());
                }

            }
            modifbloc.Dispose();
        }
示例#10
0
 public void delete(String equipe)
 {
     DBConnect proc = new DBConnect();
     proc.deleteTeam2(equipe);
 }
示例#11
0
 public void delete(String poste)
 {
     DBConnect proc = new DBConnect();
     proc.deletePoste2(poste);
 }
示例#12
0
        public static void CreateProfileXml()
        {
            DBConnect proc = new DBConnect();
            DataTable rs3;
            DataTable rs2;
            DataTable rs;
            int i = 0;
            int j = 0;
            int k = 0;
            rs = proc.getAllProfil();
            rs2 = proc.getAllPoste();
            rs3 = proc.getAllTeam();

            // Create the root node of a new XML document.
            Chilkat.Xml xml = new Chilkat.Xml();

            // This is going to be a collection of contacts.
            xml.Tag = "profiles";

            // Create a child node to hold a contact record.
            // Our "xml" object will now reference the new node.
            while (i < rs.Rows.Count)
            {
                xml = xml.NewChild("profil", "");

                // Create a "company" record.  NewChild2 does not return the child node that is created
                xml.NewChild2("id", Convert.ToString(rs.Rows[i]["idProfil"]));
                xml.NewChild2("nom", rs.Rows[i]["nom"].ToString()+", "+rs.Rows[i]["prenom"].ToString());
                xml.NewChild2("email", rs.Rows[i]["email"].ToString());
                xml.NewChild2("phone", rs.Rows[i]["phoneNumber"].ToString());
                xml.NewChild2("seniority", Convert.ToString(rs.Rows[i]["seniority"]));

                // Move up the tree and create another contact record.
                // GetParent2 updates our internal reference to the parent.
                xml.GetParent2();
                i++;
            }

            // We can always get back to the root by calling GetRoot (or GetRoot2)
            xml.GetRoot2();

            // Add the tag that specifies our character encoding.
            xml.Encoding = "utf-8";

            // Save the document.
            xml.SaveXml("profiles.xml");

            //GÉNÉRATION DE POSTES.XML
            xml = new Chilkat.Xml();
            xml.Tag = "postes";
            while (j < rs2.Rows.Count)
            {
                xml = xml.NewChild("poste", "");
                xml.NewChild2("id", Convert.ToString(rs2.Rows[j]["idPoste"]));
                xml.NewChild2("nom", rs2.Rows[j]["nom"].ToString());
                xml.NewChild2("description", rs2.Rows[j]["description"].ToString());
                xml.GetParent2();
                j++;
            }
            // We can always get back to the root by calling GetRoot (or GetRoot2)
            xml.GetRoot2();

            // Add the tag that specifies our character encoding.
            xml.Encoding = "utf-8";

            // Save the document.
            xml.SaveXml("postes.xml");

            //GÉNÉRATION DE POSTES.XML
            xml = new Chilkat.Xml();
            xml.Tag = "teams";
            while (k < rs3.Rows.Count)
            {
                xml = xml.NewChild("team", "");
                xml.NewChild2("id", Convert.ToString(rs3.Rows[k]["idTeam"]));
                xml.NewChild2("nom", rs3.Rows[k]["nom"].ToString());
                xml.NewChild2("description", rs3.Rows[k]["description"].ToString());
                xml.GetParent2();
                k++;
            }
            // We can always get back to the root by calling GetRoot (or GetRoot2)
            xml.GetRoot2();

            // Add the tag that specifies our character encoding.
            xml.Encoding = "utf-8";

            // Save the document.
            xml.SaveXml("teams.xml");
        }
示例#13
0
        public void save(bool mod)
        {
            DBConnect proc = new DBConnect();
            if (mod == false)
            {
                proc.ajouterProfil(id, prenom, nom, numTelephone, heuresMax, 0, email, anciennete);
                foreach (Ressource lui in poste)
                {

                    proc.addPosteProfil(lui.getId(), id);
                    mod = true;

                }

            }
            else
                if (mod == true)
                {
                    int i;
                    proc.modifierProfil(id, prenom, nom, numTelephone, heuresMax, 0, email, anciennete);
                    foreach (Ressource lui in poste)
                    {

                        for(i = 0; i <= 3; i++)
                        {
                            proc.deletePosteProfil(id);
                        }
                        proc.addPosteProfil(lui.getId(), id);
                    }
                }
            proc.deleteProfilPreference(id);

            foreach (Bloc pref in preference)
            {
                if (pref.getId() < 0)
                    proc.addPlage(pref.getDebut().ToString("yyyy-MM-dd HH:mm:ss"), pref.getFin().ToString("yyyy-MM-dd HH:mm:ss"), Loader.SemaineToInt(pref.getFin()));
                proc.addProfilPreference(id, Convert.ToInt32(proc.getLastStuff("Plage").Rows[0]["idPlage"].ToString()));
            }
            proc.deleteProfilDispo(id);

            foreach (Bloc dispo in disponibilite)
            {
                proc.addPlage(dispo.getDebut().ToString("yyyy-MM-dd HH:mm:ss"), dispo.getFin().ToString("yyyy-MM-dd HH:mm:ss"), Loader.SemaineToInt(dispo.getFin()));
                proc.addProfilDispo(id, Convert.ToInt32(proc.getLastStuff("Plage").Rows[0]["idPlage"].ToString()));
            }
        }