コード例 #1
0
        private void dataGridViewWarehouses_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int    id    = (int)dataGridViewWarehouses.Rows[e.RowIndex].Cells[0].Value;
            string name  = dataGridViewWarehouses.Rows[e.RowIndex].Cells[1].Value.ToString();
            string code  = dataGridViewWarehouses.Rows[e.RowIndex].Cells[2].Value.ToString();
            int    taken = (int)dataGridViewWarehouses.Rows[e.RowIndex].Cells[3].Value;
            int    free  = (int)dataGridViewWarehouses.Rows[e.RowIndex].Cells[4].Value;

            if (e.ColumnIndex != -1 && e.RowIndex != -1)
            {
                if (dataGridViewWarehouses.Columns[e.ColumnIndex].Name == "ColumnDelete")
                {
                    if (MessageBox.Show("Ar jūs esate tikri, jog norite panaikinti šitą įrašą?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Database.Delete($"DELETE FROM dalysadmin.sandeliai WHERE id={id}");
                        InitializeComponent();
                        GetContent();
                    }
                }
                else if (dataGridViewWarehouses.Columns[e.ColumnIndex].Name == "ColumnList")
                {
                    PrekiuSarasas newForm = new PrekiuSarasas(dataGridViewWarehouses.Rows[e.RowIndex].Cells[2].Value.ToString());
                    newForm.Show();
                }
                else if (dataGridViewWarehouses.Columns[e.ColumnIndex].Name == "ColumnModify")
                {
                    SandelysModifikacija newForm = new SandelysModifikacija(name, free, code);
                    newForm.Show();
                }
            }
        }
コード例 #2
0
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            this.Hide();
            PrekiuSarasas newForm = new PrekiuSarasas(WarehouseCode);

            newForm.ShowDialog();
            this.Close();
        }