Beispiel #1
0
        public void CreateAnAccount()
        {
            CreateAnAccount reg = new CreateAnAccount();

            reg.Visible = false;
            CreateAnAccountController controller = new CreateAnAccountController(reg);

            controller.LoadViewCreateAnAccount();
            reg.ShowDialog();
            _view.Hide();
        }
Beispiel #2
0
        private void ReceiveMessages()
        {
            strReader = new StreamReader(tcpClient.GetStream());

            // While we are successfully connected, read incoming lines from the server
            while (isConnectedToServer)
            {
                string   serverResponse = strReader.ReadLine();
                string[] data           = serverResponse.Split(';');


                if (data[0].Equals("WRONG_NICK") || data[0].Equals("NICK_INVALID") || data[0].Equals("PASSWORD_INVALID") || data[0].Equals("EMAIL_INVALID"))
                {
                    Console.WriteLine("zlyNick, mail albo haslo!!!");
                    string message = data[1];


                    _view.ShowInformation("Error", message);

                    _view.Hide();

                    CreateAnAccount reg = new CreateAnAccount();
                    reg.Visible = false;

                    CreateAnAccountController controller = new CreateAnAccountController(reg);
                    controller.LoadViewCreateAnAccount();
                    reg.ShowDialog();
                    _view.Close();
                }
                if (data[0].Equals("ACCOUNT_CREATED_SUCCESFULLY"))
                {
                    ACCOUNT_CREATED_SUCCESFULLY = true;
                    Console.WriteLine("ACCOUNT_CREATED_SUCCESFULLY");
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            CreateAnAccount   createAnAccount = new CreateAnAccount();
            GetCustomerList   getCustomerList = new GetCustomerList();
            CreatePayment     createPayment   = new CreatePayment();
            AddProductToOrder addProduct      = new AddProductToOrder();
            CompleteOrder     completeOrder   = new CompleteOrder();

            Console.WriteLine(@"
                         **************************
                      ********************************
                    ************ SHUFFLEPUFF ***********
                    ************* BANGAZON *************
                      ********************************
                         **************************"
                              );
START:
            Console.WriteLine(@" 1. Create an Account" + Environment.NewLine + " 2. Choose Active Customer" + Environment.NewLine + " 3. Create Payment Option" + Environment.NewLine + " 4. Search for Products" + Environment.NewLine + " 5. Complete Order" + Environment.NewLine + " 6. See Product Popularity" + Environment.NewLine + " 7. Leave Shufflepuff Bangazon"
                              );


            string userCommand = Console.ReadKey(true).KeyChar.ToString();

            switch (userCommand)
            {
            case "1":
                Console.Clear();
                var savedToDatabase = createAnAccount.CreateNewAccount();
                Debug.WriteLine(savedToDatabase);
                Console.Clear();
                goto START;

            case "2":
                Console.WriteLine("Choose Active Customer");
                getCustomerList.DisplayCustomerList();
                Console.Clear();
                goto START;

            case "3":
                Console.Clear();
                var paymentSavedToDatabase = createPayment.SelectPaymentType();
                Debug.WriteLine(paymentSavedToDatabase);
                Console.Clear();
                goto START;

            case "4":
                Console.WriteLine("Choose Product");
                addProduct.DisplayProductList();
                Console.Clear();
                //Console.WriteLine(addProduct.SelectedProductId);
                List <Product> productIdList = addProduct.GetProducts();
                foreach (Product item in productIdList)
                {
                    Console.WriteLine(item);
                }
                Console.ReadLine();

                goto START;
            ////product search
            //ProductRepo repo = new ProductRepo();

            //var products = repo.GetProducts();

            //foreach (Product product in products)
            //{
            //    Console.WriteLine(product.ProductId + ". " + product.Name + " " + product.Price);
            //}
            //break;
            case "5":
                //complete order
                if (completeOrder.DetermineIfOrderContainsProducts())
                {
                    if (completeOrder.DetermineIfReadyToPurchase())
                    {
                        completeOrder.ChoosePaymentMethod();
                    }
                }
                else
                {
                    Console.WriteLine("Please add products to your order.  Press any key to continue.");
                    Console.Clear();
                }
                goto START;

            case "6":
                //product popularity
                PaymentRepo repo = new PaymentRepo();

                var payments = repo.GetPayments(getCustomerList.GetSelectedUserId());

                foreach (var payment in payments)
                {
                    Console.WriteLine(payment.Type + ". " + payment.AccountNumber);
                }
                goto START;

            case "7":
                Console.WriteLine("See Ya!");
                Environment.Exit(0);
                break;

            default:
                Console.WriteLine("Please select a valid option...");
                break;
            }
        }
 public CreateAnAccountValidation(CreateAnAccount createAnAccount) => this.createAnAccount = createAnAccount;