using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using Neo.LegitimateLicences.Common; using Neo.Afx.Security; using System.Data.Entity; namespace Neo.LegitimateLicences.Data.Models { public partial class LegitimateDatabase { #region GetOfficeLocations public List GetOfficeLocations(long userID) { return Context.Vw_OfficeLocations.ToList(); } #endregion #region GetOfficeLocationView public Vw_OfficeLocation GetOfficeLocationView(long officeLocationID) { return Context.Vw_OfficeLocations.Where(a => a.OfficeLocationID == officeLocationID).FirstOrDefault(); } #endregion #region GetLicenceDurations public List GetLicenceDurations(long userID) { return Context.LicenceDurations.Where(a => !a.IsCancelled).OrderBy(a => a.DurationInMonths).ToList(); } #endregion #region GetVehicleModels public List GetVehicleModels() { return Context.Vw_VehicleModels.Where(a => !a.IsCancelled).OrderBy(a => a.VehicleMake).ThenBy(a =>a.Description).ToList(); } #endregion #region UpsertVehicleModel public void UpsertVehicleModel(VehicleModel vehicleModel, long userID) { Context.Pr_VehicleModelUpsert(vehicleModel.VehicleModelID, vehicleModel.VehicleMakeID, vehicleModel.Description, vehicleModel.SeatedCapacityExcludingDriver, vehicleModel.StandingCapacity, vehicleModel.GrossWeight, vehicleModel.TareWeight, vehicleModel.VehicleTypeID, vehicleModel.CarryingCapacityID, vehicleModel.IsValidModel, userID); } #endregion #region CancelVehicleModel public void CancelVehicleModel(short vehicleModelID, long userID, string cancelReason) { Context.Pr_VehicleModelCancel(vehicleModelID, userID, cancelReason); } #endregion #region GetLicencingBoards public List GetLicencingBoards() { return Context.Vw_LicencingBoards.Where(a => !a.IsCancelled).OrderBy(a => a.Description).ToList(); } #endregion #region UpsertLicencingBoard public void UpsertLicencingBoard(LicencingBoard licencingBoard, long userID) { Context.Pr_LicencingBoardUpsert(licencingBoard.LicencingBoardID, licencingBoard.Description, licencingBoard.ProvinceID, (short)(licencingBoard.IsCancelled == true ? 1 : 0), userID); } #endregion #region CancelLicencingBoard public void CancelLicencingBoard(short licencingBoardID, long userID, string reason) { Context.Pr_LicencingBoardCancel(licencingBoardID, userID, reason); } #endregion #region GetVehicleMakes public List GetVehicleMakes() { return Context.Vw_VehicleMakes.Where(a => !a.IsCancelled).OrderBy(a => a.Description).ToList(); } #endregion #region UpsertVehicleMake public void UpsertVehicleMake(VehicleMake vehicleMake, long userID) { Context.Pr_VehicleMakeUpsert(vehicleMake.VehicleMakeID, vehicleMake.Description,vehicleMake.IsCancelled , userID); } #endregion #region CancelVehicleMake public void CancelVehicleMake(short vehicleMakeID, long userID, string reason) { Context.Pr_VehicleMakeCancel(vehicleMakeID, userID, reason); } #endregion #region GetSettings public IEnumerable GetSettings() { return Context.Vw_Settings.ToList().OrderBy(a => a.SettingName); } #endregion #region UpdateSetting public void UpdateSetting(string settingName, string settingValue, long userID, string auditDescription) { Context.Pr_SettingUpsert(settingName, settingValue, userID, auditDescription); } #endregion #region GetInspectors public List GetInspectorsView() { return Context.Pr_InspectorsGetView().ToList(); } #endregion #region UpsertInspector public void UpsertInspector(Inspector Inspector, long userID) { Context.Pr_InspectorUpsert(Inspector.InspectorID, Inspector.Name, Inspector.OfficeLocationID, userID); } #endregion #region CancelInspector public void CancelInspector(short InspectorID, long userID, string reason) { Context.Pr_InspectorCancel(InspectorID, userID, reason); } #endregion #region GetDivisionTypeAnnexureMappings public List GetDivisionTypeAnnexureMappings() { return Context.Vw_DivisionTypeAnnexureMappings.Where(a => !a.IsCancelled).ToList(); } #endregion #region SearchDivisionTypeAnnexureMapping public DivisionTypeAnnexureMapping SearchDivisionTypeAnnexureMapping(short serviceTypeID, short? vehicleTypeID, long userID) { return Context.Pr_DivisionTypeAnnexureMappingSearch(serviceTypeID, vehicleTypeID, userID).FirstOrDefault(); } #endregion #region GetServiceVehicleTypes public List GetServiceVehicleTypes() { return Context.ServiceVehicleTypes.ToList(); } #endregion } }