public static void UpdateAddresses(string studentIdToUpdate, int adressNoToUpdate) { Adress adressToUpdate = new Adress(); adressToUpdate = GetAdress(); ProgramSqlOperations.UpdateAdress(adressToUpdate, studentIdToUpdate, adressNoToUpdate); }
public static void UpdateRecord() { Console.Write("\n>>>Update Record"); SearchWebService.SearhWebServiceSoapClient client = new SearchWebService.SearhWebServiceSoapClient(); Console.Write("\n\nEnter Student Id to Update: "); string studentIdToUpdate = Utils.GetNumericValueWithValidation(Console.ReadLine(), "StudentId: ", "\nPlease Enter Valid StudentId with these format (#########)\n\n", true, 9); int isRecord = client.FindRecord(studentIdToUpdate); if (isRecord != -1) { Console.WriteLine("\n...Record cannot be found...\n"); return; } else { SearchFindPrintOperations.PrintRecord(studentIdToUpdate); Student studentToUpdate = new Student(); studentToUpdate = StudentOperations.GetStudentInformations(false, studentIdToUpdate); ProgramSqlOperations.UpdateStudent(studentToUpdate, studentIdToUpdate); string choice = "-1"; while (choice != "9") { Console.WriteLine("\nEnter Adress Number To Update || 9-EXIT"); choice = Console.ReadLine(); if (choice == "1") { AdressOperations.UpdateAddresses(studentIdToUpdate, 1); } else if (client.HowManyAdress(studentIdToUpdate) < Convert.ToInt32(choice) && Convert.ToInt32(choice) <= Constants.MAX_NUMBER_OF_ADRESS) { Console.Write("\nThere is no adress" + choice + ". Please enter valid address number or press 0 to add new adress"); choice = Console.ReadLine(); if (choice == "0") { AdressOperations.AddAlternativeAddresses(studentIdToUpdate); } } else if (client.HowManyAdress(studentIdToUpdate) > Convert.ToInt32(choice) - 1 && Convert.ToInt32(choice) <= Constants.MAX_NUMBER_OF_ADRESS) { AdressOperations.UpdateAddresses(studentIdToUpdate, Convert.ToInt32(choice)); } else if (choice == "9") { break; } else { Console.WriteLine("\nPlease enter valid number..."); } } Console.WriteLine("...Record Updated..."); } }
public static bool AddAlternativeAddresses(string Id) { SearchWebService.SearhWebServiceSoapClient client = new SearchWebService.SearhWebServiceSoapClient(); if (client.HowManyAdress(Id) == Constants.MAX_NUMBER_OF_ADRESS) { Console.WriteLine("You Have Already Add Three Adress. You Cannot Add More Adress Information"); return(false); } else { ProgramSqlOperations.InsertAdress(GetAdress(), Id); return(true); } }
public static void AddRecord() { Console.WriteLine("\n>>>Adding Record"); Console.WriteLine("\nPlease Enter Necessary Informations\n"); Student toAddStudent = new Student(); toAddStudent = StudentOperations.GetStudentInformations(true, ""); if (toAddStudent.StudentId == "false") { return; } AdressOperations.AddAlternativeAddresses(toAddStudent.StudentId); bool condition = true; while (condition) { Console.WriteLine("Dou you want to add more adress Y/N: "); string yes_no = Console.ReadLine(); if (yes_no == "Y" || yes_no == "y") { bool status = AdressOperations.AddAlternativeAddresses(toAddStudent.StudentId); if (status) { condition = true; } else { condition = false; } } else if (yes_no == "N" || yes_no == "n") { condition = false; } else { Console.WriteLine("\nPlease Enter Y or N: "); } } ProgramSqlOperations.InsertStudent(toAddStudent); Console.WriteLine("\n...Added...\n"); }
public static void RemoveRecord() { Console.Write("\n>>>Remove Record"); Console.Write("\n\nStudentId to remove: "); string studentIdToRemove = Utils.GetNumericValueWithValidation(Console.ReadLine(), "StudentId: ", "\nPlease Enter Valid StudentId with these format (#########)\n\n", true, 9); SearchWebService.SearhWebServiceSoapClient client = new SearchWebService.SearhWebServiceSoapClient(); int isRecord = client.FindRecord(studentIdToRemove); if (isRecord != -1) { Console.WriteLine("\n...Record cannot be found...\n"); return; } else { SearchFindPrintOperations.PrintRecord(studentIdToRemove); Console.WriteLine("Are you sure Y/N: "); bool condition = true; while (condition) { string yes_no = Console.ReadLine(); if (yes_no == "Y" || yes_no == "y") { ProgramSqlOperations.DeleteRecords(studentIdToRemove); Console.WriteLine("\n...Record Removed...\n"); condition = false; } else if (yes_no == "N" || yes_no == "n") { Console.WriteLine("\n...Record Remove Canceled...\n"); condition = false; return; } else { Console.WriteLine("\nPlease Enter Y or N: "); } } } }