Esempio n. 1
0
 private void btnCancelChanges_Click(object sender, EventArgs e)
 {
     btnSave.Enabled          = false;
     btnCancelChanges.Enabled = false;
     QuanLy.addedRows.Clear();
     QuanLy.modifiedRows.Clear();
     QuanLy.removedRows.Clear();
     QuanLy.LoadDataToDataGridView(dataGridView1);
 }
Esempio n. 2
0
 private void btnTraCuu_Click(object sender, EventArgs e)
 {
     if (cbbNoiDen.Text == cbbNoiDi.Text)
     {
         MessageBox.Show("Không thể tra cứu");
     }
     else
     {
         QuanLy.TraCuu(dataGridView2, cbbNoiDi, cbbNoiDen, dateTraCuu);
     }
 }
Esempio n. 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.Text == "")
     {
         MessageBox.Show("Vui lòng nhập năm!", "Thông báo", MessageBoxButtons.OK);
     }
     else
     {
         panel1.Visible = true;
         label1.Text    = comboBox1.Text;
         QuanLy.BaoCaoNam(dataGridView1, comboBox1, textBox1);
     }
 }
Esempio n. 4
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            QuanLy.AddRowToDataGridView(dataGridView1);
            DataGridViewRow newRow = dataGridView1.Rows[dataGridView1.Rows.Count - 1];

            newRow.HeaderCell.Value = String.Format("{0}", newRow.Index + 1);

            QuanLy.addedRows.Add(newRow);
            newRow.DefaultCellStyle.BackColor = QuanLy.AddedRowColor;
            dataGridView1.CurrentCell         = newRow.Cells[0];

            btnSave.Enabled          = true;
            btnCancelChanges.Enabled = true;
        }
Esempio n. 5
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     dataGridView1.CurrentCell = dataGridView1.SelectedCells[0];
     if (dataGridView1.CurrentCell.OwningColumn == dataGridView1.Columns[1] ||
         dataGridView1.CurrentCell.OwningColumn == dataGridView1.Columns[2] ||
         dataGridView1.CurrentCell.OwningColumn == dataGridView1.Columns[3] ||
         dataGridView1.CurrentCell.OwningColumn == dataGridView1.Columns[4] ||
         dataGridView1.CurrentCell.OwningColumn == dataGridView1.Columns[5])
     {
         splitContainer1.Panel1.Enabled = false;
         QuanLy.LoadSanBay(cbbMaSBDi);
         QuanLy.LoadSanBay(cbbMaSBDen);
         QuanLy.LoadHHK(cbbHHK);
         panel1.Location = new Point(splitContainer1.Panel2.Size.Width - panel1.Size.Width - 18, 0);
         panel1.Visible  = true;
     }
     else
     {
         dataGridView1.BeginEdit(true);
     }
 }
Esempio n. 6
0
 private void btnHoanVe_Click(object sender, EventArgs e)
 {
     QuanLy.HoanVe(dataGridView3, cbbMaVe);
     QuanLy.CapNhatVe(dataGridView3, cbbMaCB, cbbMaVe);
 }
Esempio n. 7
0
 private void btnThanhToan_Click(object sender, EventArgs e)
 {
     QuanLy.ThanhToan(dataGridView3, cbbMaVe);
     QuanLy.CapNhatVe(dataGridView3, cbbMaCB, cbbMaVe);
 }
Esempio n. 8
0
 private void tabControl1_Selecting(object sender, TabControlCancelEventArgs e)
 {
     QuanLy.LoadDuLieu(cbbMaCB, cbbMaVe);
 }
Esempio n. 9
0
 private void cbbNoiDen_DropDown(object sender, EventArgs e)
 {
     QuanLy.LoadSanBay(cbbNoiDen);
 }
Esempio n. 10
0
 private void Form1_Load(object sender, EventArgs e)
 {
     QuanLy.LoadDataToDataGridView(dataGridView1);
 }
Esempio n. 11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            btnSave.Enabled = false;
            if (!QuanLy.CheckAffectedRows(dataGridView1))
            {
                /* Show error(s) to the user */
                MessageBox.Show("Có lỗi khi cập nhật dữ liệu vào CDSL. Vui lòng kiểm tra lại các thay đổi của bạn.", "Cập nhật không thành công");
                QuanLy.ShowErrorText(lblUpdateStatus);
                QuanLy.errors.Clear();
            }
            else
            {
                /* Save the changes */
                btnCancelChanges.Enabled = false;
                foreach (DataGridViewRow row in QuanLy.addedRows)
                {
                    using (SqlConnection connection = new SqlConnection(Properties.Resources.localConnectionString_HoangAn))
                    {
                        connection.Open();
                        SqlCommand command = new SqlCommand("ThemCB", connection)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        QuanLy.AddParametersToCommand(command, row);
                        command.ExecuteNonQuery();
                    }
                }

                foreach (DataGridViewRow row in QuanLy.modifiedRows)
                {
                    using (SqlConnection connection = new SqlConnection(Properties.Resources.localConnectionString_HoangAn))
                    {
                        connection.Open();
                        SqlCommand command = new SqlCommand("SuaCB", connection)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        QuanLy.AddParametersToCommand(command, row);
                        command.ExecuteNonQuery();
                    }
                }

                foreach (DataGridViewRow row in QuanLy.removedRows)
                {
                    using (SqlConnection connection = new SqlConnection(Properties.Resources.localConnectionString_HoangAn))
                    {
                        connection.Open();
                        SqlCommand command = new SqlCommand("XoaCB", connection)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        QuanLy.AddParametersToCommand(command, row);
                        command.ExecuteNonQuery();
                    }
                }
                QuanLy.ShowChangeLog(lblUpdateStatus);
                QuanLy.addedRows.Clear();
                QuanLy.modifiedRows.Clear();
                QuanLy.removedRows.Clear();
                QuanLy.LoadDataToDataGridView(dataGridView1);
            }
        }
Esempio n. 12
0
 private void button1_Click(object sender, EventArgs e)
 {
     panel1.Visible = true;
     QuanLy.BaoCao(dataGridView1, dateTimePicker1, dateTimePicker2, textBox1);
 }