Exemplo n.º 1
0
        protected void Application_Start()
        {
            using (var context = new UprdDbEntities1())
                SqlConnectionString = context.Database.Connection.ConnectionString;

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            if (!String.IsNullOrEmpty(SqlConnectionString))
            {
                SqlDependency.Start(SqlConnectionString);
            }

            JobSchedularForAlerts.Start();
        }
Exemplo n.º 2
0
        public async static void Start()
        {
            UprdDbEntities1 DbContext = new UprdDbEntities1();

            IScheduler scheduler = await StdSchedulerFactory.GetDefaultScheduler();

            #region Uprd Status Daily Alert
            IJobDetail jobUprdStatusAlert     = JobBuilder.Create <UprdStatusResultDailyAlert>().Build();
            ITrigger   triggerUprdStatusAlert = TriggerBuilder.Create()
                                                .WithIdentity("UprdStatusAlert", "groupUprdStatusAlert")
                                                .StartNow()
                                                .WithDailyTimeIntervalSchedule(s => s.WithIntervalInHours(24)
                                                                               .StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(23, 00)))
                                                //.WithDailyTimeIntervalSchedule(s => s.WithIntervalInMinutes(3))
                                                .Build();
            #endregion

            await scheduler.Start();

            await scheduler.ScheduleJob(jobUprdStatusAlert, triggerUprdStatusAlert);
        }
Exemplo n.º 3
0
        public List <OACYPerTransactionDTO> GetByPostDateEffDate(string pipelineDuns, DateTime?postdate, DateTime?effdate, string keyword, string Cycle)
        {
            var             pDate = postdate.GetValueOrDefault().Date;
            var             pTime = postdate.GetValueOrDefault().TimeOfDay;
            var             eDate = effdate.GetValueOrDefault().Date;
            UprdDbEntities1 db    = new UprdDbEntities1();
            var             query = db.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns).AsQueryable();

            if (!string.IsNullOrEmpty(keyword))
            {
                query = query.Where(a => a.Loc.Contains(keyword) || a.LocName.Contains(keyword));
            }
            if (!string.IsNullOrEmpty(Cycle))
            {
                query = query.Where(a => a.CycleIndicator == Cycle);
            }
            if (!string.IsNullOrEmpty(pDate.ToString()) && pDate != DateTime.MinValue && TimeSpan.MinValue != pTime)
            {
                query = query.Where(a => DbFunctions.TruncateTime(a.PostingDateTime) == pDate && DbFunctions.CreateTime(a.PostingDateTime.Value.Hour, a.PostingDateTime.Value.Minute, a.PostingDateTime.Value.Second) >= pTime);
            }
            if (!string.IsNullOrEmpty(eDate.ToString()) && eDate != DateTime.MinValue)
            {
                query = query.Where(a => DbFunctions.TruncateTime(a.EffectiveGasDayTime) == eDate);
            }
            return(query.Select(o => new OACYPerTransactionDTO
            {
                OACYID = o.OACYID,
                TransactionID = o.TransactionID,
                ReceiceFileID = o.ReceiceFileID,
                CreatedDate = o.CreatedDate,
                TransactionServiceProviderPropCode = o.TransactionServiceProviderPropCode,
                TransactionServiceProvider = o.TransactionServiceProvider,
                PostingDate = o.PostingDateTime,
                EffectiveGasDay = o.EffectiveGasDayTime,
                Loc = o.Loc,
                LocName = o.LocName,
                LocZn = o.LocZn,
                FlowIndicator = o.FlowIndicator,
                LocPropDesc = o.LocPropDesc,
                LocQTIDesc = o.LocQTIDesc,
                MeasurementBasis = o.MeasurementBasis,
                ITIndicator = o.ITIndicator,
                AllQtyAvailableIndicator = o.AllQtyAvailableIndicator,
                DesignCapacity = o.DesignCapacity,
                OperatingCapacity = o.OperatingCapacity,
                TotalScheduleQty = o.TotalScheduleQty,
                OperationallyAvailableQty = o.OperationallyAvailableQty,
                PipelineID = o.PipelineID,
                CycleIndicator = o.CycleIndicator,
                AvailablePercentage = o.AvailablePercentage
            }).ToList());
            //keyword = keyword.Trim();
            //  IQueryable<OACYPerTransaction> oacylist;
            //if (!string.IsNullOrEmpty(Cycle) && !string.IsNullOrEmpty(keyword) && pDate != DateTime.MinValue && eDate != DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.PostingDateTime) == pDate
            //    && DbFunctions.TruncateTime(a.EffectiveGasDayTime) == eDate
            //    && (((a.LocName ?? "").ToLower().Contains(keyword.ToLower())) || ((a.Loc ?? "").ToLower().Contains(keyword.ToLower())))
            //    && (((a.CycleIndicator ?? "").ToLower().Contains(Cycle.ToLower()))));
            //}
            //else if (string.IsNullOrEmpty(Cycle) && string.IsNullOrEmpty(keyword) && pDate == DateTime.MinValue && eDate == DateTime.MinValue)
            //{
            //    var count = dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns).Count();
            //    if (count > 0)
            //    {
            //        DateTime? recentdate = GetRecentPostDateUsngDuns(pipelineDuns);
            //        return GetByPostDateEffDate(pipelineDuns, recentdate, null, string.Empty, string.Empty);
            //    }
            //}
            //else if (!string.IsNullOrEmpty(Cycle) && !string.IsNullOrEmpty(keyword) && pDate != DateTime.MinValue && eDate == DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.PostingDateTime) == pDate
            //    && (((a.LocName ?? "").ToLower().Contains(keyword.ToLower())) || ((a.Loc ?? "").ToLower().Contains(keyword.ToLower())))
            //    && (((a.CycleIndicator ?? "").ToLower().Contains(Cycle.ToLower()))));
            //}
            //else if (string.IsNullOrEmpty(Cycle) && !string.IsNullOrEmpty(keyword) && pDate != DateTime.MinValue && eDate != DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.PostingDateTime) == pDate
            //    && DbFunctions.TruncateTime(a.EffectiveGasDayTime) == eDate
            //    && (((a.LocName ?? "").ToLower().Contains(keyword.ToLower())) || ((a.Loc ?? "").ToLower().Contains(keyword.ToLower()))));
            //}
            //else if (!string.IsNullOrEmpty(Cycle) && string.IsNullOrEmpty(keyword) && pDate != DateTime.MinValue && eDate != DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.PostingDateTime) == pDate
            //    && DbFunctions.TruncateTime(a.EffectiveGasDayTime) == eDate
            //    && (((a.CycleIndicator ?? "").ToLower().Contains(Cycle.ToLower()))));
            //}
            //else if (!string.IsNullOrEmpty(Cycle) && !string.IsNullOrEmpty(keyword) && pDate == DateTime.MinValue && eDate != DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.EffectiveGasDayTime) == eDate
            //    && (((a.LocName ?? "").ToLower().Contains(keyword.ToLower())) || ((a.Loc ?? "").ToLower().Contains(keyword.ToLower())))
            //    && (((a.CycleIndicator ?? "").ToLower().Contains(Cycle.ToLower()))));
            //}
            //else if (!string.IsNullOrEmpty(Cycle) && !string.IsNullOrEmpty(keyword) && pDate == DateTime.MinValue && eDate == DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && (((a.LocName ?? "").ToLower().Contains(keyword.ToLower())) || ((a.Loc ?? "").ToLower().Contains(keyword.ToLower())))
            //    && (((a.CycleIndicator ?? "").ToLower().Contains(Cycle.ToLower()))));
            //}
            //else if (!string.IsNullOrEmpty(Cycle) && string.IsNullOrEmpty(keyword) && pDate != DateTime.MinValue && eDate == DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.PostingDateTime) == pDate
            //    && (((a.CycleIndicator ?? "").ToLower().Contains(Cycle.ToLower()))));
            //}
            //else if (string.IsNullOrEmpty(Cycle) && !string.IsNullOrEmpty(keyword) && pDate == DateTime.MinValue && eDate != DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.EffectiveGasDayTime) == eDate
            //    && (((a.LocName ?? "").ToLower().Contains(keyword.ToLower())) || ((a.Loc ?? "").ToLower().Contains(keyword.ToLower()))));
            //}
            //else if (string.IsNullOrEmpty(Cycle) && string.IsNullOrEmpty(keyword) && pDate != DateTime.MinValue && eDate != DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.PostingDateTime) == pDate
            //    && DbFunctions.TruncateTime(a.EffectiveGasDayTime) == eDate);
            //}
            //else if (string.IsNullOrEmpty(Cycle) && !string.IsNullOrEmpty(keyword) && pDate != DateTime.MinValue && eDate == DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.PostingDateTime) == pDate
            //    && (((a.LocName ?? "").ToLower().Contains(keyword.ToLower())) || ((a.Loc ?? "").ToLower().Contains(keyword.ToLower()))));
            //}
            //else if (!string.IsNullOrEmpty(Cycle) && string.IsNullOrEmpty(keyword) && pDate == DateTime.MinValue && eDate == DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && (((a.CycleIndicator ?? "").ToLower().Contains(Cycle.ToLower()))));
            //}
            //else if (string.IsNullOrEmpty(Cycle) && !string.IsNullOrEmpty(keyword) && pDate == DateTime.MinValue && eDate == DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && (((a.LocName ?? "").ToLower().Contains(keyword.ToLower())) || ((a.Loc ?? "").ToLower().Contains(keyword.ToLower()))));
            //}
            //else if (string.IsNullOrEmpty(Cycle) && string.IsNullOrEmpty(keyword) && pDate != DateTime.MinValue && eDate == DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.PostingDateTime) == pDate);
            //}
            //else if (string.IsNullOrEmpty(Cycle) && string.IsNullOrEmpty(keyword) && pDate == DateTime.MinValue && eDate != DateTime.MinValue)
            //{
            //    return dbcontext.OACYPerTransactions.Where(a => a.TransactionServiceProvider == pipelineDuns
            //    && DbFunctions.TruncateTime(a.EffectiveGasDayTime) == eDate);
            //}

            //return new List<OACYPerTransaction>().AsQueryable();
        }
Exemplo n.º 4
0
 public ApplicationLogRepository()
 {
     DbContext = new UprdDbEntities1();
 }
Exemplo n.º 5
0
 public UprdSwntRepository()
 {
     dbcontext    = new UprdDbEntities1();
     modalFactory = new ModalFactory();
 }
Exemplo n.º 6
0
        public IHttpActionResult GetUnscByCriteria([FromBody] UnscDataFilter criteria)
        {
            var source = (dynamic)null;

            try
            {
                //SortingPagingInfo sortingPagingInfo = new SortingPagingInfo();
                //sortingPagingInfo.SortField = criteria.sort;
                //sortingPagingInfo.SortDirection = criteria.SortDirection;
                //sortingPagingInfo.PageSize = criteria.size;
                //sortingPagingInfo.CurrentPageIndex = criteria.page;

                //UprdUnscRepository uprdUnscRepository = new UprdUnscRepository();
                var             pTime = criteria.postTime.GetValueOrDefault().TimeOfDay;
                UprdDbEntities1 db    = new UprdDbEntities1();
                var             query = db.UnscPerTransactions.Where(a => a.TransactionServiceProvider == criteria.PipelineDuns).AsQueryable();
                if (!string.IsNullOrEmpty(criteria.keyword))
                {
                    query = query.Where(a => a.Loc.Contains(criteria.keyword) || a.LocName.Contains(criteria.keyword));
                }

                if (!string.IsNullOrEmpty(criteria.postStartDate.ToString()) && TimeSpan.MinValue != pTime)
                {
                    query = query.Where(a => DbFunctions.TruncateTime(a.PostingDateTime) == DbFunctions.TruncateTime(criteria.postStartDate) &&
                                        DbFunctions.CreateTime(a.PostingDateTime.Value.Hour, a.PostingDateTime.Value.Minute, a.PostingDateTime.Value.Second) >= pTime);
                }

                if (!string.IsNullOrEmpty(criteria.EffectiveStartDate.ToString()))
                {
                    query = query.Where(a => DbFunctions.TruncateTime(a.EffectiveGasDayTime) == DbFunctions.TruncateTime(criteria.EffectiveStartDate));
                }

                if (!string.IsNullOrEmpty(criteria.EffectiveEndDate.ToString()))
                {
                    query = query.Where(a => DbFunctions.TruncateTime(a.EndingEffectiveDay) == DbFunctions.TruncateTime(criteria.EffectiveEndDate));
                }

                var data = query.Select(a => new UnscPerTransactionDTO {
                    TransactionID = a.TransactionID,
                    //AvailablePercentage=
                    ChangePercentage = a.ChangePercentage,
                    CreatedDate      = a.CreatedDate,
                    DUNSNo           = a.TransactionServiceProvider,
                    EffectiveGasDay  = a.EffectiveGasDayTime,
                    //EffectiveGasDayTime=a.EffectiveGasDayTime,
                    EndingEffectiveDay = a.EndingEffectiveDay,
                    Loc           = a.Loc,
                    LocName       = a.LocName,
                    LocPurpDesc   = a.LocPurpDesc,
                    LocQTIDesc    = a.LocQTIDesc,
                    LocZn         = a.LocZn,
                    MeasBasisDesc = a.MeasBasisDesc,
                    PipelineID    = a.PipelineID,
                    //PipelineNameDuns=a.
                    PostingDate = a.PostingDateTime,
                    //PostingDateTime=a.PostingDateTime,
                    TotalDesignCapacity                = a.TotalDesignCapacity,
                    TransactionServiceProvider         = a.TransactionServiceProvider,
                    TransactionServiceProviderPropCode = a.TransactionServiceProviderPropCode,
                    UnsubscribeCapacity                = a.UnsubscribeCapacity
                }).ToList();
                UnscResultDTO result = new UnscResultDTO();
                result.unscPerTransactionDTO = (data != null && data.Count > 0) ? data : new List <UnscPerTransactionDTO>();
                result.RecordCount           = (data != null && data.Count > 0) ? data.Count : 0;
                source = result;
                //    if (!string.IsNullOrEmpty(criteria.PipelineDuns))
                //    {
                //        source = uprdUnscRepository.GetUnscListWithPaging(criteria.PipelineDuns, criteria.keyword, criteria.postStartDate, criteria.EffectiveStartDate, criteria.EffectiveEndDate, sortingPagingInfo);
                //    }
                //        int count = sortingPagingInfo.PageCount;
                //        int CurrentPage = sortingPagingInfo.CurrentPageIndex;
                //        int PageSize = sortingPagingInfo.PageSize;
                //        int TotalCount = count;

                //        int TotalPages = (int)Math.Ceiling(count / (double)PageSize);

                //        // if CurrentPage is greater than 1 means it has previousPage
                //        var previousPage = CurrentPage > 1 ? "Yes" : "No";

                //        // if TotalPages is greater than CurrentPage means it has nextPage
                //        var nextPage = CurrentPage < TotalPages ? "Yes" : "No";

                //        // Object which we are going to send in header
                //        var paginationMetadata = new
                //        {
                //            totalCount = TotalCount,
                //            pageSize = PageSize,
                //            currentPage = CurrentPage,
                //            totalPages = TotalPages,
                //            previousPage,
                //            nextPage
                //        };

                //        // Setting Header
                //        HttpContext.Current.Response.Headers.Add("Paging-Headers", JsonConvert.SerializeObject(paginationMetadata));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //if (source == null)
            //{
            //    var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
            //    {
            //        ReasonPhrase = "Records Not Found."
            //    };
            //    throw new HttpResponseException(resp);
            //}

            return(Ok(source));
        }
Exemplo n.º 7
0
 public UprdWatchListRepository()
 {
     DbContext = new UprdDbEntities1();
 }