Exemplo n.º 1
0
 private void FormUser_Load(object sender, EventArgs e)
 {
     //string conn = ConfigurationManager.ConnectionStrings["Test"].ConnectionString;
     //con = new SqlConnection(conn);
     //con.Open();
     connect.SetConnection();
     try
     {
         sql = "select StaffID,StaffName From tbStaff order by StaffID";
         SqlCommand    cd  = new SqlCommand(sql, connect.con);
         SqlDataReader d   = cd.ExecuteReader();
         DataTable     tbc = new DataTable();
         tbc.Load(d);
         cboStaffID.DisplayMember = "StaffID";
         cboStaffID.ValueMember   = "StaffName";
         cboStaffID.DataSource    = tbc;
         sql = "select * from tbUser order by UserID";
         SqlCommand    cmd = new SqlCommand(sql, connect.con);
         SqlDataReader dr  = cmd.ExecuteReader();
         DataTable     tb  = new DataTable();
         tb.Load(dr);
         dgvUser.DataSource            = tb;
         dgvUser.Columns[0].Visible    = false;
         dgvUser.Columns[1].HeaderText = "USER NAME";
         dgvUser.Columns[2].HeaderText = "PASSWORD";
         dgvUser.Columns[3].HeaderText = "STAFF'S ID";
         txtUserID.Enabled             = false;
         txtUserID.Text = "Auto Number";
         status         = "New";
         cboStaffID.Focus();
     } catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
        private void FrmInStock_Load(object sender, EventArgs e)
        {
            //SqlConnection con = new SqlConnection("Server=D8JZPCQ2;Database=dbPhoneShop;User ID=sa;Password=123");
            //con.Open();
            ConectionString con = new ConectionString();

            con.SetConnection();
            //Add date to combobox
            try
            {
                string     sql = "Select * from tbProduct Order By ProductID";
                SqlCommand cmd = new SqlCommand("spRunSQL", con.con);
                cmd.Parameters.AddWithValue("@sql", sql);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader dr = cmd.ExecuteReader();
                DataTable     tb = new DataTable();
                tb.Load(dr);
                dgvProduct.DataSource = tb;

                // con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void FrmPayment_Load(object sender, EventArgs e)
        {
            conn.SetConnection();
            txtTotalPrice.Cursor.Dispose();
            txtPayment.Focus();
            txtTotalPrice.ReadOnly = true;

            //SaleProduct sp = new SaleProduct();
            //txtTotalPrice.Text = TotalPrice.ToString();
        }
Exemplo n.º 4
0
        private void FrmSale_Load(object sender, EventArgs e)
        {
            conn.SetConnection();
            //lbUserID.Text = sale.userID.ToString();
            //sql = "select CustomerID from tbCustomer order by CustomerID";
            //SqlCommand cmd = new SqlCommand(sql, conn.con);
            //SqlDataReader dr = cmd.ExecuteReader();
            //DataTable tb = new DataTable();
            //tb.Load(dr);
            //cboCustomerID.DisplayMember = "CustomerID";
            //cboCustomerID.DataSource = tb;
            //cboCustomerID.SelectedItem = null;
            dgvSale.Columns.Add("ProductID", "PRODUCT No");
            dgvSale.Columns.Add("ProductName", "PRODUCT'S NAME");
            dgvSale.Columns.Add("SaleQty", "QTY");
            // dgvSale.Columns.Add("CustomerID", "CUSTOMER'S ID");

            dgvSale.Columns.Add("Unit_Price", "UNIT PRICE");
            dgvSale.Columns.Add("Total", "TOTAL");
            // dgvSale.Columns.Add("UserID", "USER'S ID");
            // dgvSale.Columns.Add("Discount", "DISCOUNT");
            dgvSale.Columns[0].Width = 100;
            dgvSale.Columns[1].Width = 150;
            dgvSale.Columns[2].Width = 100;
            dgvSale.Columns[3].Width = 140;
            dgvSale.Columns[4].Width = 140;

            //dgvSale.Columns[5].Width = 125;
            rdbtnUs.Checked            = true;
            dgvSale.Enabled            = false;
            dgvSale.Columns[0].Visible = false;
            lbDate.Text      = DateTime.Now.ToString("dd MMMM, yyyy");
            lbTime.BackColor = Color.Blue;
            lbTime.ForeColor = Color.White;
            lbDate.ForeColor = Color.Blue;
        }