public void InsertTest() { var task1 = CustomerManager.Load(); Customer customer = task1.Result.FirstOrDefault(); task1.Wait(); var task2 = EmployeeManager.Load(); Employee employee = task2.Result.FirstOrDefault(); task2.Wait(); var task3 = ServiceTypeManager.Load(); ServiceType serviceType = task3.Result.FirstOrDefault(); task3.Wait(); Appointment appointment = new Appointment { CustomerId = customer.Id, EmployeeId = employee.Id, StartDateTime = DateTime.Now, EndDateTime = DateTime.Now.AddHours(2), ServiceId = serviceType.Id, Status = AppointmentStatus.Scheduled.ToString() }; var task4 = AppointmentManager.Insert(appointment, true); bool result = task4.Result; task4.Wait(); Assert.IsTrue(result == true); }
public JsonResult GetAvailableServiceTypes() { List <ServiceType> models = new ServiceTypeManager().GetServiceTypes(); List <SelectListItem> modelsSelectList = new List <SelectListItem> { new SelectListItem { Text = "Select Service Type", Value = Guid.Empty.ToString() } }; if (models != null) { foreach (ServiceType model in models) { modelsSelectList.Add(new SelectListItem { Text = model.ServiceTypeName, Value = model.ServiceTypeGuid.ToString() }); } } return(Json(new SelectList(modelsSelectList, "Value", "Text"), JsonRequestBehavior.AllowGet)); }
public JsonResult AutocompleteServiceTypeProviderOrProgram(string term) { var serviceTypeNames = ServiceTypeManager.SearchNames(term); var providerNames = ProviderManager.SearchProviderNames(term); var programNames = ProgramManager.SearchProgramNames(term); var filteredItems = serviceTypeNames.Union(providerNames).Union(programNames).Distinct().OrderBy(n => n); return(Json(filteredItems, JsonRequestBehavior.AllowGet)); }
public ActionResult Update(ServiceType model) { if (ModelState.IsValid) { int result = new ServiceTypeManager().Update(model); return(RedirectToAction("Services")); } return(View(model)); }
public async Task <ActionResult <ServiceType> > Get(Guid id) { try { return(Ok(await ServiceTypeManager.LoadById(id))); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public async Task <IActionResult> Put([FromBody] ServiceType serviceType, bool rollback = false) { try { return(Ok(await ServiceTypeManager.Update(serviceType, rollback))); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public void LoadTest() { int expected = 3; var task = ServiceTypeManager.Load(); List <ServiceType> serviceTypes = task.Result; task.Wait(); Assert.AreEqual(expected, serviceTypes.Count); }
public void InitializeTest() { EducationContext = new EducationDataContext(); Container = AssemblySetup.CreateWindsorContainer(EducationContext); RepositoryContainer repositoryContainer = new RepositoryContainer(Container, EducationContext); ProviderManager providerManager = new ProviderManager(repositoryContainer, new DataTableBinder()); ProgramManager programManager = new ProgramManager(repositoryContainer, new DataTableBinder()); ServiceTypeManager serviceTypeManager = new ServiceTypeManager(repositoryContainer, new DataTableBinder()); Target = new PartnersController(providerManager, programManager, serviceTypeManager); }
public async Task <IActionResult> Delete(Guid id, bool rollback = false) { try { return(Ok(await ServiceTypeManager.Delete(id, rollback))); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
private void btnExport_Click(object sender, RoutedEventArgs e) { try { switch (cboData.SelectedValue) { case "Customer": CustomerManager.ExportExcel(customers); lblStatus.Content = "Successfully Exported Customers"; break; case "Employee": EmployeeManager.ExportExcel(employees); lblStatus.Content = "Successfully Exported Employees"; break; case "Appointment": AppointmentManager.ExportExcel(appointments); lblStatus.Content = "Successfully Exported Appointments"; break; case "Service Type": ServiceTypeManager.ExportExcel(serviceTypes); lblStatus.Content = "Successfully Exported Service Types"; break; case "Invoice": if (grdData.SelectedValue == null) { //export the whole grid to excel InvoiceManager.ExportExcel(invoices); lblStatus.Content = "Successfully Exported Invoices"; } else { //export a selected item to PDF string invoicePDF = "Invoice" + "-" + invoice.ServiceDate.ToString("MM-dd-yyyy") + "-" + invoice.CustomerFullName; InvoiceManager.InvoicePDF(invoicePDF, invoice); } break; case "User": UserManager.ExportExcel(users); lblStatus.Content = "Successfully Exported Users"; break; } } catch (Exception ex) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = ex.Message; } }
public void DeleteTest() { var task = ServiceTypeManager.Load(); ServiceType serviceType = task.Result.FirstOrDefault(); task.Wait(); var task2 = ServiceTypeManager.Delete(serviceType.Id, true); int result = task2.Result; task2.Wait(); Assert.IsTrue(result > 0); }
public void UpdateTest() { var task = ServiceTypeManager.Load(); ServiceType serviceType = task.Result.FirstOrDefault(); task.Wait(); serviceType.CostPerSQFT = 0.003M; var task2 = ServiceTypeManager.Update(serviceType, true); int result = task2.Result; task2.Wait(); Assert.IsTrue(result > 0); }
public void LoadByIdTest() { var task = ServiceTypeManager.Load(); List <ServiceType> serviceTypes = task.Result; task.Wait(); Guid id = serviceTypes.FirstOrDefault().Id; var task2 = ServiceTypeManager.LoadById(id); ServiceType serviceType = task2.Result; task2.Wait(); Assert.IsTrue(serviceType.Id == id); }
public void LoadByIdDescription() { var task = ServiceTypeManager.Load(); List <ServiceType> serviceTypes = task.Result; task.Wait(); string description = serviceTypes.FirstOrDefault().Description; var task2 = ServiceTypeManager.LoadByDescription(description); ServiceType serviceType = task2.Result; task2.Wait(); Assert.IsTrue(serviceType.Description == description); }
public void TestInitialize() { EducationContext = new EducationDataContext(); Container = AssemblySetup.CreateWindsorContainer(EducationContext); RepositoryContainer repositoryContainer = new RepositoryContainer(Container, EducationContext); LogicManager = new ServiceTypeManager(repositoryContainer, new DataTableBinder()); HttpContext context = new HttpContext(new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter())); HttpContext.Current = context; User = new EducationSecurityPrincipal(new UserRepository(EducationContext).Items.Where(s => s.UserKey == "Bob").Single()); context.User = User; Target = new ServiceTypeController(LogicManager); ControllerContext controllerContext = new ControllerContext(new HttpContextWrapper(context), new RouteData(), Target); Target.ControllerContext = controllerContext; }
public void TestInitialize() { EducationContext = new EducationDataContext(); Container = AssemblySetup.CreateWindsorContainer(EducationContext); RepositoryContainer repositoryContainer = new RepositoryContainer(Container, EducationContext); ServiceOfferingManager logicManager = new ServiceOfferingManager(repositoryContainer, new DataTableBinder()); ServiceTypeManager serviceTypeManager = new ServiceTypeManager(repositoryContainer, new DataTableBinder()); ProviderManager providerManager = new ProviderManager(repositoryContainer, new DataTableBinder()); ProgramManager programManager = new ProgramManager(repositoryContainer, new DataTableBinder()); HttpContext context = new HttpContext(new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter())); User userEntity = EducationContext.Users.Include("UserRoles.Role").Include("UserRoles.Schools").Include("UserRoles.Providers").Single(s => s.UserKey == "Bob"); User = new EducationSecurityPrincipal(userEntity); context.User = User; Target = new ServiceOfferingController(logicManager, serviceTypeManager, providerManager, programManager, MockRepository.GenerateMock <IFileProcessor>()); ControllerContext controllerContext = new ControllerContext(new HttpContextWrapper(context), new RouteData(), Target); Target.ControllerContext = controllerContext; }
public async Task <IActionResult> Post([FromBody] ServiceType serviceType, bool rollback = false) { try { var result = await ServiceTypeManager.Insert(serviceType, rollback); if (result == true) { return(Ok(serviceType.Id)); } else { return(Ok(string.Empty)); } } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public void InsertTest() { var task = CustomerManager.Load(); Customer customer = task.Result.FirstOrDefault(); task.Wait(); ServiceType serviceType = new ServiceType { Description = "Rake Leaves", CostPerSQFT = 0.004M }; var task2 = ServiceTypeManager.Insert(serviceType, true); bool result = task2.Result; task2.Wait(); Assert.IsTrue(result == true); }
public ActionResult Update(Guid serviceTypeGuid) { ServiceType model = new ServiceTypeManager().Read(serviceTypeGuid); return(View(model)); }
public ActionResult ServiceTypes() { List <ServiceType> services = new ServiceTypeManager().GetServiceTypes(); return(View(services)); }