xxxxxxxxxx
from location in _context.Businessunit
where request.locationId.Contains(location.Id)
join client in _context.Businessunit on location.Parentbusinessunitid equals client.Id
join building in _context.Area on location.AddressId equals building.AddressId
where building.Appcategoryname == "Building" && building.IsEnable == true
join floor in _context.Area on building.Id equals floor.Parentareaid
where floor.Appcategoryname == "Floor" && building.IsEnable == true
join department in _context.Area on floor.Id equals department.Parentareaid
where department.Appcategoryname == "Department" && building.IsEnable == true
join equipment in _context.Equipment on department.Id equals equipment.Areaid
join device in _context.Device on equipment.Id equals device.Equipmentid
where device.IsEnable == true
select new
{
deviceId = device.Id,
deviceName = device.Devicename,
deviceNummber = device.DeviceNumber,
isConnected = device.IsConnected,
lastConnected = device.LastConnected,
lastSprayCycle = device.LastActualCommunicatedAt,
location_name = location.Name,
customer = client.Name,
building_name = building.AreaName,
floor_name = floor.AreaName,
department_name = department.AreaName,
}
xxxxxxxxxx
"Select [Supplier Name] as Supplier_Name,MIN(Invoice_ID) as Invoice_ID, MIN(LogDated) as LogDated," +
"IIF(MIN(CAST([Traning Locked] as Nvarchar(1)))=1,'True','False') As[Training_Locked],"+
"Sum(IIF([OCR Exception] IS NOT NULL, 1, 0)) as [With_OCR_Exception],"+
"Sum(IIF([OCR Exception] IS NULL, 1, 0)) as [Without_OCR_Exception],"+
"COUNT([Invoice_ID]) as [Total],"+
"CAST((Sum(IIF([OCR Exception] IS not NULL, 1, 0)) * 100.0 / Count([Invoice_ID]))/100.0 as decimal(10, 3)) as [Percent]"+
"from[dbo].[qry_AllInvoiceOCRException] where AutomationStatus like '%Completed%' and ([Supplier Name] != '' or[Supplier Name] is not null)"+
"Group By[Supplier Name]"
xxxxxxxxxx
CREATE PROCEDURE [dbo].[GetContactType]
(
@ContactTypeId UNIQUEIDENTIFIER = NULL
,@RowStatusId UNIQUEIDENTIFIER = '10000000-0000-0000-0000-000000000000'
,@IncludeAuditFields BIT = 0
,@ReturnCode INT = 0 OUTPUT
)
AS
BEGIN;
SET NOCOUNT ON;
SET @ReturnCode = 0;
SELECT [dbo].[GetContactTypeXml]
(@ContactTypeId
,@RowStatusId
,@IncludeAuditFields) AS [Result];
RETURN @ReturnCode;
END;
xxxxxxxxxx
select c.*,s1.BPServicerNameDisplay,s2.BPServicerNameDisplay,s3.BPServicerNameDisplay,s4.BPServicerNameDisplay
from Clients c
left join ServicerClientRoles scr1 on c.ClientUID=scr1.clientuid and scr1.ServicerRoleID = 1
left join servicers s1 on scr1.ServicerUID=s1.ServicerUID
left join ServicerClientRoles scr2 on c.ClientUID=scr2.clientuid and scr2.ServicerRoleID = 2
left join servicers s2 on scr2.ServicerUID=s2.ServicerUID
left join ServicerClientRoles scr3 on c.ClientUID=scr3.clientuid and scr3.ServicerRoleID = 3
left join servicers s3 on scr3.ServicerUID=s3.ServicerUID
left join ServicerClientRoles scr4 on c.ClientUID=scr4.clientuid and scr4.ServicerRoleID = 4
left join servicers s4 on scr4.ServicerUID=s4.ServicerUID
where c.ClientUID='189A30C0-6AEA-EB11-B838-0050569E34FB'
xxxxxxxxxx
SELECT MarketingEmailSchedule.id as MarketingID,MarketingEmailSchedule.MarketingGroupSourceId,MarketingEmailSchedule.MarketingGroupId
,MarketingEmailSchedule.MarketingTemplateId,MarketingEmailSchedule.Subject,MarketingEmailSchedule.SendAsEmailId,MarketingEmailSchedule.ScheduledBy,MarketingEmailSchedule.ScheduledDate,GeneratedEmailHeader.Id as EmailHeaderId
FROM GeneratedEmailHeader JOIN MarketingEmailSchedule
ON GeneratedEmailHeader.MarketingEmailScheduleId = MARKETINGEMAILSCHEDULE.ID
join GeneratedEmail on GeneratedEmail.GeneratedEmailHeaderId = GeneratedEmailHeader.Id
where GeneratedEmailHeader.EmailGeneratedCount=GeneratedEmailHeader.SuccessfulEmailcount
select * from MarketingEmailSchedule
select * from GeneratedEmail
select * from GeneratedEmailHeader
xxxxxxxxxx
SELECT * FROM FLDR.FormInstance WHERE FolderVersionID IN (9224) AND FormDesignVersionID = 2593 AND AnchorDocumentID IN (SELECT DISTINCT AnchorDocumentID FROM FLDR.FormInstance WHERE FolderVersionID IN (9224))
xxxxxxxxxx
select g.GroupId , g.GroupName, m.Title, p.ProjectId, p.BudgetEstimated, p.BudgetPlanned, p.BudgetConfirmed
from Groups g Join Menu m
on g.GroupId = m.GroupId
Join ProjectBudgets p
on p.ProjectId = '7BD2AA0C-6D78-48E3-9758-168135B7116B'
xxxxxxxxxx
select * from VendorTicket (nolock) where IncidentID in (select IncidentID from Incident (nolock) where ClosedDate is null) and VendorID!=3 order by TicketID