Ejemplo n.º 1
0
        void load_nguyen_lieu()
        {
            DAONguyenLieu nl = new DAONguyenLieu();

            dtg_nguyenlieu_theongay.DataSource         = nl.getNguyenLieutheongay();
            dtg_nguyenlieu_theongay.AllowUserToAddRows = false;
            dtg_nguyenlieu_theongay.ReadOnly           = false;
            txt_tongtien.text = nl.gettonggia().ToString();
        }
Ejemplo n.º 2
0
        private void btn_luugia_Click(object sender, EventArgs e)
        {
            try
            {
                DAONguyenLieu nl = new DAONguyenLieu();
                DataTable     ct = new DataTable();
                ct.Columns.Add(new DataColumn("manl", typeof(int)));
                ct.Columns.Add(new DataColumn("gia", typeof(float)));
                foreach (DataGridViewRow row in dtg_nguyenlieu_theongay.Rows)
                {
                    ct.Rows.Add((int)row.Cells[0].Value, float.Parse(row.Cells[2].Value.ToString()));
                }

                nl.updategia_nguyenlieu(ct);
                load_nguyen_lieu();
            }
            catch (Exception ex) { MessageBox.Show(ex + ""); }
        }
Ejemplo n.º 3
0
        void loadnguyenlieu()
        {
            DAONguyenLieu nl  = new DAONguyenLieu();
            DataTable     tb1 = new DataTable();

            tb1 = nl.getNguyenLieu();

            tb1.Columns.Add("check", typeof(bool));
            foreach (DataRow row in tb1.Rows)
            {
                row["check"] = false;
            }
            tb1.Columns.Add("soluong", typeof(float));
            foreach (DataRow row in tb1.Rows)
            {
                row["soluong"] = 0;
            }
            dataGridView2.DataSource         = tb1;
            dataGridView2.AllowUserToAddRows = false;
        }