public void EditDB(EditionModel editionModel)
        {
            string info = @"UPDATE u SET name = '" + editionModel.name + "'," +
                          "lastname='" + editionModel.lastname + "',password= '******'," +
                          "course= '" + editionModel.cours + "'," + "faculty= '" + editionModel.faculty + "'," +
                          "email= '" + editionModel.email + "'," + "numberphone= '" + editionModel.numb + "'," +
                          "groupe= '" + editionModel.group + "'," + "university= '" + editionModel.university + "'," +
                          "sex= '" + editionModel.gender + "'," + "studentticket= '" + editionModel.studentTicket + "' " +
                          " WHERE login = '******';";
            string connstring = String.Format("Server=127.0.0.1;Port=5432 ;" +
                                              "User Id=postgres;Password=root;Database=application;");
            NpgsqlConnection conn = new NpgsqlConnection(connstring);

            try
            {
                conn.Open();
            }
            catch
            {
                conn.Close();
            }
            string        id   = Guid.NewGuid().ToString();
            NpgsqlCommand cmdW = new NpgsqlCommand(info, conn);

            cmdW.ExecuteNonQuery();
            conn.Close();
        }
        public void Edition(EditionModel model)
        {
            Singleton singleton = Singleton.getInstance();

            singleton.userModel.cours         = Convert.ToInt32(model.cours);
            singleton.userModel.email         = model.email;
            singleton.userModel.faculty       = model.faculty;
            singleton.userModel.group         = model.group;
            singleton.userModel.haveGrand     = model.haveGrand;
            singleton.userModel.lastname      = model.lastname;
            singleton.userModel.name          = model.name;
            singleton.userModel.numb          = model.numb;
            singleton.userModel.passw         = model.passw;
            singleton.userModel.gender        = Convert.ToInt32(model.gender);
            singleton.userModel.studentTicket = model.studentTicket;
            singleton.userModel.university    = model.university;
            singleton.EditDB(model);
        }
Exemple #3
0
        private EditionModel CreateEditModel()
        {
            var model     = new EditionModel();
            var singleton = Singleton.getInstance();

            model.login         = singleton.userModel.login;
            model.cours         = textBox_Edit_Cours.Text;
            model.email         = textBox_Edit_Email.Text;
            model.faculty       = textBox_Edit_Faculty.Text;
            model.gender        = textBox_Edit_Gender.Text;
            model.group         = textBox_Edit_Group.Text;
            model.haveGrand     = textBox_Edit_HaveGrand.Text;
            model.lastname      = textBox_Edit_LastName.Text;
            model.name          = textBox_Edit_Name.Text;
            model.numb          = textBox_Edit_Number.Text;
            model.passw         = textBox_Edit_Password.Text;
            model.studentTicket = textBox_Edit_StudentTicket.Text;
            model.university    = textBox_Edit_University.Text;
            return(model);
        }