Esempio n. 1
0
        private void LoadAllSizesIntoGrid()
        {
            using (SqlConnection con = new SqlConnection(Application_Settings.ConnectionString()))
            {
                using (SqlCommand cmd = new SqlCommand("MSP_LoadDataIntoGrid", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    if (con.State != ConnectionState.Open)
                    {
                        con.Open();
                    }

                    DataTable dt = new DataTable();
                    using (SqlDataReader dr = cmd.ExecuteReader())
                    {
                        if (dr.HasRows)
                        {
                            dt.Load(dr);
                            SizesdataGridView1.DataSource         = dt;
                            SizesdataGridView1.Columns[0].Visible = false;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (IsValid())
            {
                using (SqlConnection con = new SqlConnection(Application_Settings.ConnectionString()))
                {
                    using (SqlCommand cmd = new SqlCommand("usp_Login_VerifyLoginDetails", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserName", txtUsername.Text.Trim());
                        cmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim());

                        con.Open();
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.Read())
                        {
                            this.Hide();
                            Dashboard dsh = new Dashboard();
                            dsh.Show();
                        }

                        else
                        {
                            MessageBox.Show("Username or Password is incorrect", "Login Failed!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        private DataTable GetComboBoxData(int listTypeID)
        {
            DataTable dt = new DataTable();

            using (SqlConnection con = new SqlConnection(Application_Settings.ConnectionString()))
            {
                using (SqlCommand cmd = new SqlCommand("MSP_LoadDataIntoCombo", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ListTypeID", 1);
                    con.Open();
                    SqlDataReader dr = cmd.ExecuteReader();
                    dt.Load(dr);
                }
            }
            return(dt);
        }