Ejemplo n.º 1
0
Archivo: Form2.cs Proyecto: Tuckle/GyF
        private void button4_Click(object sender, EventArgs e)
        {
            int selectedRowCount = dataGridView2.Rows.GetRowCount(DataGridViewElementStates.Selected);

            if (selectedRowCount != 1)
            {
                MessageBox.Show("Only one row must pe selected!", "Error selection", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                DataGridViewRow row = dataGridView2.SelectedRows[0];
                int             id  = int.Parse(Convert.ToString(row.Cells["resourceId"].Value));
                ResourceModify  rm  = new ResourceModify(id, companyId, Convert.ToString(row.Cells["name"].Value), Convert.ToString(row.Cells["description"].Value), int.Parse(Convert.ToString(row.Cells["cost"].Value)), true);
                this.Hide();
                rm.ShowDialog();
                // refresh gridview table
                conn.Open();
                int pageNumber           = 1;
                OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from ( select a.*, rownum r__ from (Select * from resourcesMaterializedView where companyid = " + companyId + ") a where rownum < (" + pageNumber * 10 + ")) where r__ >= (" + (pageNumber - 1) * 10 + ")", conn);
                DataTable        dt      = new DataTable();
                adapter.Fill(dt);
                dataGridView2.DataSource = dt;
                conn.Close();
                this.Show();
            }
        }
Ejemplo n.º 2
0
Archivo: Form2.cs Proyecto: Tuckle/GyF
        private void button8_Click(object sender, EventArgs e)
        {
            ResourceModify rm = new ResourceModify(-1, companyId, "", "", -1, false);

            this.Hide();
            rm.ShowDialog();
            // refresh gridview table
            conn.Open();
            OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from resourcesMaterializedView where companyid = " + companyId, conn);
            DataTable        dt      = new DataTable();

            adapter.Fill(dt);
            dataGridView2.DataSource = dt;
            conn.Close();
            this.Show();
        }