public void GetThanhToan_TestCase2() { ThanhToanDTO thanhToanDTO = null; ThanhToanBUS thanhToanBUS = new ThanhToanBUS(); string actual = thanhToanBUS.GetThanhToan(db, "1234567890", out thanhToanDTO); string expected = "1111"; Assert.Equals(actual, expected); }
public string GetThanhToan(string MaHoSo, out ThanhToanDTO thanhToan) { string result; ThanhToanBUS thanhToanBUS = new ThanhToanBUS(); using (QLPHONGKHAMEntities db = new QLPHONGKHAMEntities()) { result = thanhToanBUS.GetThanhToan(db, MaHoSo, out thanhToan); } return(result); }
public void GetThanhToan_TestCase1() { // create data search db.THANHTOANs.Add(new THANHTOAN { MaHoSo = "1234567890" }); db.THANHTOANs.Add(new THANHTOAN { MaHoSo = "1234567891" }); db.THANHTOANs.Add(new THANHTOAN { MaHoSo = "1234567892" }); ThanhToanDTO thanhToanDTO = null; ThanhToanBUS thanhToanBUS = new ThanhToanBUS(); string actual = thanhToanBUS.GetThanhToan(db, "1234567890", out thanhToanDTO); string expected = "0000"; Assert.Equals(actual, expected); }
// xử lý thanh toán public string ThanhToanProcessing(List <KetQuaXetNghiemDTO> ketQuaXetNghiems) { if (ketQuaXetNghiems == null || ketQuaXetNghiems.Count == 0) { return(Constant.RES_FAI); } KetQuaXetNghiemBUS ketQuaXetNghiemBUS = new KetQuaXetNghiemBUS(); ThanhToanBUS thanhToanBUS = new ThanhToanBUS(); LuonCongViecBUS luonCongViecBUS = new LuonCongViecBUS(); using (QLPHONGKHAMEntities db = new QLPHONGKHAMEntities()) { ThanhToanDTO thanhToan = new ThanhToanDTO(); if (thanhToanBUS.GetThanhToan(db, ketQuaXetNghiems.ElementAt(0).MaHoSo, out thanhToan) == Constant.RES_FAI) { return(Constant.RES_FAI); } if (thanhToan == null) { return(Constant.RES_FAI); } decimal tongtien = 0; foreach (var kq in ketQuaXetNghiems) { tongtien += kq.TongChiPhi; } thanhToan.TongChiPhi += tongtien; thanhToan.ChiPhiXetNghiem = tongtien; LuonCongViecDTO luonCongViec = new LuonCongViecDTO(); if (luonCongViecBUS.GetInformationLuonCongViec(db, thanhToan.MaHoSo, out luonCongViec) == Constant.RES_FAI) { return(Constant.RES_FAI); } luonCongViec.NodeHienTai = BusConstant.NODE_XET_NGHIEM; using (var trans = db.Database.BeginTransaction()) { foreach (var kq in ketQuaXetNghiems) { // yeu cau PRESENT phai update doi tuong if (ketQuaXetNghiemBUS.UpdateKetQuaXetNghiem(db, kq).Equals(Constant.RES_FAI)) { trans.Rollback(); return(Constant.RES_FAI); } } if (thanhToanBUS.UpdateThanhToan(db, thanhToan).Equals(Constant.RES_FAI)) { trans.Rollback(); return(Constant.RES_FAI); } if (luonCongViecBUS.UpdateLuonCongViec(db, luonCongViec).Equals(Constant.RES_FAI)) { trans.Rollback(); return(Constant.RES_FAI); } trans.Commit(); } db.SaveChanges(); } return(Constant.RES_SUC); }