public void editData(msrental msrental) { msrental oldData = _DB.msrental.Single <msrental>(s => s.id_rental == msrental.id_rental); oldData.nama_rental = msrental.nama_rental; oldData.nama_toko = msrental.nama_toko; oldData.no_telp = msrental.no_telp; oldData.NIK = msrental.NIK; oldData.email = msrental.email; oldData.tempat_lahir = msrental.tempat_lahir; oldData.tgl_lahir = msrental.tgl_lahir; oldData.alamat = msrental.alamat; oldData.alamat_toko = msrental.alamat_toko; oldData.kodepos = msrental.kodepos; oldData.jenis_kelamin = msrental.jenis_kelamin; oldData.nama_bank = msrental.nama_bank; oldData.no_rek = msrental.no_rek; oldData.modidate = msrental.modidate; if (msrental.profil != null) { oldData.profil = msrental.profil; } if (msrental.berkas1 != null) { oldData.berkas1 = msrental.berkas1; } if (msrental.berkas2 != null) { oldData.berkas2 = msrental.berkas2; } _DB.SaveChanges(); }
public void beriRating(int rating, int id_rental) { var detail = (from data in _DB.dtdetailpenyewaan join barang in _DB.msbarang on data.id_barang equals barang.id_barang join rental in _DB.msrental on barang.id_rental equals rental.id_rental join sewa in _DB.trpenyewaan on data.id_penyewaan equals sewa.id_penyewaan where rental.id_rental == id_rental && sewa.status_ulasan == 1 select data); detail = detail.GroupBy(s => s.id_penyewaan).Select(g => g.FirstOrDefault()); int jumlah = detail.ToList <dtdetailpenyewaan>().Count(); msrental msrental = _DB.msrental.Single <msrental>(s => s.id_rental == id_rental); double saat_ini = 0; if (jumlah == 0) { saat_ini = (double)msrental.rating; msrental.rating = (double)rating; } else { saat_ini = (double)msrental.rating / jumlah; msrental.rating = (saat_ini + rating) / (jumlah + 1); } _DB.SaveChanges(); }
public void editPassword(msrental msrental) { msrental oldData = _DB.msrental.Single <msrental>(s => s.id_rental == msrental.id_rental); oldData.password = msrental.password; _DB.SaveChanges(); }
public void hapusData(int id) { msrental msrental = _DB.msrental.Single <msrental>(s => s.id_rental == id); msrental.modidate = DateTime.Now; msrental.status = 0; _DB.SaveChanges(); }
public void topup(int jumlah_uang, int?id_rental) { msrental msrental = _DB.msrental.Single <msrental>(s => s.id_rental == id_rental); msrental.saldo = msrental.saldo + jumlah_uang; _DB.SaveChanges(); this.dtmutasisaldo.rental_mutasi(id_rental, jumlah_uang, "TOP UP", msrental.saldo); }
public void saldo_kurang(int uang, int id_rental, string pengirim) { msrental msrental = _DB.msrental.Single <msrental>(s => s.id_rental == id_rental); msrental.saldo = msrental.saldo - uang; _DB.SaveChanges(); this.dtmutasisaldo.rental_mutasi(id_rental, uang, "KIRIM TRANSFER KE " + pengirim.ToUpper(), msrental.saldo); }
public bool adaUsername(string username) { msrental msrental = _DB.msrental.SingleOrDefault(s => s.username == username); if (msrental == null) { return(false); } return(true); }
public void addData(msrental msrental) { _DB.msrental.Add(msrental); _DB.SaveChanges(); }
public msrental getRentalUsername(string username) { msrental msrental = _DB.msrental.SingleOrDefault <msrental>(s => s.username == username); return(msrental); }
public msrental getRental(int id) { msrental msrental = _DB.msrental.Single <msrental>(s => s.id_rental == id); return(msrental); }
public void addData(trtransfer trtransfer) { _DB.trtransfer.Add(trtransfer); _DB.SaveChanges(); if (trtransfer.jenis_transfer == 11) { mspenyewa pengirim = this.mspenyewa.getPenyewa(trtransfer.id_pengirim); mspenyewa penerima = this.mspenyewa.getPenyewa(trtransfer.id_penerima); this.mspenyewa.saldo_kurang(trtransfer.jml_transfer, trtransfer.id_pengirim, penerima.username); this.mspenyewa.saldo_tambah(trtransfer.jml_transfer, trtransfer.id_penerima, pengirim.username); } if (trtransfer.jenis_transfer == 12) { mspenyewa pengirim = this.mspenyewa.getPenyewa(trtransfer.id_pengirim); msrental penerima = this.msrental.getRental(trtransfer.id_penerima); this.mspenyewa.saldo_kurang(trtransfer.jml_transfer, trtransfer.id_pengirim, penerima.username); this.msrental.saldo_tambah(trtransfer.jml_transfer, trtransfer.id_penerima, pengirim.username); } if (trtransfer.jenis_transfer == 13) { mspenyewa pengirim = this.mspenyewa.getPenyewa(trtransfer.id_pengirim); msadmin penerima = this.msadmin.getAdmin(trtransfer.id_penerima); this.mspenyewa.saldo_kurang(trtransfer.jml_transfer, trtransfer.id_pengirim, penerima.username); //this.msadmin.saldo_tambah(trtransfer.jml_transfer, trtransfer.id_pengirim, penerima.username); } if (trtransfer.jenis_transfer == 21) { msrental pengirim = this.msrental.getRental(trtransfer.id_pengirim); mspenyewa penerima = this.mspenyewa.getPenyewa(trtransfer.id_penerima); this.msrental.saldo_kurang(trtransfer.jml_transfer, trtransfer.id_pengirim, penerima.username); this.mspenyewa.saldo_tambah(trtransfer.jml_transfer, trtransfer.id_penerima, pengirim.username); } if (trtransfer.jenis_transfer == 22) { msrental pengirim = this.msrental.getRental(trtransfer.id_pengirim); msrental penerima = this.msrental.getRental(trtransfer.id_penerima); this.msrental.saldo_kurang(trtransfer.jml_transfer, trtransfer.id_pengirim, penerima.username); this.msrental.saldo_tambah(trtransfer.jml_transfer, trtransfer.id_penerima, pengirim.username); } if (trtransfer.jenis_transfer == 23) { msrental pengirim = this.msrental.getRental(trtransfer.id_pengirim); msadmin penerima = this.msadmin.getAdmin(trtransfer.id_penerima); this.msrental.saldo_kurang(trtransfer.jml_transfer, trtransfer.id_penerima, penerima.username); } /* * if (trtransfer.jenis_transfer == 31) * { * msadmin pengirim = this.msadmin.getAdmin(trtransfer.id_pengirim); * mspenyewa penerima = this.mspenyewa.getPenyewa(trtransfer.id_penerima); * * this.mspenyewa.saldo_kurang(trtransfer.jml_transfer, trtransfer.id_pengirim, penerima.username); * this.mspenyewa.saldo_tambah(trtransfer.jml_transfer, trtransfer.id_penerima, pengirim.username); * } * if (trtransfer.jenis_transfer == 32) * { * mspenyewa pengirim = this.mspenyewa.getPenyewa(trtransfer.id_pengirim); * msrental penerima = this.msrental.getRental(trtransfer.id_penerima); * * * } * if (trtransfer.jenis_transfer == 33) * { * msrental pengirim = this.mspenyewa.getPenyewa(trtransfer.id_pengirim); * mspenyewa penerima = this.mspenyewa.getPenyewa(trtransfer.id_penerima); * * * }*/ }