public bool IsUserEntryValid(UserEntry user) { EmailValidator emailValidate = new EmailValidator(); PasswordValidator passwordValidate = new PasswordValidator(10); bool validMail = false; bool validPass = false; if (emailValidate.IsValidAddress(user.Email)) { validMail = true; } if (passwordValidate.IsValidPassword(user.Password)) { validPass = true; } return(validMail && validPass); }
static void Main(string[] args) { Dataset newDataset = new Dataset("csv.txt"); Analyzer3rdParty newAnalyzer = new Analyzer3rdParty(); Adapter newAdapter = new Adapter(newAnalyzer); double[] averageRows = newAdapter.CalculateAveragePerRow(newDataset); double[] averageColumns = newAdapter.CalculateAveragePerColumn(newDataset); for (int i = 0; i < averageRows.Length; i++) { Console.WriteLine(averageRows[i]); } for (int i = 0; i < averageColumns.Length; i++) { Console.WriteLine(averageColumns[i]); } List <IRentable> HitList = new List <IRentable>(); Video video = new Video("Game of Thrones"); Book book = new Book("Osnove Elektrotenike 1"); HitList.Add(video); HitList.Add(book); RentingConsolePrinter printer = new RentingConsolePrinter(); printer.PrintTotalPrice(HitList); printer.DisplayItems(HitList); HotItem hitVideo = new HotItem(new Video("Breaking Bad")); HotItem hitBook = new HotItem(new Book("Osnove elektrotehnike 2")); HitList.Add(hitVideo); HitList.Add(hitBook); printer.PrintTotalPrice(HitList); printer.DisplayItems(HitList); List <IRentable> flashSale = new List <IRentable>(); for (int i = 0; i < 4; i++) { flashSale.Add(new DiscountedItem(HitList[i], 20)); } printer.PrintTotalPrice(flashSale); printer.DisplayItems(flashSale); string mail = "*****@*****.**"; string password = "******"; EmailValidator emailValidator = new EmailValidator(); PasswordValidator passwordValidator = new PasswordValidator(10); if (emailValidator.IsValidAddress(mail)) { Console.WriteLine("E-mail address " + mail + " is correct."); } else { Console.WriteLine("E-mail address " + mail + " is NOT correct."); } if (passwordValidator.IsValidPassword(password)) { Console.WriteLine("Password is correct."); } else { Console.WriteLine("Password is NOT correct."); } }
static void Main(string[] args) { // Dataset data = new Dataset("csv.txt"); // Analyzer3rdParty analyze = new Analyzer3rdParty(); // Adapter adapter = new Adapter(analyze); // double[] averageValues = adapter.CalculateAveragePerColumn(data); // for (int i = 0; i < averageValues.Length; i++) // { // Console.WriteLine(averageValues[i]); // } // averageValues = adapter.CalculateAveragePerRow(data); // for (int i = 0; i < averageValues.Length; i++) // { // Console.WriteLine(averageValues[i]); // } // List<IRentable> list = new List<IRentable>(); // Video video = new Video("His Dark Materials"); // Book book = new Book("Song of ice and fire"); //// Video popularVideo = new Video("Lord of the rings"); //// Book popularBook = new Book("Harry Potter"); // HotItem popularVideo = new HotItem(new Video("Lord of the rings")); // HotItem popularBook = new HotItem(new Book("Harry Potter")); // list.Add(video); // list.Add(book); // list.Add(popularBook); // list.Add(popularVideo); // RentingConsolePrinter rent = new RentingConsolePrinter(); // rent.DisplayItems(list); // rent.PrintTotalPrice(list); // // pri ispisu popularni proizvodi imaju oznaku trending // DiscountedItem discountedVideo = new DiscountedItem(new Video("When they see us"), 50); // DiscountedItem discountedBook = new DiscountedItem(new Book("The unfinished tales"), 30); // List<IRentable> flashSale = new List<IRentable>(); // flashSale.Add(discountedVideo); // flashSale.Add(discountedBook); // rent.DisplayItems(flashSale); // rent.PrintTotalPrice(flashSale); string password = new string("kiSELI_KR45tavCIsFEFEronama_IZ_'99"); string email = new string("*****@*****.**"); PasswordValidator passValidator = new PasswordValidator(8); EmailValidator emailValidator = new EmailValidator(); if (passValidator.IsValidPassword(password)) { Console.WriteLine("Pasword is valid"); } if (emailValidator.IsValidAddress(email)) { Console.WriteLine("email is valid"); } Validator validate = new Validator(); UserEntry entry = UserEntry.ReadUserFromConsole(); while (!validate.IsUserEntryValid(entry)) { entry = UserEntry.ReadUserFromConsole(); } }
public UserValidator() { PasswordValidator = new PasswordValidator(10); EmailValidator = new EmailValidator(); }
public RegistrationValidator() { mailValidator = new EmailValidator(); passwordValidator = new PasswordValidator(10); }