示例#1
0
        public void hapusData(int id)
        {
            msadmin oldData = _DB.msadmin.Single <msadmin>(data => data.id_admin == id);

            oldData.status = 0;
            _DB.SaveChanges();
        }
示例#2
0
        public void ubahPassword(msadmin msadmin)
        {
            msadmin oldData = _DB.msadmin.Single <msadmin>(data => data.id_admin == msadmin.id_admin);

            oldData.password = msadmin.password;

            _DB.SaveChanges();
        }
示例#3
0
        public bool adaUsername(string username)
        {
            msadmin msadmin = _DB.msadmin.SingleOrDefault(s => s.username == username);

            if (msadmin == null)
            {
                return(false);
            }
            return(true);
        }
示例#4
0
        public void editData(msadmin msadmin)
        {
            msadmin oldData = _DB.msadmin.Single <msadmin>(data => data.id_admin == msadmin.id_admin);

            oldData.nama_admin   = msadmin.nama_admin;
            oldData.profil       = msadmin.profil;
            oldData.tempat_lahir = msadmin.tempat_lahir;
            oldData.tgl_lahir    = msadmin.tgl_lahir;
            oldData.email        = msadmin.email;

            _DB.SaveChanges();
        }
示例#5
0
        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);
             *
             *
             * }*/
        }
示例#6
0
        public msadmin getAdmin(int id)
        {
            msadmin admin = _DB.msadmin.Single(data => data.id_admin == id);

            return(admin);
        }
示例#7
0
 public void addData(msadmin msadmin)
 {
     _DB.msadmin.Add(msadmin);
     _DB.SaveChanges();
 }