Example #1
0
        private void buttonExemplaireBibliotheque_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceReferenceCopy.ServiceExemplairesClient se = new ServiceReferenceCopy.ServiceExemplairesClient();

                gridData.DataSource = se.GetAllExemBiblio(comboBoxBiblio.SelectedValue.ToString());
                if (gridData != null)
                {
                    gridData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                    gridData.Columns[gridData.ColumnCount - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                }
                gridData.Columns["achat"].Visible        = false;
                gridData.Columns["date_emprunt"].Visible = false;
                gridData.Columns["id_biblio"].Visible    = false;
                gridData.Columns["idLivre"].Visible      = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceReferenceLecteur.ServiceLecteurClient s_lect = new ServiceReferenceLecteur.ServiceLecteurClient();



                var x = s_lect.getAll(userTextBox.Text, textBoxPassword.Text, comboBoxBiblio.SelectedItem.ToString());



                if (x.Count() > 0)
                {
                    myuser              = userTextBox.Text;
                    mybiblio            = comboBoxBiblio.SelectedValue.ToString();
                    gridData.DataSource = null;

                    ServiceReferenceCopy.ServiceExemplairesClient se = new ServiceReferenceCopy.ServiceExemplairesClient();
                    gridData.DataSource = se.GetAllExemBiblio(comboBoxBiblio.SelectedValue.ToString());
                    gridData.Columns["achat"].Visible        = false;
                    gridData.Columns["date_emprunt"].Visible = false;
                    gridData.Columns["id_biblio"].Visible    = false;
                    gridData.Columns["idLivre"].Visible      = false;

                    label1.Text = "Bonjour " + userTextBox.Text + ",  vous êtes à " + comboBoxBiblio.SelectedValue.ToString();
                    if (gridData != null)
                    {
                        gridData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                        gridData.Columns[gridData.ColumnCount - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                    }
                    MessageBox.Show("Hello " + userTextBox.Text + ", you're now connected to  " + comboBoxBiblio.SelectedValue.ToString());

                    panelLog.Hide();
                    MajorPanel.Show();
                }
                else
                {
                    MessageBox.Show("utisateur non connu ");
                }
            }
            catch (SqlException ex)
            {
                string myerror;
                switch (ex.Number)
                {
                case 18456:
                    myerror = "mauvais user";
                    break;

                case 4060:
                    myerror = "mauvaise db";
                    break;

                default:
                    myerror = ex.Message;
                    break;
                }
                MessageBox.Show("une erreur est survenue détails: " + myerror);
            }
        }