private void btLuu_Click(object sender, EventArgs e) { if (txTen.Text.Trim() == "") { MessageBox.Show("Tên không được để trống", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } LoaiCP temp = new LoaiCP(); temp.Id = int.Parse(txId.Text.Trim()); temp.Ten = txTen.Text.Trim(); temp.GhiChu = txGhiChu.Text.Trim(); if (temp.Id != -1) { temp.updated = true; } try { temp.Save(); txId.Text = temp.Id.ToString(); MessageBox.Show("Lưu thành công", "Lưu thành công", MessageBoxButtons.OK, MessageBoxIcon.Information); KhoaChinhSua(); listChiphi = DalLoaiCP.GetAllLoaiCP(); LoadDanhsachCP(); } catch (Exception ex) { Console.WriteLine(ex); Console.WriteLine("loi luu Loai Chi Phi"); } }
private void btThongKe_Click(object sender, EventArgs e) { if (dgvChiPhi.Rows.Count > 0 && dgvChiPhi.CurrentCell.RowIndex < listLoaiCP.Count) { curLoaiCP = listLoaiCP[dgvChiPhi.CurrentCell.RowIndex]; } listChiPhi = DalChiPhi.GetChiPhiByLoaiCP(curLoaiCP); loadDSChiPhi(listChiPhi); }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.Rows.Count > 0 && dataGridView1.CurrentCell.RowIndex < listChiphi.Count && dataGridView1.CurrentCell.RowIndex != -1) { curChiphi = listChiphi[dataGridView1.CurrentCell.RowIndex]; } txId.Text = curChiphi.Id + ""; txTen.Text = curChiphi.Ten.Trim(); txGhiChu.Text = curChiphi.GhiChu; }
private void ThongKeChiPhi_Load(object sender, EventArgs e) { listLoaiCP = DalLoaiCP.GetAllLoaiCP(); if (listLoaiCP.Count > 0) { curLoaiCP = listLoaiCP[0]; listdoanDL = DalDoanDL.GetAllDoanDL(); listChiPhi = DalChiPhi.GetChiPhiByLoaiCP(curLoaiCP); } loadDSLoaiCP(); loadDSChiPhi(listChiPhi); }
private void ChiTietDoanDL_Load(object sender, EventArgs e) { curDoanDL.GetCTDoanByDoan(); listKhach = curDoanDL.GetKhachDoan(); listNhanVien = curDoanDL.GetNhanVienDoan(); listChiPhi = curDoanDL.GetChiPhiDoan(); LoaiCP loaiCP = new LoaiCP(); listloaiCP = loaiCP.GetAllLoaiCP(); khachs = DalNguoi.getKhach(); nv = DalNguoi.getNhanVien(); loadKhach_Doan(); loadNhanVien_Doan(); DataCombobox(); LoadChiPhi(); loadLoaiCP(); TinhDoanhThu(); }