private void InitializeRepository() { cmSettings = ConnectionSettingsManager.GetCMSettings(); cmRepo = new CMRepository(cmSettings); crmSettings = ConnectionSettingsManager.GetCRMSettings(); crmRepo = new CRMRepository(crmSettings); }
public List <KeyValuePair <Guid, string> > GetCaseTypeList(IOrganizationService service, out string errorMsg) { int caseCount = 0; var query = new CRMRepository(); try { List <KeyValuePair <Guid, string> > typeStorage = new List <KeyValuePair <Guid, string> >(); EntityCollection _retrievedTypes = query.RetrieveCRMCaseTypes(service); //Trace.WriteLine("\n The following are returned case types from the current CRM environment"); foreach (Entity e in _retrievedTypes.Entities) { //add individual case types to a list string caseName = e.GetAttributeValue <string>(CaseTypeEntity.Name).Replace(" ", string.Empty).ToLower(); Guid caseId = e.GetAttributeValue <Guid>(CaseTypeEntity.ID); typeStorage.Add(new KeyValuePair <Guid, string>(caseId, caseName)); caseCount++; //Trace.WriteLine($"{caseCount} CRM Case Type: {caseName}, ID: {caseId}"); } errorMsg = null; return(typeStorage); } catch (FaultException <OrganizationServiceFault> e) { errorMsg = e.Message; Trace.WriteLine(e.Message); return(null); } }
public ActionResult OrderStatuses_remove(string id) { var parameters = AjaxModel.GetAjaxParameters(HttpContext); var mng = new CRMRepository(); try { if (mng.GetOrderStatuses().Single(x => x.id == int.Parse(id)).crm_orders.Count > 0) { return Json(new { result = false, mng = "Статус привязан к ордерам!", }, JsonRequestBehavior.AllowGet); } else { mng.DeleteOrderStatus(int.Parse(id)); return Json(new { result = true, mng = "Операция прошла успешно" }); } } catch (Exception ex) { RDL.Debug.LogError(ex); return Json(new { result = false, mng = "Ошибка" }); } }
static void Main(string[] args) { //CRM credentials var password = ""; var userName = ""; var crmURL = ""; var url = $"Url=https://{crmURL}.api.crm.dynamics.com/api/data/v9.0/; Username={userName}; Password={password}; authtype=Office365"; CRMRepository _crm = new CRMRepository(url); RetreiveRequest request = new RetreiveRequest { //Fetch a System user with the email of "*****@*****.**" EntityName = "systemuser", FieldsWanted = new string[] { "emailaddress1", "fullname", "statecode" }, FieldQuery = new List <FieldMatch> { new FieldMatch { FieldtoMatch = "emailaddress1", FielldValue = "*****@*****.**" } } }; var getMatchingUsers = _crm.GetRecords(request); //Get their status of Active or Inactive var firstContactsStatus = ((OptionSetValue)getMatchingUsers.Entities.FirstOrDefault()["statecode"]).Value; var secondContactsemail = getMatchingUsers.Entities.Skip(1).FirstOrDefault()["emailaddress1"]; }
public void UnsubscribeCRMSubscribersTest() { CRMSettings cmrSettings = new CRMSettings() { UserName = "******", Password = "******", Url = "https://internalcrm.virtua-it.si/TestiranjeCRM/", Domain = "it" }; List <Subscriber> importSubscribers = new List <Subscriber>() { new Subscriber() { E_mail = "*****@*****.**", Name = "Joze" }, new Subscriber() { E_mail = "*****@*****.**", Name = "Miha" }, new Subscriber() { E_mail = "*****@*****.**", Name = "Mojca" } }; CRMRepository repo = new CRMRepository(cmrSettings); repo.UnsubscribeSubscribers("328ec6c8-2f1e-e411-9419-005056a91611", importSubscribers); Assert.IsTrue(true); }
public EntityCollection GetProtectedCasesWithPaging(IOrganizationService service, Guid key, int value, out string errorMsg) { EntityCollection protectedCasesFromPaging = new EntityCollection(); try { if (key == null && key == default(Guid) && value != 0 && value != default(int)) { errorMsg = "Key or Value from Config is missing"; return(null); } var query = new CRMRepository(); protectedCasesFromPaging = query.RecordFetchPagingQuery(service, value, key); if (protectedCasesFromPaging != null) { errorMsg = null; return(protectedCasesFromPaging); } } catch (FaultException <OrganizationServiceFault> e) { errorMsg = e.Message; Trace.WriteLine(e.Message); return(null); } errorMsg = null; return(protectedCasesFromPaging); }
public ImportDataService() { _exportDataService = new ExportDataService(); _crmRepository = new CRMRepository(); _eventRepository = new EventRepository(); _configurationRespository = new ConfigurationRepository(); _hostedControlRepository = new HostedControlRepository(); _entityTypeRepository = new EntityTypeRepository(); _scriptletRepository = new ScriptletRepository(); _importResults = new List <ImportResult>(); _entitySearchRepository = new EntitySearchRepository(); _sessionLineRepository = new SessionLineRepository(); _optionRepository = new OptionRepository(); _actionRepository = new ActionRepository(); _actionCallrepository = new ActionCallRepository(); _subActionCallsRepository = new SubActionCallsRepository(); _eventActionCallRepository = new EventActionCallRepository(); _toolbarRepository = new ToolbarRepository(); _toolbarButtonRepository = new ToolbarButtonRepository(); _toolbarButtonActionCallRepository = new ToolbarButtonActionCallRepository(); _toolbarHostedControlRepository = new ToolbarHostedControlRepository(); _wnrRepository = new WNRRepository(); _wnrActionCallrepository = new WNRActionCallRepository(); _agentScriptTaskRepository = new AgentScriptTaskRepository(); _taskActionCallRepository = new TaskActionCallRepository(); _taskAnswerRepository = new TaskAnswerRepository(); _agentScriptAnswerRepository = new AgentScriptAnswerRepository(); _answerActionCallRepository = new AnswerActionCallrepository(); }
public EntityCollection GetProtectedCases(IOrganizationService service, List <KeyValuePair <Guid, int> > compiledCaseTypeList, out string errorMsg) { int count = 0; EntityCollection protectedCases = new EntityCollection(); try { var query = new CRMRepository(); var input = new CRMService(); var fetchLimit = int.Parse(ConfigurationManager.AppSettings["CaseFetchLimit"]); foreach (KeyValuePair <Guid, int> kpv in compiledCaseTypeList) { if (kpv.Value > fetchLimit) { EntityCollection protectedCasesFromPaging = input.GetProtectedCasesWithPaging(service, kpv.Key, kpv.Value, out errorMsg); Trace.WriteLine("\n Retreived cases from paging:"); foreach (Entity e in protectedCasesFromPaging.Entities) { protectedCases.Entities.Add(e); // EntityReference returnedCaseType = (EntityReference)e.Attributes[IncidentEntity.CaseType]; //Trace.WriteLine($"{count} Case ID: {e.Attributes[IncidentEntity.CaseNumber]}, Case Type: {returnedCaseType.Name}"); count++; } count = 0; } else { EntityCollection returnedCases = query.GetCasesForType(service, kpv.Key, kpv.Value); //Trace.WriteLine("\n Retreived CRM cases:"); if (returnedCases != null && returnedCases.Entities.Count > 0) { foreach (Entity e in returnedCases.Entities) { protectedCases.Entities.Add(e); //EntityReference returnedCaseType = (EntityReference)e.Attributes[IncidentEntity.CaseType]; //Trace.WriteLine($"{count} Case ID: {e.Attributes[IncidentEntity.CaseNumber]}, Case Type: {returnedCaseType.Name}"); count++; } } count = 0; } } if (protectedCases != null && protectedCases != default(EntityCollection)) { errorMsg = null; return(protectedCases); } errorMsg = null; return(null); } catch (FaultException <OrganizationServiceFault> e) { errorMsg = e.Message; Trace.WriteLine(e.Message); return(null); } }
// POST: api/CRM public bool Post([FromBody] Customer customer) { if (customer.Address != null) { XDocument xDoc = USPS.GetXDoc(customer.Address); List <Address> uspsAddresses = USPS.ValidateAddress(xDoc); customer.Address = uspsAddresses[0]; } ICrmRepository crmRespository = new CRMRepository(); return(crmRespository.UpsertCustomer(customer)); }
private void AddCustomer(List <string> args) { CRMRepository crmRepository = (CRMRepository)repository; args.Insert(0, crmRepository.GetNextID().ToString()); // Add new ID to arguments Customer newCustomer = (Customer)CreateEntity(args); CRM crm = repository.Get(); crm.AddCustomer(newCustomer); Console.WriteLine("Added new customer {0} {1} (ID = {2}) to the MRRC CRM.", newCustomer.firstName, newCustomer.lastName, newCustomer.ID); Console.WriteLine(); }
public void CRMSubscribersTest() { CRMSettings cmrSettings = new CRMSettings() { UserName = "******", Password = "******", Url = "internalcrm.virtua-it.si/TestiranjeCRM/", Domain = "it", ProtocolSSH = true }; CRMRepository repo = new CRMRepository(cmrSettings); List <Sync.BL.Entities.Subscriber> marketnigLists = repo.GetSubscribers("328ec6c8-2f1e-e411-9419-005056a91611"); Assert.IsNotNull(marketnigLists); }
public void MarketingListTest() { CRMSettings cmrSettings = new CRMSettings() { UserName = "******", Password = "******", Url = "internalcrm.virtua-it.si/TestiranjeCRM/", Domain = "it", ProtocolSSH = true }; CRMRepository repo = new CRMRepository(cmrSettings); List <Sync.BL.Entities.List> marketnigLists = repo.GetMarketingLists(); Assert.IsNotNull(marketnigLists); }
private void TestCrm() { List <Sync.BL.Entities.List> crmList; bool protocilSsh; this.Dispatcher.Invoke((Action)(() => { if (CRMProtocol.SelectedIndex == 0) { protocilSsh = false; } else { protocilSsh = true; } crmSettings = new CRMSettings() { UserName = CRMUserName.Text, Password = CRMPassword.Password, Domain = CRMDomain.Text, Url = CRMUrl.Text, ProtocolSSH = protocilSsh }; })); try { crmRepo = new CRMRepository(crmSettings); crmList = crmRepo.GetMarketingLists(); this.Dispatcher.Invoke((Action)(() => { MessageBox.Show(Application.Current.MainWindow, "Connection is OK"); TestingScreen.Visibility = System.Windows.Visibility.Hidden; })); } catch { this.Dispatcher.Invoke((Action)(() => { MessageBox.Show(Application.Current.MainWindow, "Test failed!"); TestingScreen.Visibility = System.Windows.Visibility.Hidden; })); } }
//Read from register (instalation path, connection settings) private void Initialization() { cmSettings = ConnectionSettingsManager.GetCMSettings(); crmSettings = ConnectionSettingsManager.GetCRMSettings(); try { cmRepo = new CMRepository(cmSettings); crmRepo = new CRMRepository(crmSettings); } catch (Exception) { EventLogManager.WriteMessage(new Message() { Description = "Connection settings error", Type = "Error", Time = DateTime.Now }, EventType.Error); } }
public ActionResult OrderStatuses_save() { var parameters = AjaxModel.GetAjaxParameters(HttpContext); var mng = new CRMRepository(); try { var fields = (parameters["fields"] as ArrayList).ToArray().ToList().Select(x=>x as Dictionary<string, object>).ToList(); var newOrderStatuses = new crm_orderStatuses { id = (AjaxModel.GetValueFromSaveField("id", fields) == "") ? 0 : int.Parse(AjaxModel.GetValueFromSaveField("id", fields)), name = (AjaxModel.GetValueFromSaveField("name", fields)), code = (AjaxModel.GetValueFromSaveField("code", fields)), color = (AjaxModel.GetValueFromSaveField("color", fields)) }; mng.SaveOrderStatus(newOrderStatuses); return Json(new { result = true, id = newOrderStatuses.id, mng = "Операция прошла успешно" }); } catch (Exception ex) { RDL.Debug.LogError(ex); return Json(new { result = false, id = 0, mng = "Ошибка", }, JsonRequestBehavior.AllowGet); } }
public CustomerTable(Menu parentMenu, CRMRepository crmRepository) : base(parentMenu, crmRepository) { }
static void Main(string[] args) { // Handle unsafe exit somewhat gracefully Console.CancelKeyPress += Console_CancelKeyPress; // Header/banner information Console.WriteLine("MATES RATES RENT-A-CAR"); Console.WriteLine("Where you rent a car for cheap and don't even need to return it with a full tank"); Console.WriteLine(); Console.WriteLine("Press 'q' to quit and save. Press 'h' to go home to the main menu. Press 'p' to go to the parent menu."); Console.WriteLine(); // Initial name prompt string name = ""; do { if (name.Length == 1) { Console.WriteLine("C'mon, your name surely has at least two letters..."); } Console.WriteLine("Let's begin, what's your name?"); Console.Write("$ "); name = Console.ReadLine().Trim(); Console.WriteLine(); } while (name == "" || name.Length == 1); Console.WriteLine("Welcome to MMRC, {0}", name); Console.WriteLine(); // Parse given arguments string customerFile = null; string vehicleFile = null; string rentalFile = null; // Assign values if (args.Length > 0) { customerFile = args[0]; } if (args.Length > 1) { vehicleFile = args[1]; } if (args.Length > 2) { rentalFile = args[2]; } // Let the user know if defaults are being used if (customerFile == null) { Console.WriteLine("Using default customer file in data directory..."); } if (vehicleFile == null) { Console.WriteLine("Using default vehicle file in data directory..."); } if (rentalFile == null) { Console.WriteLine("Using default rental file in data directory..."); } Console.WriteLine(); // Load in model data CRMRepository crmRepository = new CRMRepositoryFactory(customerFile).GetRepo(); Program.crmRepository = crmRepository; FleetRepository fleetRepository = new FleetRepositoryFactory(vehicleFile, rentalFile).GetRepo(); Program.fleetRepository = fleetRepository; // Validate files are readable try { crmRepository.entityParser.LoadAll(); fleetRepository.vehicleEntityParser.LoadAll(); fleetRepository.rentalEntityParser.LoadAll(); } catch (Exception e) { // Close the program and let the user know what is wrong Console.WriteLine(e.Message); Console.WriteLine("Exiting the program now... Remove this arg to use the default directory instead."); System.Threading.Thread.Sleep(5000); Environment.Exit(0); } // Input validators VehicleRegoValidator vehicleRegoValidator = new VehicleRegoValidator(); CustomerIDValidator customerIDValidator = new CustomerIDValidator(); NumSeatValidator numSeatValidator = new NumSeatValidator(); GPSValidator gpsValidator = new GPSValidator(); SunRoofValidator sunRoofValidator = new SunRoofValidator(); DailyRateValidator dailyRateValidator = new DailyRateValidator(); YearValidator yearValidator = new YearValidator(); NumDayValidator numDayValidator = new NumDayValidator(); // Handlers AddCustomerHandler addCustomerHandler = new AddCustomerHandler(crmRepository); EditCustomerHandler editCustomerHandler = new EditCustomerHandler(crmRepository, fleetRepository); DeleteCustomerHandler deleteCustomerHandler = new DeleteCustomerHandler(crmRepository, fleetRepository); AddVehicleHandler addVehicleHandler = new AddVehicleHandler(fleetRepository); EditVehicleHandler editVehicleHandler = new EditVehicleHandler(fleetRepository); DeleteVehicleHandler deleteVehicleHandler = new DeleteVehicleHandler(fleetRepository); RentVehicleHandler rentVehicleHandler = new RentVehicleHandler(fleetRepository, crmRepository); ReturnVehicleHandler returnVehicleHandler = new ReturnVehicleHandler(fleetRepository); SearchVehicleHandler searchVehicleHandler = new SearchVehicleHandler(fleetRepository); // Menus OptionMenu mainMenu = new OptionMenu(null, "Enter a number to select a function from the list below"); // Customer Menus OptionMenu crmMenu = mainMenu.AddOptionMenu("Please select a number below"); mainMenu.AddOption("Customer Management", crmMenu); // View all customers CustomerTable customerTable = (CustomerTable)crmMenu.AddTable(TableType.Customer, crmRepository); crmMenu.AddOption("View All Customers", customerTable); // Add customer InputMenu addCustomerMenu = crmMenu.AddInputMenu("AddCustomer", "Please fill out the following fields (* = required)"); crmMenu.AddOption("Add Customer", addCustomerMenu); addCustomerMenu.AddInput("Title*"); addCustomerMenu.AddInput("First Name*"); addCustomerMenu.AddInput("Last Name*"); addCustomerMenu.AddInput("Gender (male, female or other)*"); addCustomerMenu.AddInput("DoB (dd/mm/yyyy)*"); // Edit customer InputMenu editCustomerMenu = crmMenu.AddInputMenu("EditCustomer", "Please enter the ID of the customer to edit, followed by the " + "new data (leave blank to retain current information)"); crmMenu.AddOption("Edit Customer", editCustomerMenu); editCustomerMenu.AddInput("Customer ID", customerIDValidator); editCustomerMenu.AddInput("New ID (leave blank for current)", customerIDValidator, true); editCustomerMenu.AddInput("Title"); editCustomerMenu.AddInput("First Name"); editCustomerMenu.AddInput("Last Name"); editCustomerMenu.AddInput("Gender (male, female or other)"); editCustomerMenu.AddInput("DoB (dd/mm/yyyy)"); // Delete customer InputMenu deleteCustomerMenu = crmMenu.AddInputMenu("DeleteCustomer", "Please enter the ID of the customer you want to delete"); crmMenu.AddOption("Delete Customer", deleteCustomerMenu); deleteCustomerMenu.AddInput("Customer ID", customerIDValidator); // Fleet management OptionMenu fleetMenu = mainMenu.AddOptionMenu("Please select a number below"); mainMenu.AddOption("Fleet Management", fleetMenu); // View vehicles FleetTable fleetTable = (FleetTable)fleetMenu.AddTable(TableType.Fleet, fleetRepository); fleetMenu.AddOption("View Fleet", fleetTable); // Add vehicle InputMenu addVehicleMenu = fleetMenu.AddInputMenu("AddVehicle", "Please fill out the following fields (* = required)"); fleetMenu.AddOption("Add Vehicle", addVehicleMenu); addVehicleMenu.AddInput("Registration*", vehicleRegoValidator); addVehicleMenu.AddInput("Grade*"); addVehicleMenu.AddInput("Make*"); addVehicleMenu.AddInput("Model*"); addVehicleMenu.AddInput("Year*", yearValidator); addVehicleMenu.AddInput(string.Format("Num Seats ({0} - {1})", Vehicle.Min_Num_Seats, Vehicle.Max_Num_Seats), numSeatValidator, true); addVehicleMenu.AddInput("Transmission (automatic or manual)"); addVehicleMenu.AddInput("Petrol (petrol or diesel)"); addVehicleMenu.AddInput("GPS (yes or no)", gpsValidator, true); addVehicleMenu.AddInput("Sunroof (yes or no)", sunRoofValidator, true); addVehicleMenu.AddInput("Daily Rate (eg: 50, 78.65, etc)", dailyRateValidator, true); addVehicleMenu.AddInput("Colour"); // Edit vehicle InputMenu editVehicleMenu = fleetMenu.AddInputMenu("EditVehicle", "Please enter the registration of the vehicle to edit, followed by " + "the new data (leave blank to retain current information)"); fleetMenu.AddOption("Edit Vehicle", editVehicleMenu); editVehicleMenu.AddInput("Current Registration*", vehicleRegoValidator); editVehicleMenu.AddInput("New Registration (leave blank for current)", vehicleRegoValidator, true); editVehicleMenu.AddInput("Grade"); editVehicleMenu.AddInput("Make"); editVehicleMenu.AddInput("Model"); editVehicleMenu.AddInput("Year", yearValidator, true); editVehicleMenu.AddInput("Num Seats (2 - 10)", numSeatValidator, true); editVehicleMenu.AddInput("Transmission (automatic or manual)"); editVehicleMenu.AddInput("Petrol (petrol or diesel)"); editVehicleMenu.AddInput("GPS (yes or no)", gpsValidator, true); editVehicleMenu.AddInput("Sunroof (yes or no)", sunRoofValidator, true); editVehicleMenu.AddInput("Daily Rate (eg: 50, 78.65, etc)", dailyRateValidator, true); editVehicleMenu.AddInput("Colour"); // Delete vehicle InputMenu deleteVehicleMenu = fleetMenu.AddInputMenu("DeleteVehicle", "Please enter the registration of the vehicle you want to delete"); fleetMenu.AddOption("Delete Vehicle", deleteVehicleMenu); deleteVehicleMenu.AddInput("Registration"); // Rental menu OptionMenu rentalMenu = mainMenu.AddOptionMenu("Please select a number below"); mainMenu.AddOption("Rental Management", rentalMenu); // View rentals RentalTable rentalTable = (RentalTable)rentalMenu.AddTable(TableType.Rental, fleetRepository); rentalMenu.AddOption("View Rentals", rentalTable); // Search InputMenu searchMenu = rentalMenu.AddInputMenu("SearchVehicle", "Please enter your search query"); rentalMenu.AddOption("Search Vehicle", searchMenu); searchMenu.AddInput("Search*"); // Rent vehicle InputMenu rentVehicleMenu = rentalMenu.AddInputMenu("RentVehicle", "Please enter the information of the vehicle and " + "customer you want to rent to"); rentalMenu.AddOption("Rent Vehicle", rentVehicleMenu); rentVehicleMenu.AddInput("Customer ID*", customerIDValidator); rentVehicleMenu.AddInput("Registration*", vehicleRegoValidator); rentVehicleMenu.AddInput("Number of days*", numDayValidator); // Return vehicle InputMenu returnVehicleMenu = rentalMenu.AddInputMenu("ReturnVehicle", "Enter the registration of the vehicle to return"); rentalMenu.AddOption("Return Vehicle", returnVehicleMenu); returnVehicleMenu.AddInput("Registration*", vehicleRegoValidator); // Refresh tables for good measure customerTable.Refresh(); fleetTable.Refresh(); rentalTable.Refresh(); // Set current menu to main menu BasicDisplayable currentDisplay = mainMenu; // Inital display and prompt separate from loop currentDisplay.Print(); Console.Write("{0}@MMRC$ ", name); string action = Console.ReadLine(); if (action == null) { return; } action = action.Trim(); Console.WriteLine(); do { // Handle worst case scenario of no menu being present if (currentDisplay == null) { Console.WriteLine("Critical error - taking you back to the main menu"); currentDisplay = mainMenu; } // Handle core helper inputs first if (action.ToLower() == "q") { Console.WriteLine("It is sad to see you go... But don't worry - everything is being saved as we speak!"); System.Threading.Thread.Sleep(1000); // Sleep to give the user a chance to read the message crmRepository.Flush(); fleetRepository.Flush(); Environment.Exit(0); } if (action.ToLower() == "h") { Console.WriteLine("Got it chief! Taking you back to the main menu."); Console.WriteLine(); currentDisplay = mainMenu; } if (action.ToLower() == "p") { Menu currentMenu = (Menu)currentDisplay; if (currentMenu != null && currentMenu.parentMenu != null) { currentDisplay = currentMenu.parentMenu; } } // Display option menu if (currentDisplay.GetType() == typeof(OptionMenu)) { OptionMenu currentMenu = (OptionMenu)currentDisplay; InputValidator optionSelectionValidator = new OptionSelectionValidator(currentMenu.items); // Try to parse selected option and navigate to child menu try { optionSelectionValidator.Validate(action); int selectedValue = int.Parse(action) - 1; // Account for alternate indexing Option selectedOption = currentMenu.items.ElementAt(selectedValue); currentDisplay = selectedOption.childMenu; } catch (Exception e) { // Don't input an error message for action keys or a blank input if (action != "" && action.ToLower() != "q" && action.ToLower() != "h" && action.ToLower() != "p") { Console.WriteLine(e.Message); Console.WriteLine(); } } // Input menus usually result from option menus // Attempt to catch errors as input is passed to field validators try { currentDisplay.Print(); } catch (Exception e) { // Write friendly message Console.WriteLine(); Console.WriteLine(e.Message); Console.WriteLine(); // Take them back to the main menu and let them know where they are at currentDisplay = mainMenu; currentDisplay.Print(); } } // Display input menu if (currentDisplay.GetType() == typeof(InputMenu)) { InputMenu currentMenu = (InputMenu)currentDisplay; List <Input> items = currentMenu.items; List <string> answers = currentMenu.answers; // Match current input menu to the appropriate handler switch (currentMenu.id) { case "AddCustomer": addCustomerHandler.Handle(items, answers); break; case "EditCustomer": editCustomerHandler.Handle(items, answers); break; case "DeleteCustomer": deleteCustomerHandler.Handle(items, answers); break; case "AddVehicle": addVehicleHandler.Handle(items, answers); break; case "EditVehicle": editVehicleHandler.Handle(items, answers); break; case "DeleteVehicle": deleteVehicleHandler.Handle(items, answers); break; case "RentVehicle": rentVehicleHandler.Handle(items, answers); break; case "ReturnVehicle": returnVehicleHandler.Handle(items, answers); break; case "SearchVehicle": searchVehicleHandler.Handle(items, answers); break; default: Console.WriteLine("Something has gone wrong."); Console.WriteLine(); break; } currentDisplay = currentMenu.parentMenu; currentDisplay.Print(); } // Display table if (currentDisplay.GetType().IsSubclassOf(typeof(Table))) { Table currentTable = (Table)currentDisplay; currentDisplay = currentTable.parentMenu; currentDisplay.Print(); } // Prompt for next set of input Console.Write("{0}@MMRC$ ", name); action = Console.ReadLine(); if (action == null) { return; } action = action.Trim(); Console.WriteLine(); // Refresh the tables in case an action occurs during this iteration customerTable.Refresh(); fleetTable.Refresh(); rentalTable.Refresh(); } while (action != null); }
public RentVehicleHandler(FleetRepository repository, CRMRepository crmRepository) : base(repository) { this.crmRepository = crmRepository; }
public EditCustomerHandler(CRMRepository repository, FleetRepository fleetRepository) : base(repository) { this.fleetRepository = fleetRepository; }
public AddCustomerHandler(CRMRepository repository) : base(repository) { }