Пример #1
0
        private void btnAddClient_Click(object sender, EventArgs e)
        {
            ClientManage c = new ClientManage();

            c.ShowDialog();

            string        cs = ConfigurationManager.ConnectionStrings["CafeManagementNH.Properties.Settings.cafeManagementNHConnectionString"].ConnectionString;
            SqlConnection cn = new SqlConnection(cs);

            cn.Open();
            SqlCommand    comClient = new SqlCommand("Select * from Users", cn);
            SqlDataReader dr        = comClient.ExecuteReader();

            cbClient.Items.Clear();
            listBox1.Items.Clear();
            while (dr.Read())
            {
                cbClient.Items.Add(dr["UserName"]);
                listBox1.Items.Add(dr["IdUser"]);
            }

            cbClient.SelectedIndex = 0;
            if (cbClient.SelectedIndex == -1)
            {
                cbClient.SelectedIndex = 0;
            }

            dr.Close();
            dr = null;
        }
Пример #2
0
        private void btnClient_Click(object sender, EventArgs e)
        {
            sidePanel.Height = btnClient.Height;
            sidePanel.Top    = btnClient.Top;

            ClientManage c = new ClientManage();

            c.ShowDialog();
        }