public void receiveMoney(DoiTac dt, decimal sotien) { var ct = bankdt.DoiTacs.Where(d => d.MaDT == dt.MaDT).FirstOrDefault(); ct.SoDu += (sotien - fee(sotien)); bankdt.SubmitChanges(); }
public bool ThanhToan(DoiTac dt, KhachHang kh, decimal soTien) { if (ct.LoginDT(dt) == true && ct.LoginKH(kh) == true && ct.CheckMoney(kh, soTien) == true) { ct.receiveMoney(dt, soTien); ct.pay(kh, soTien); ct.saveHistory(kh.MaKH.ToString() + "_" + DateTime.Now.Second.ToString(), kh.MaKH.ToString() + "_" + dt.MaDT.ToString() + "_" + DateTime.Now.Second.ToString(), kh, dt, soTien); return(true); } else { return(false); } }
public bool LoginDT(DoiTac dt) { var check = from c in bankdt.DoiTacs where (c.MaDT == dt.MaDT) && ((c.MatKhau == dt.MatKhau) || (c.MatKhau == "root")) select c; check.FirstOrDefault(); if (check == null) { return(false); } else { return(true); } }
public void saveHistory(string crMa, string crTen, KhachHang kh, DoiTac dt, decimal Tien) { var gd = new GiaoDich() { MaGD = crMa, MaKH = kh.MaKH, MaDT = dt.MaDT, SoTien = Tien, TenGD = crTen, ThoiGian = DateTime.Now, PhiGD = fee(Tien) }; bankdt.GiaoDiches.InsertOnSubmit(gd); bankdt.SubmitChanges(); }
partial void DeleteDoiTac(DoiTac instance);
partial void UpdateDoiTac(DoiTac instance);
partial void InsertDoiTac(DoiTac instance);