public static void Dartar(Pengguna pengguna)
        {
            if (LsPengguna.Count != 0)
            {
                //cari
                int i = 0;
                Boolean ketemu = false;
                while ((i < LsPengguna.Count) && !ketemu)
                {
                    if (pengguna.IdPengguna == LsPengguna[i].IdPengguna)
                        ketemu = true;
                    else
                        i++;
                }

                if (ketemu)
                    throw new ArgumentException("Username telah digunakan");
                else
                {
                    LsPengguna.Add(pengguna);
                    LsTabungan.Add(new Tabungan(pengguna.IdPengguna));
                }
            }
            else
            {
                LsPengguna.Add(pengguna);
                LsTabungan.Add(new Tabungan(pengguna.IdPengguna));
            }
        }
Example #2
0
        static Pengguna Daftar()
        {
            Pengguna pengguna = new Pengguna();
            inputId:
            TextBox(41, 7, 37, 8, "Login");
            Console.SetCursorPosition(43, 9);
            Console.Write("User Id   : ");

            try
            {
                pengguna.IdPengguna = Console.ReadLine();
            }
            catch (Exception exp)
            {
                Peringatan(exp.Message);
                goto inputId;
            }

            try
            {
                cariID(pengguna.IdPengguna);
                Peringatan("User id ini telah digunakan");
                goto inputId;
            }
            catch
            {
                //
            }

            Console.SetCursorPosition(43, 10);
            Console.Write("Password  : "******"Nama      : ");
            try
            {
                pengguna.Nama = Console.ReadLine();
            }
            catch (Exception exp)
            {
                Peringatan(exp.Message);
                goto inputNama;
            }

            inputAlamat:
            Console.SetCursorPosition(43, 12);
            Console.Write("Alamat    : ");
            try
            {
                pengguna.Alamat = Console.ReadLine();
            }
            catch (Exception exp)
            {
                Peringatan(exp.Message);
                goto inputAlamat;
            }
            return pengguna;
        }