public List <Inspection> BulkAssign(UserAccess UA) { if (InspectionIds.Count == 0) { return(new List <Inspection>()); } if (InspectorId == 0) { BulkAssignToUnassigned(); } else { BulkAssignToInspector(); } return(Inspection.GetInspections(UA)); }
private static object InitItem(string key) { switch (key.Trim().ToLower()) { case "units": return(Unit.GetInspectionUnits()); case "inspectors": return(Inspector.Get()); case "contractinspectors": return(Inspector.GetContractInspectors()); case "useraccess": return(UserAccess.GetAllUserAccess()); default: return(null); } }
public static List <Inspection> GetInspections(UserAccess UA) { string query = @" SELECT RBL ,RME ,REL ,RPL ,CBL ,CME ,CEL ,CPL ,Fire ,LookupKey ,AddressNumber ,StreetName ,ProjClass ,ProjPreDir ,ProjPostDir ,StreetAddressCombined ,City ,Zip ,InspectorName ,Color ,InspectionDescription ,PermitNo ,ResultADC ,InspectionCode ,ScheduledDate ,MasterPermitNumber ,PropUseInfo ,ParcelNo ,InspReqID ,InspDateTime ,Project_Address_X ,Project_Address_Y ,Parcel_Centroid_X ,Parcel_Centroid_Y ,IsCommercial ,PrivateProviderInspectionRequestId ,NTUsername ,Sort_Order ,PreviousInspectionRemarks FROM WATSC.dbo.vwInspectionViewList ORDER BY LTRIM(RTRIM(InspectorName)) ASC, ISNULL(Sort_Order, 0) ASC, StreetName, ProjClass, ProjPreDir, ProjPostDir, AddressNumber"; try { var li = Constants.Get_Data <Inspection>(query, Constants.csWATSC); int badPointCount = 0; if (UA.current_access == UserAccess.access_type.contract_access) { var contractors = Inspector.GetCachedContractInspectors(); var names = (from c in contractors select c.Name).ToList().Distinct(); li.RemoveAll((i) => !names.Contains(i.InspectorName)); } foreach (Inspection i in li) { i.myInspection = (i.NTUsername.Length > 0 && UA.user_name.ToLower() == i.NTUsername.ToLower()); i.AddressPoint = new Point(i.Project_Address_X, i.Project_Address_Y); i.ParcelPoint = new Point(i.Parcel_Centroid_X, i.Parcel_Centroid_Y); i.PointToUse = i.AddressPoint.IsValid ? i.AddressPoint : i.ParcelPoint; if (!i.PointToUse.IsValid) { i.PointToUse = new Point(440000, 2100000 - (25 * badPointCount)); badPointCount += 1; } if (UA.current_access == UserAccess.access_type.inspector_access || UA.current_access == UserAccess.access_type.admin_access) { if (i.ResultADC == "") { i.CanBeAssigned = true; } } } return(li); } catch (Exception ex) { new ErrorLog(ex, query); return(null); } }