public DC_UnprocessedExecuterData getScalerCount(DC_UnprocessedExecuterData QueryID)
 {
     using (BL_SchedulerServices obj = new BL_SchedulerServices())
     {
         return(obj.getScalerCount(QueryID));
     }
 }
Beispiel #2
0
        public DC_UnprocessedExecuterData getScalerCount(DC_UnprocessedExecuterData QueryID)
        {
            DC_UnprocessedExecuterData RunningData = new DC_UnprocessedExecuterData();

            try
            {
                StringBuilder sb = new StringBuilder();

                switch (QueryID.TotalCount)
                {
                case 1:
                    sb.Append(" DECLARE @CountOfRunning int;DECLARE @default uniqueidentifier = cast(cast(0 as binary) as uniqueidentifier);select @CountOfRunning = count(0) from Supplier_ApiCallLog where status = 'RUNNING';");
                    sb.Append(" select  @CountOfRunning TotalCount; ");
                    break;

                default:
                    break;
                }



                using (ConsumerEntities context = new ConsumerEntities())
                {
                    context.Database.CommandTimeout = 0;
                    RunningData = context.Database.SqlQuery <DC_UnprocessedExecuterData>(sb.ToString()).ToList().FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new FaultException <DataContracts.DC_ErrorStatus>(new DataContracts.DC_ErrorStatus
                {
                    ErrorMessage    = "Error while fetching Logger Tasks",
                    ErrorStatusCode = System.Net.HttpStatusCode.InternalServerError
                });
            }

            return(RunningData);
        }