示例#1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            RoadExpense updateRoadexpense = _roadExpenseBll.GetBLL(selectedID);

            updateRoadexpense.ExpenseName = txtExpenseName.Text;
            updateRoadexpense.TotalPrice  = Convert.ToDecimal(txtTotalPrice.Text);

            updateRoadexpense.BusID = (int)cmbBusID.SelectedValue;

            _roadExpenseBll.UpdateBLL(updateRoadexpense);
            RefreshGrid();
        }
示例#2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         RoadExpense newRoadExpense = _roadExpenseBll.GetBLL(selectedID);
         selectedID = 0;
         _roadExpenseBll.DeleteBLL(newRoadExpense);
         RefreshGrid();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         RoadExpense newRoadExpense = new RoadExpense();
         Bus         useBus         = new Bus();
         newRoadExpense.ExpenseName = txtExpenseName.Text;
         newRoadExpense.TotalPrice  = Convert.ToDecimal(txtTotalPrice.Text);
         newRoadExpense.BusID       = (int)cmbBusID.SelectedValue;
         _roadExpenseBll.SaveBLL(newRoadExpense);
         RefreshGrid();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#4
0
 private void dgvRoadExpense_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     try
     {
         if (dgvRoadExpense.SelectedRows.Count > 0)
         {
             DataGridViewRow dr          = dgvRoadExpense.SelectedRows[0];
             string          updateInput = dr.Cells[0].Value.ToString();
             selectedID = int.Parse(updateInput);
             RoadExpense updateRoadExpense = _roadExpenseBll.GetBLL(selectedID);
             txtExpenseName.Text = updateRoadExpense.ExpenseName;
             txtTotalPrice.Text  = updateRoadExpense.TotalPrice.ToString();
             Bus UseBus = new Bus();
             UseBus = (Bus)cmbBusID.SelectedItem;
             updateRoadExpense.ID = UseBus.ID;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }