Exemplo n.º 1
0
        private void btnConnection_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string login    = tbxLogin.Text;
                string password = tbxPassword.Text;

                string request = $"SELECT COUNT(cpt_login) FROM compte WHERE cpt_login = '******' AND cpt_pwd = MD5('{password}');";

                CURS cs = new CURS(CURS.connectionString);

                if (cs.Count(request) == "1")
                {
                    CURS csSelectContributor = new CURS(CURS.connectionString);

                    request = $"SELECT collaborateur.cob_id, statut.sta_libelle FROM compte " +
                              $"INNER JOIN collaborateur ON compte.fk_cob_id = collaborateur.cob_id " +
                              $"INNER JOIN statut ON collaborateur.fk_sta_id = statut.sta_id " +
                              $"WHERE cpt_login = '******'";

                    csSelectContributor.ReqSelect(request);

                    UserSession.Id     = csSelectContributor.Field("cob_id").ToString();
                    UserSession.Statut = csSelectContributor.Field("sta_libelle").ToString();

                    MainMenu f = new MainMenu();
                    this.Hide();
                    f.Show();
                }
                else
                {
                    throw new Exception("Les identifiants sont incorrectes.");
                }
            }
            catch (Exception E)
            {
                MessageBox.Show(E.Message);
            }
        }
Exemplo n.º 2
0
        public MainMenu()
        {
            InitializeComponent();

            tbxVisitorMatricule.Text = UserSession.Id;

            string request;
            CURS   cs = new CURS(CURS.connectionString);

            request = $"SELECT * FROM rapport WHERE fk_cob_id = '{ tbxVisitorMatricule.Text }';";
            cs.ReqSelect(request);
            while (!cs.End())
            {
                dgdReports.Items.Add(new Report()
                {
                    IdVisitor      = cs.Field("fk_cob_id").ToString(),
                    IdReport       = cs.Field("rap_id").ToString(),
                    IdPractitioner = cs.Field("fk_pra_id").ToString(),
                    VisiteDate     = cs.Field("rap_dateVisite").ToString()
                });
                cs.suivant();
            }
        }