Esempio n. 1
0
        /// <summary>
        /// Delete Retailer Account.
        /// </summary>
        /// <returns></returns>
        public static async Task DeleteRetailerAccount()
        {
            try
            {
                using (IRetailerBL retailerBL = new RetailerBL())
                {
                    Write("Are you sure? (Y/N): ");
                    Write("Current Password: "******"Y", StringComparison.OrdinalIgnoreCase))
                    {
                        //Invoke DeleteRetailerBL method to delete
                        bool isDeleted = await retailerBL.DeleteRetailerBL(retailer.RetailerID);

                        if (isDeleted)
                        {
                            WriteLine("Retailer Account Deleted");
                        }
                    }
                }
            }



            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                WriteLine(ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Updates Retailer's Password.
        /// </summary>
        /// <returns></returns>
        public static async Task ChangeRetailerPassword()
        {
            try
            {
                using (IRetailerBL retailerBL = new RetailerBL())
                {
                    //Read Current Password
                    Write("Current Password: "******"New Password: "******"Confirm Password: "******"Retailer Password Updated");
                            }
                        }
                        else
                        {
                            WriteLine($"New Password and Confirm Password doesn't match");
                        }
                    }
                    else
                    {
                        WriteLine($"Current Password doesn't match.");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                WriteLine(ex.Message);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Login (based on Email and Password)
        /// </summary>
        /// <returns></returns>
        static async Task <(UserType, IUser)> ShowLoginScreen()
        {
            //Read inputs
            string email, password;

            WriteLine("=====LOGIN=========");
            Write("Email: ");
            email = ReadLine();
            Write("Password: "******"*");
                }
                else
                {
                    Write("\b");
                }
            }while (key.Key != ConsoleKey.Enter);
            WriteLine("");

            using (IAdminBL adminBL = new AdminBL())
            {
                //Invoke GetAdminByEmailAndPasswordBL for checking email and password of Admin
                Admin admin = await adminBL.GetAdminByEmailAndPasswordBL(email, password);

                if (admin != null)
                {
                    return(UserType.Admin, admin);
                }
            }

            using (ISalesPersonBL SalesPersonBL = new SalesPersonBL())
            {
                //Invoke GetAdminByEmailAndPasswordBL for checking email and password of Admin
                SalesPerson SalesPerson = await SalesPersonBL.GetSalesPersonByEmailAndPasswordBL(email, password);

                if (SalesPerson != null)
                {
                    return(UserType.SalesPerson, SalesPerson);
                }
            }
            using (IRetailerBL RetailerBL = new RetailerBL())
            {
                //Invoke GetAdminByEmailAndPasswordBL for checking email and password of Admin
                Retailer retailer = await RetailerBL.GetRetailerByEmailAndPasswordBL(email, password);

                if (retailer != null)
                {
                    return(UserType.Retailer, retailer);
                }
            }

            WriteLine("Invalid Email or Password. Please try again...");
            return(UserType.Anonymous, null);
        }