예제 #1
0
        public void ubah_password(string password)
        {
            Akun data = Data_Akun[ubah_password_akun];

            data.Ubah_data(2, password, -1);
            ubah_password_akun = -999;
        }
예제 #2
0
        public void daftar(string username, string password, string email, long saldo)
        {
            Akun   akun = new Akun();
            string temp = Generate_pin();

            akun.Gabung(username, password, email, saldo, temp);
            Data_Akun.Add(akun);
        }
예제 #3
0
        public void Transfer(string Username, string pin, long saldo)
        {
            Akun data = Data_Akun[Login_status];

            if (Username == null)
            {
                for (int i = 0; i < Data_Akun.Count; i++)
                {
                    Akun tempo = Data_Akun[i];
                    if (tempo.Ambil_data(4) == pin)
                    {
                        if (data.Ubah_data(1, null, saldo))
                        {
                            tempo.Ubah_data(3, null, saldo);
                            Console.Write("Saldo berhasil ditransfer\nPress any key to exit");
                            Console.ReadKey();
                            return;
                        }
                        else
                        {
                            Console.Write("Saldo kurang, sisa saldo {0}\nPress any key to exit", tempo.Ambil_saldo());
                            Console.ReadKey();
                            return;
                        }
                    }
                }
                Console.Write("Pin tak ditemukan\nPress any key to exit\n");
                Console.ReadKey();
            }

            else
            {
                for (int i = 0; i < Data_Akun.Count; i++)
                {
                    Akun tempo = Data_Akun[i];
                    if (tempo.Ambil_data(1) == Username)
                    {
                        if (data.Ubah_data(1, null, saldo))
                        {
                            tempo.Ubah_data(3, null, saldo);
                            Console.Write("Saldo berhasil ditransfer\nPress any key to exit");
                            Console.ReadKey();
                            return;
                        }
                        else
                        {
                            Console.Write("Saldo kurang, sisa saldo {0}\nPress any key to exit", tempo.Ambil_saldo());
                            Console.ReadKey();
                            return;
                        }
                    }
                }
                Console.Write("Username tak ditemukan\nPress any key to exit\n");
                Console.ReadKey();
            }
        }
예제 #4
0
        public void Detail_akun()
        {
            Akun data = Data_Akun[Login_status];

            Console.WriteLine("Detail Akun\nNama : {0}", data.Ambil_data(1));
            Console.WriteLine("Email : {0}", data.Ambil_data(3));
            Console.WriteLine("Pin : {0}", data.Ambil_data(4));
            Console.WriteLine("Saldo : {0}", data.Ambil_saldo());
            Console.WriteLine("Tabungan : {0}\nPress any key to exit", data.Ambil_tabungan());
            Console.ReadKey();
        }
예제 #5
0
 public bool check_email(string email)
 {
     for (int i = 0; i < Data_Akun.Count; i++)
     {
         Akun data = Data_Akun[i];
         if (data.Ambil_data(3) == email)
         {
             return(false);
         }
     }
     return(true);
 }
예제 #6
0
 public string Recover_Password(string email)
 {
     for (int i = 0; i < Data_Akun.Count; i++)
     {
         Akun data = Data_Akun[i];
         if (data.Ambil_data(3) == email)
         {
             ubah_password_akun = i;
             return(data.Ambil_data(2));
         }
     }
     return("");
 }
예제 #7
0
        public void Proses_saldo(int pilihan, long saldo)
        {
            Akun data = Data_Akun[Login_status];

            switch (pilihan)
            {
            case 1:     //menambah jumlah saldo
                if (data.Ubah_data(3, null, saldo))
                {
                    Console.Write("\nSaldo berhasil ditambahkan\nPress any key to exit\n"); Console.ReadKey();
                }
                break;

            case 2:     //menambah isi tabungan
                if (data.Ubah_data(2, null, saldo))
                {
                    Console.Write("\nTabungan berhasil ditambahkan\nPress any key to exit\n"); Console.ReadKey();
                }
                else
                {
                    Console.Write("Saldo tak cukup, jumlah saldo {0}\nPress any key to exit\n", data.Ambil_saldo()); Console.ReadKey();
                }
                break;

            case 3:     //tarik saldo
                if (data.Ubah_data(1, null, saldo))
                {
                    Console.Write("\nUang senilai {0} berhasil ditarik, sisa saldo {1}\nPress any key to exit\n", saldo, data.Ambil_saldo()); Console.ReadKey();
                }
                else
                {
                    Console.Write("\nSaldo kurang, sisa saldo {0}\npress any key to exit\n", data.Ambil_saldo()); Console.ReadKey();
                }
                break;

            case 4:     //tarik tabungan ke saldo
                if (data.Tabungan(1, saldo))
                {
                    Console.Write("\nSaldo senilai {0} berhasil ditarik dari tabungan, sisa tabungan {1}\npress any key to exit\n", saldo, data.Ambil_tabungan()); Console.ReadKey();
                }
                else
                {
                    Console.Write("\nTabungan kurang, sisa tabungan {0}\nPress any key to exit\n", data.Ambil_tabungan()); Console.ReadKey();
                }
                break;
            }
        }
예제 #8
0
 public bool Login(string username, string password)
 {
     for (int i = 0; i < Data_Akun.Count; i++)
     {
         Akun login = Data_Akun[i];
         if (login.Ambil_data(1) == username && login.Ambil_data(2) == password)
         {
             Login_status = i;
             break;
         }
     }
     if (Login_status == -999)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }