public override void ExecuteOption(OptionReport report)
        {
            string urlLoginName = _databaseUpdateMailrelayFromContact.urlLoginName;
            int    pageSize     = _databaseUpdateMailrelayFromContact.pageSize;
            Guid?  contactId    = _databaseUpdateMailrelayFromContact.contactId;

            DatabaseUrlLogin      login = DatabaseUrlLogin.GetUrlLogin(Connection, urlLoginName);
            DynamicsCrmConnection dynamicsCrmConnection = DynamicsCrmConnection.GetConnection(login.Url, login.Username, login.Password);

            PagingInformation pagingInformation = new PagingInformation();

            List <MailrelayInformation> mailrelayInformations = new List <MailrelayInformation>();

            UpdateReport <int> intReport = new UpdateReport <int>();

            while (pagingInformation.FirstRun || pagingInformation.MoreRecords)
            {
                mailrelayInformations = MailrelayInformation.GetMailrelayFromContact(dynamicsCrmConnection, Config.GetResourcePath, pagingInformation, pageSize, contactId);
                mailrelayInformations.ForEach(information => UpdateIfNeeded(dynamicsCrmConnection, information, intReport));
            }

            Log.Write(Connection, intReport.AsLogText("UpdateMailrelayFromContact"), typeof(UpdateMailrelayFromContact), DataLayer.MongoData.Config.LogLevelEnum.OptionReport);

            report.Success = true;
            return;
        }
Пример #2
0
 public Task<PagingResult<Submission>> ListAsync(
     PagingInformation pagingInformation,
     CancellationToken cancellationToken = default(CancellationToken)
 )
 {
     return _submissionRepository.ListAsync(pagingInformation, cancellationToken);
 }
Пример #3
0
        /// <summary>
        /// This method will return table information that is only used in ICC Template
        /// </summary>
        /// <param name="recordsPerPage"></param>
        public static PagingInformation GetTableInformation(this IWebDriver webDriver, int recordsPerPage)
        {
            // tự thay thế mấy cái common text keywork vo mấy chỗ này
            if (webDriver.FindElement(By.CssSelector(".el-pagination")).GetCssValue("display") == "none")
            {
                return(new PagingInformation()
                {
                    RecordsPerPage = recordsPerPage,
                    TotalPages = 1,
                    TotalRecords = webDriver.ElementCount(By.CssSelector(".el-table tr.el-table__row"))
                });
            }
            else
            {
                var result = new PagingInformation()
                {
                    RecordsPerPage = recordsPerPage,
                    TotalRecords   = recordsPerPage,
                    TotalPages     = 1
                };

                while (webDriver.TryClickElement(By.CssSelector(".el-pagination button.btn-next")))
                {
                    webDriver.Wait(1000);
                    result.TotalPages   += 1;
                    result.TotalRecords += webDriver.ElementCount(By.CssSelector(".el-table tr.el-table__row"));
                }

                return(result);
            }
        }
        public override void ExecuteOption(OptionReport report)
        {
            string urlLoginName = _databaseExportContactToMailrelay.urlLoginName;

            Guid?crmListId = _databaseExportContactToMailrelay.listId;

            DatabaseUrlLogin      login = DatabaseUrlLogin.GetUrlLogin(Connection, urlLoginName);
            DynamicsCrmConnection dynamicsCrmConnection = DynamicsCrmConnection.GetConnection(login.Url, login.Username, login.Password);

            PagingInformation pagingInformation = new PagingInformation();

            while (pagingInformation.FirstRun || pagingInformation.MoreRecords)
            {
                MarketingList marketingList = MarketingList.GetListForMailrelayUpdate(dynamicsCrmConnection, pagingInformation, crmListId);

                if (marketingList != null)
                {
                    UpdateReport <Guid> result = ExportMailrelayContactFromList(dynamicsCrmConnection, marketingList);
                    Log.Write(Connection, result.AsLogText($"ExportContactToMailrelay {marketingList.new_mailrelaygroupid.Value}"), typeof(ExportContactToMailrelay), DataLayer.MongoData.Config.LogLevelEnum.OptionReport);
                }
            }

            report.Success = true;

            return;
        }
        public PagedResult <Package> GetPackagesByUserId(Guid userId, PagingInformation paging)
        {
            var query = _context.Set <Package>()
                        .Where((p) => p.UserId == userId);
            var paged = this.ApplyPaging(query, paging);

            return(paged);
        }
Пример #6
0
 public async Task <PagingResult <SerialNumber> > ListAsync(
     PagingInformation pagingInformation,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var ctx = _contextFactory.CreateReadOnly())
     {
         return(await ctx.ValidSerialNumbers.ToPagingResultAsync(pagingInformation, cancellationToken));
     }
 }
Пример #7
0
        public void GetListForMailrelayUpdateOnlyReturnsListThatShouldBeImported()
        {
            PagingInformation pagingInformation = new PagingInformation();

            while (pagingInformation.FirstRun || pagingInformation.MoreRecords)
            {
                MarketingList marketingList = MarketingList.GetListForMailrelayUpdate(_connection, pagingInformation, null);

                if (marketingList != null)
                {
                    Console.Out.WriteLine($" {marketingList.Id} {marketingList.new_controlmailrelaygroup} - {marketingList.new_mailrelaygroupid} - {marketingList.new_mailrelaycheck}");
                }
            }
        }
        public async Task <IActionResult> GetPaged([FromQuery] ApiV1ProductPagingSortingFilteringRequestModel model)
        {
            logger.LogDebug($"Attempting to get paged products: Page: {model.Page}, items per page: {model.ItemsPerPage}.");

            if (ModelState.IsValid)
            {
                // Check if the requested language exists
                if (!i18nService.SupportedLanguages.Any(x => x.Code == model.LanguageCode))
                {
                    return(BadRequest(new ApiV1ErrorResponseModel("The requested language does not exist.")));
                }

                var pagingSortingOptions = new PagingSortingParams
                {
                    ItemsPerPage  = model.ItemsPerPage,
                    Page          = model.Page,
                    SortBy        = model.SortBy,
                    SortDirection = model.SortDirection
                };

                var filterOptions = new FilterParams
                {
                    FilterBy       = model.FilterBy,
                    FilterQuery    = model.FilterQuery,
                    FilterLanguage = model.LanguageCode
                };

                var productPagingInformation = await productService.GetPagedAsync(pagingSortingOptions, filterOptions, model.FilterByCategory);

                var productPagingInformationResponse = new PagingInformation <ApiV1ProductReponseModel>
                {
                    CurrentPage  = productPagingInformation.CurrentPage,
                    Items        = productPagingInformation.Items.Select(x => x.ToApiV1ProductResponseModel()).ToList(),
                    ItemsPerPage = productPagingInformation.ItemsPerPage,
                    PageCount    = productPagingInformation.PageCount,
                    TotalItems   = productPagingInformation.TotalItems
                };

                logger.LogInformation(
                    $"Received {productPagingInformationResponse.Items.Count} products from the database.");

                return(Json(productPagingInformationResponse));
            }
            else
            {
                logger.LogWarning($"Error while performing paged request. Validation failed.");
                return(BadRequest(ModelState.ToApiV1ErrorResponseModel()));
            }
        }
Пример #9
0
        public async Task List_Returns_paging_result(
            [Frozen] Mock <ISubmissionService> submissionServiceMock,
            SubmissionController sut,
            PagingInformation pagingInformation,
            PagingResult <Submission> submissions)
        {
            submissionServiceMock
            .Setup(x => x.ListAsync(pagingInformation, CancellationToken.None))
            .Returns(Task.FromResult(submissions));

            var response = await sut.List(pagingInformation, CancellationToken.None);

            Assert.IsInstanceOf <ViewResult>(response);

            submissionServiceMock.VerifyAll();
        }
Пример #10
0
        public void GetMailrelayFromContactCanReturnInformation()
        {
            PagingInformation pagingInformation = new PagingInformation();

            int subscriberId = new Random().Next(1, int.MaxValue);

            Contact contact = CreateTestContact();

            contact.new_mailrelaysubscriberid = subscriberId;
            contact.InsertWithoutRead();

            List <MailrelayInformation> informations = MailrelayInformation.GetMailrelayFromContact(_dynamicsCrmConnection, _config.GetResourcePath, pagingInformation, 1, contact.Id);

            contact.Delete();

            Assert.AreEqual(1, informations.Count);
        }
Пример #11
0
        public static MvcHtmlString PageLinks(this HtmlHelper html, PagingInformation pagingInfo,
                                              Func <int, string> pageUrl)
        {
            var sb = new StringBuilder();

            for (var i = 1; i <= pagingInfo.TotalPages; i++)
            {
                var tag = new TagBuilder("a");
                tag.MergeAttribute("href", pageUrl(i));
                tag.InnerHtml = i.ToString(CultureInfo.InvariantCulture);
                if (i == pagingInfo.CurrentPage)
                {
                    tag.AddCssClass("selected");
                }
                sb.AppendLine(tag.ToString());
            }
            return(MvcHtmlString.Create(sb.ToString()));
        }
Пример #12
0
        public static async Task <PagingResult <T> > ToPagingResultAsync <T>(
            this IQueryable <T> source,
            PagingInformation pagingInformation,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var countTask = source.CountAsync(cancellationToken);
            var listTask  = source.Skip(pagingInformation.PageSize * (pagingInformation.PageNumber - 1))
                            .Take(pagingInformation.PageSize).ToListAsync(cancellationToken);

            await Task.WhenAll(countTask, listTask);

            return(new PagingResult <T>()
            {
                Hits = listTask.Result,
                TotalHits = countTask.Result,
                PagingInformation = pagingInformation
            });
        }
Пример #13
0
        public void GetIndsamlingsSted()
        {
            Materiale materiale  = Materiale.ReadCalculationNeed(_dynamicsCrmConnection, _config.GetResourcePath);
            Guid      businessId = materiale.owningbusinessunitGuid.Value;

            PagingInformation pagingInformation = new PagingInformation();

            int lastAccountCount = -1;
            int total            = 0;

            while (lastAccountCount != 0)
            {
                List <Account> accounts = Account.GetIndsamlingsSted(_dynamicsCrmConnection, 15, businessId, _config.GetResourcePath, pagingInformation);
                lastAccountCount = accounts.Count;
                total           += lastAccountCount;
                accounts.ForEach(account => Console.Out.WriteLine(account.Id));
                //Console.Out.Write($" {lastAccountCount} ");
            }
            Console.Out.WriteLine("-------");
            Console.Out.WriteLine(total);
        }
Пример #14
0
        public ActionResult Index(PagingInformation paging, string request_ids = null)
        {
            var me = FacebookService.GetMe();

            if (!String.IsNullOrEmpty(request_ids))
            {
                FacebookService.MarkRequestsConsumed(request_ids);
            }

            var complaints   = _complaintService.PagedGetAll(paging);
            var pagedResults = GetPagedComplaintList(complaints);

            var model = new IndexViewModel()
            {
                Me         = me,
                Complaints = pagedResults,
                TagListUrl = Url.Action("Index", "Tag"),
                Title      = "Recent Complaints"
            };

            return(View(model));
        }
Пример #15
0
        public static MvcHtmlString PageLinks(this HtmlHelper html,
                                              PagingInformation pagingInfo)
        {
            StringBuilder result = new StringBuilder();

            for (int i = 1; i <= pagingInfo.GetTotalPages(); i++)
            {
                TagBuilder tag = new TagBuilder("input");
                tag.MergeAttribute("type", "submit");
                tag.MergeAttribute("value", i.ToString());
                tag.MergeAttribute("name", "pageNumber");
                tag.InnerHtml = i.ToString();
                if (i == pagingInfo.CurrentPage)
                {
                    tag.AddCssClass("selected");
                    tag.AddCssClass("btn-primary");
                }
                tag.AddCssClass("btn btn-default");
                result.Append(tag.ToString());
            }
            return(MvcHtmlString.Create(result.ToString()));
        }
Пример #16
0
        public ActionResult Tag(Guid id, PagingInformation pagingInformation)
        {
            var tag = _tagService.Get(id);

            if (tag == null)
            {
                return(this.CanvasRedirectToAction("Index"));
            }

            var me           = FacebookService.GetMe();
            var complaints   = _complaintService.GetComplaintsByTag(pagingInformation, id);
            var pagedResults = GetPagedComplaintList(complaints);

            var model = new IndexViewModel()
            {
                Me         = me,
                Complaints = pagedResults,
                TagListUrl = Url.Action("Index", "Tag"),
                Title      = String.Format("Complaints By Tag: {0}", tag.Name)
            };

            return(View("Index", model));
        }
Пример #17
0
        public ActionResult Friend(long id, PagingInformation pagingInformation)
        {
            var user = _userService.FindByFacebookId(id);

            if (user == null)
            {
                return(this.CanvasRedirectToAction("Index"));
            }

            var me           = FacebookService.GetMe();
            var complaints   = _complaintService.GetComplaintsByFacebookId(pagingInformation, id);
            var pagedResults = GetPagedComplaintList(complaints);

            var model = new IndexViewModel()
            {
                Me         = me,
                Complaints = pagedResults,
                TagListUrl = Url.Action("Index", "Tag"),
                Title      = String.Format("Complaints By: {0}", user.Name)
            };

            return(View("Index", model));
        }
Пример #18
0
        public static MvcHtmlString PageLinks(this HtmlHelper html, PagingInformation pagingInfo,
                                              Func <int, string> pageUrl)
        {
            var sb = new StringBuilder();

            for (var i = 1; i <= pagingInfo.TotalPages; i++)
            {
                var anchor = new TagBuilder("a");
                anchor.MergeAttribute("href", pageUrl(i));
                anchor.InnerHtml = i.ToString(CultureInfo.InvariantCulture);

                var item = new TagBuilder("li")
                {
                    InnerHtml = anchor.ToString()
                };
                if (i == pagingInfo.CurrentPage)
                {
                    item.MergeAttribute("class", "active");
                }

                sb.AppendLine(item.ToString());
            }
            return(MvcHtmlString.Create(sb.ToString()));
        }
 public GetAllPackagesQuery(PagingInformation paging)
 {
     this.Paging = paging;
 }
Пример #20
0
        public byte[] GenerateRoomTypeExcelBySearchCriteria(RoomTypeSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)
        {
            //For excel export, we need to export all records.
            //So set the pageindex and pagesize to -1
            pageInfo.StartIndex = -1;
            pageInfo.PageSize   = -1;

            var list = getRoomTypeBySearchCriteria(searchCriteria, pageInfo);

            //Get excel export list
            var excelList = mapper.Map <IList <RoomTypeExportExcelModel> >(list);

            return(excelList.ToExcelContent());
        }
Пример #21
0
        //public IList<RoomTypeSearchResultDTO> getRoomTypeBySearchCriteria(RoomTypeSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)
        //{
        //    IList<string> hotelCodeList = userAccountService.GetUserMappedHotelCodes(searchCriteria.UserName);
        //    if (hotelCodeList != null && hotelCodeList.Any())
        //    {
        //        List<RoomType_Code> roomtypeList = (from grtc in roomtypeRepo.GetAll()
        //                                            where hotelCodeList.Contains(grtc.Hotel_Code)
        //                                            select grtc).ToList();

        //        //Hotel Name
        //        if (!string.IsNullOrWhiteSpace(searchCriteria.HotelName))
        //        {
        //            roomtypeList = roomtypeList.Where(p => p.Hotel_Code == searchCriteria.HotelName).ToList();
        //        }

        //        pageInfo.RecordsTotal = roomtypeList.Count();

        //        //Setup Order, the order that passed in like "columnname asc, columnname desc"
        //        //if (pageInfo.OrderColumn.Contains("UpgradeType"))
        //        //{
        //        //    pageInfo.OrderColumn = pageInfo.OrderColumn.Replace("UpgradeType", "AddOnYn");
        //        //}

        //        if (!string.IsNullOrWhiteSpace(pageInfo.OrderColumn))
        //        {
        //            string orderString = pageInfo.OrderColumn.TrimEnd(',');
        //            roomtypeList = roomtypeList.AsQueryable().OrderBy(orderString).ToList();
        //        }
        //        else
        //        {
        //            roomtypeList = roomtypeList.AsQueryable().OrderByDescending(p => p.id).ToList();
        //        }
        //        //var ordercolumns = query.OrderBy(p)

        //        //Setup paging
        //        if (pageInfo.PageSize == -1 && pageInfo.StartIndex == -1)
        //        {

        //        }
        //        else
        //        {
        //            roomtypeList = roomtypeList.AsQueryable().Skip(pageInfo.StartIndex).Take(pageInfo.PageSize).ToList();
        //        }
        //        //Get column that we need
        //        var list = roomtypeList.AsQueryable().Select(x => new RoomTypeSearchResultDTO()
        //        {
        //            id = x.id,
        //            Hotel_Code = x.Hotel_Code,
        //            RoomCode = x.RoomCode,
        //            RoomDescription = x.RoomDescription,
        //            RoomLongDescription = x.RoomLongDescription,
        //            PriceDesc = x.PriceDesc,
        //            PerNightCharge = x.PerNightCharge,
        //            IsActive = x.IsActive,
        //            AddOnYN = x.AddOnYN,
        //            ImageYN = x.ImageYN,
        //            UpgradeType = x.AddOnYN=="Y"? "Add-on": "Room",
        //        }).ToList();

        //        return list;
        //    }
        //    else
        //        return null;
        //}

        public IList <RoomTypeSearchResultDTO> getRoomTypeBySearchCriteria(RoomTypeSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)
        {
            IList <RoomTypeSearchResultDTO> list = roomtypeRepo.GetRateTypeBySearchCriteria(searchCriteria, pageInfo);

            var query = list.AsEnumerable();

            //Get all rateTypes
            pageInfo.RecordsTotal = query.Count();

            if (!string.IsNullOrWhiteSpace(pageInfo.OrderColumn))
            {
                var orderString = pageInfo.OrderColumn.TrimEnd(',');
                query = query.OrderBy(orderString);
            }
            else
            {
                query = query.OrderByDescending(p => p.id);
            }

            //Setup paging
            if (pageInfo.PageSize == -1 && pageInfo.StartIndex == -1)
            {
            }
            else
            {
                query = query.Skip(pageInfo.StartIndex).Take(pageInfo.PageSize);
            }

            return(query.ToList());
        }
Пример #22
0
        public IList <ReportSearchResultDTO> GetReportBySearchCriteria(ReportSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)
        {
            List <ReportSearchResultDTO> list = new List <ReportSearchResultDTO>();

            try
            {
                string query = @"select HotelCode = e.HotelCode,
        GuestName = f.FName + ' ' + f.LName,
       ArrivalDate =  f.ArrivalDate,
       FirstName = f.FName,
       LastName = f.LName,
       Email = f.Email,
       UpgradeCost = e.UpgradeCost,
       BookedRoomType = e.BookedRoomType,
       UpgradeRoomType = e.UpgradeRoomType,
       UpgradeStatus = e.UpgradeStatus,
       ConfirmedDate = e.InsertDate,
       NightsOfStay = isnull(f.NightsOfStay,0),
       --ReservationID = f.ConfirmationNum,
       ReservationID = case when (h.CentralResNumYN = 1 and isNull(f.CentralResNum, '') <> '' and f.CentralResNum !='''') then f.CentralResNum else f.ConfirmationNum end,
       ChargePerNight = rt.PerNightCharge,
       IncTotalAmountForStay = case when rt.PerNightCharge='Y' then e.UpgradeCost * isnull(f.NightsOfStay,0) else e.UpgradeCost end,
       DateFormat = h.DateFormat,
       CurrencySymbol = lc.Symbol
--select *
from eUpgradeRequest e with (nolock)
inner join hotels h with (nolock) on e.HotelCode=h.Hotel_Code
inner join Hotels_Languages hl with (nolock) on h.Hotel_Code = hl.Hotel_Code
inner join dbo.L_Currency lc with (nolock) on hl.CurrencyCode = lc.Code
--inner join CurrencyConvert c with (nolock) on h.Hotel_Code = c.Hotel_Code and h.LocalCurrencyCode = c.Code
inner join Fguest f with (nolock) on e.loginConfirmationNum=f.LoginConfirmationNum 
inner join RoomType_Code rt with (nolock) on e.HotelCode = rt.Hotel_Code and e.UpgradeRoomType = rt.RoomCode
where hl.LanguageID=1
-- 1=1
-- and e.id = (select max(id) from eUpgradeRequest e2 with (nolock) 
--  where e.loginConfirmationNum=e2.loginConfirmationNum and e.HotelCode=e2.HotelCode 
--    and e.BookedRoomType=e2.BookedRoomType and e.UpgradeRoomType=e2.UpgradeRoomType)
";

                var subquery = "";

                //Hotel Name
                if (!string.IsNullOrWhiteSpace(searchCriteria.HotelName))
                {
                    subquery += string.Format("e.HotelCode = '{0}' and ", searchCriteria.HotelName);
                }
                else
                {
                    //Based on user hotel mapping to get back hotel list, then only show those hotels
                    subquery += string.Format(@"exists (select HotelCode from ConciergeHotelAccessMapping hm with (nolock)
	Where hm.ActiveYN = 1 and hm.HotelCode = e.HOTELCODE and hm.ConciergeID = N'{0}') and "    , searchCriteria.UserName);
                }


                //Email
                if (!string.IsNullOrWhiteSpace(searchCriteria.Email))
                {
                    subquery += string.Format("f.Email like '%{0}%' and ", searchCriteria.Email);
                }

                //First Name
                if (!string.IsNullOrWhiteSpace(searchCriteria.FirstName))
                {
                    subquery += string.Format("f.FName like N'%{0}%' and ", searchCriteria.FirstName.Replace("'", "''"));
                }
                //Last Name
                if (!string.IsNullOrWhiteSpace(searchCriteria.LastName))
                {
                    subquery += string.Format("f.LName like N'%{0}%' and ", searchCriteria.LastName.Replace("'", "''"));
                }

                //Booked Room Type
                if (!string.IsNullOrWhiteSpace(searchCriteria.BookedRoomType))
                {
                    subquery += string.Format("e.BookedRoomType = '{0}' and ", searchCriteria.BookedRoomType);
                }
                //Request Status
                if (!string.IsNullOrWhiteSpace(searchCriteria.ReportUpgradeStatus))
                {
                    subquery += string.Format("e.UpgradeStatus = '{0}' and ", searchCriteria.ReportUpgradeStatus);
                }

                //Confirmed Date
                if (searchCriteria.ConfirmedDate != null)
                {
                    var startDate = searchCriteria.ConfirmedDate.Value.Date;
                    var endDate   = searchCriteria.ConfirmedDate.Value.Date.AddDays(1);
                    subquery += string.Format("e.InsertDate >= '{0}' and e.InsertDate < '{1}' and ", startDate.ToString("MM/dd/yyyy"), endDate.ToString("MM/dd/yyyy"));
                }

                //Arrival Date From
                if (searchCriteria.ArrivalDateFrom != null)
                {
                    var date = searchCriteria.ArrivalDateFrom.Value.Date;
                    subquery += string.Format("f.ArrivalDate >= '{0}' and ", date.ToString("MM/dd/yyyy"));
                }

                //Arrival Date To
                if (searchCriteria.ArrivalDateTo != null)
                {
                    var date = searchCriteria.ArrivalDateTo.Value.Date.AddDays(1);
                    subquery += string.Format("f.ArrivalDate < '{0}' and ", date.ToString("MM/dd/yyyy"));
                }

                if (!string.IsNullOrEmpty(subquery))
                {
                    subquery = subquery.Substring(0, subquery.Length - " and ".Length);
                    query   += " and (" + subquery + ")";
                }
                list = this.DataContext.Database.SqlQuery <ReportSearchResultDTO>(query).ToList();
            }
            catch (Exception ex)
            {
                var error = ex.Message;
            }
            return(list);
        }
Пример #23
0
        public ObjectInstanceList GetSubFoldersItems(ObjectDefinition objdefinition, PagingInformation paginginfo, string folderserverrelativeurl, string connectionname)
        {
            Log.WriteVerbose(string.Format(BeginLogMessage, CLASS_NAME, "GetSubFoldersItems(ObjectDefinition objdefinition, PagingInformation paginginfo, string folderserverrelativeurl, string connectionname)"));
            ObjectInstanceList rtnval = null;
            rtnval = (ObjectInstanceList)HttpContext.Current.Cache[GetCacheKey(objdefinition.Id, connectionname) + "," + paginginfo.CurrentPage + "," + folderserverrelativeurl];

            if (rtnval == null)
            {
                lock (_cacheobject)
                {
                    ObjectInstanceCriteriaFilter criteriafilter = new ObjectInstanceCriteriaFilter(objdefinition);
                    criteriafilter.Condition = LogicalOperator.And;
                    criteriafilter.AddFilter("FSObjType", ObjectInstanceCriteriaFilterOperator.EqualTo, 0);
                    criteriafilter.AddFilter("FileDirRef", ObjectInstanceCriteriaFilterOperator.EqualTo, folderserverrelativeurl);
                    criteriafilter.Paging = paginginfo;
                    rtnval = ContextBusClient.GetObjectInstanceList(objdefinition, criteriafilter, AdapterName);
                    HttpContext.Current.Cache.Add(GetCacheKey(objdefinition.Id, connectionname) + "," + paginginfo.CurrentPage + "," + folderserverrelativeurl, rtnval, null, CacheExpirationDateTime, Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
                }
            }
            Log.WriteVerbose(string.Format(FinishLogMessage, CLASS_NAME, "GetSubFoldersItems(ObjectDefinition objdefinition, PagingInformation paginginfo, string folderserverrelativeurl, string connectionname)"));
            return rtnval;
        }
Пример #24
0
        public byte[] GenerateReportExcelBySearchCriteria(ReportSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)//, string DateFormatForALL)
        {
            pageInfo.StartIndex = 0;
            pageInfo.PageSize   = Int16.MaxValue;
            var list = GetReportBySearchCriteria(searchCriteria, pageInfo);//, DateFormatForALL);
            //Get excel export list
            var excelList = mapper.Map <IList <ReportExportExcelModel> >(list);

            return(excelList.ToExcelContent());
        }
Пример #25
0
        /// <summary>
        ///     Get Spaces with specific parameters, see <a href="https://docs.atlassian.com/confluence/REST/latest/#d3e164">here</a>
        /// </summary>
        /// <param name="confluenceClient">ISpaceDomain to bind the extension method to</param>
        /// <param name="spaceKeys">IEnumerable of string with space keys</param>
        /// <param name="type">string filter the list of spaces returned by type (global, personal)</param>
        /// <param name="status">string filter the list of spaces returned by status (current, archived)</param>
        /// <param name="label">string filter the list of spaces returned by label</param>
        /// <param name="favourite">bool filter the list of spaces returned by favorites</param>
        /// <param name="pagingInformation">PagingInformation</param>
        /// <param name="cancellationToken">CancellationToken</param>
        /// <returns>List of Spaces</returns>
        public static async Task <IList <Space> > GetAllWithParametersAsync(this ISpaceDomain confluenceClient, IEnumerable <string> spaceKeys = null, string type = null, string status = null, string label = null, bool?favourite = null, PagingInformation pagingInformation = null, CancellationToken cancellationToken = default)
        {
            confluenceClient.Behaviour.MakeCurrent();
            var spacesUri = confluenceClient.ConfluenceApiUri.AppendSegments("space");

            foreach (var spaceKey in spaceKeys ?? Enumerable.Empty <string>())
            {
                spacesUri = spacesUri.ExtendQuery("spaceKey", spaceKey);
            }

            if (!string.IsNullOrEmpty(type))
            {
                spacesUri = spacesUri.ExtendQuery("type", type);
            }
            if (!string.IsNullOrEmpty(status))
            {
                spacesUri = spacesUri.ExtendQuery("status", status);
            }
            if (!string.IsNullOrEmpty(label))
            {
                spacesUri = spacesUri.ExtendQuery("label", label);
            }
            if (favourite.HasValue)
            {
                spacesUri = spacesUri.ExtendQuery("favourite", favourite);
            }
            var expand = string.Join(",", ConfluenceClientConfig.ExpandGetSpace ?? Enumerable.Empty <string>());

            if (!string.IsNullOrEmpty(expand))
            {
                spacesUri = spacesUri.ExtendQuery("expand", expand);
            }
            if (pagingInformation?.Start != null)
            {
                spacesUri = spacesUri.ExtendQuery("start", pagingInformation.Start.Value);
            }
            if (pagingInformation?.Limit != null)
            {
                spacesUri = spacesUri.ExtendQuery("limit", pagingInformation.Limit.Value);
            }

            var response = await spacesUri.GetAsAsync <HttpResponse <Result <Space>, Error> >(cancellationToken).ConfigureAwait(false);

            return(response.HandleErrors()?.Results);
        }
        public IList <RequestSearchResultDTO> GetRequestsBySearchCriteria(RequestSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)
        {
            List <RequestSearchResultDTO> list = new List <RequestSearchResultDTO>();

            try
            {
                string query = @"select HotelCode = r.HOTEL_CODE,
       CheckInventoryYN = Convert(bit, case when (isNull(h.CenResServiceInterface, '') <> '' and isNull(h.CenResServiceUrl, '') <> '') then 1 else 0 end), 
       AutoRequestProcessYN = h.AutoRequestProcessYN,
       AutoConfirmEmailYN = h.AutoConfirmEmailYN,
       ArrivalDate = r.ArrivalDate,
       BookedRoomTypeCode = pe.RoomTypeCodeBooked,
       LastModifiedDate= gpr.LastModifiedDate,
       DateSubmitted = gpr.CreatedDate,
       Email = r.Email,
       FirstName = r.FName,
       LastName = r.LName,
       VIPCode = r.VIPCode,
       MembershipID = r.MembershipID,
       DepartureDate = r.DepartureDate,
       NumberOfNights = r.NightsOfStay,
       RequestID = gpr.ID,
       RequestStatus = gpr.Status,
       SendEmailYN = gpr.ShowItinerary,
       Reservation = case when (h.CentralResNumYN = 1 and isNull(r.CentralResNum, '') <> '' and r.CentralResNum !='''') then r.CentralResNum else r.ConfirmationNum end,
       UpgradeCost = gpr.USDPrice,
       UpgradeRoomTypeCode = pe.RoomTypeCodeUpgrade,
       ConfirmStatus = gpr.ConfirmStatus,
       ShowSendEmail = Convert(bit,case when (select count(1) from GuestPlanner with (nolock) where LoginConfirmationNum = gpr.LoginConfirmationNum and ConfirmStatus = 0) > 0 then 0 else 1 end),
       TotalRooms = rc.TotalRoom,
       Threshold = rc.Threshold,
       LastEmailSentDate = gpr.LastConfirmEmailSentDate,
       ChargePerNight = rc.PerNightCharge,
       IncTotalAmountForStay = case when rc.PerNightCharge = 'Y' then gpr.USDPrice * isnull(r.NightsOfStay,0) else gpr.USDPrice end,
       Committed = 0,
       LifetimeSpend = 0,
       DateFormat = h.DateFormat,
       /*
       CurrencySymbol = c.Symbol,
       */
       CurrencySymbol =  lc.Symbol,
       PreviousRequests = (select count(1) from GuestPlanner g with (nolock) 
							where g.Event=gpr.Event
							and exists (
							select * from FGuest f1 with (nolock)
							where exists (
								select * from FGuest f2 with (nolock) 
								where f1.LoginConfirmationNum = f2.LoginConfirmationNum and f2.LoginConfirmationNum=gpr.LoginConfirmationNum)
							and g.LoginConfirmationNum =f1.LoginConfirmationNum and g.Hotel_Code=f1.HOTEL_CODE )),
	   ConfirmedRequests = (select sum(Convert(int,ConfirmStatus)) from GuestPlanner g with (nolock) 
							where g.Event=gpr.Event 
							and exists (
							select * from FGuest f1 with (nolock)
							where exists (
								select * from FGuest f2 with (nolock) 
								where f1.LoginConfirmationNum = f2.LoginConfirmationNum and f2.LoginConfirmationNum=gpr.LoginConfirmationNum)
							and g.LoginConfirmationNum =f1.LoginConfirmationNum and g.Hotel_Code=f1.HOTEL_CODE ))
--select * 
from GuestPlanner gpr with (nolock)
inner join Hotels h with (nolock) on gpr.Hotel_Code = h.Hotel_Code
inner join Hotels_Languages hl with (nolock) on h.Hotel_Code = hl.Hotel_Code
inner join dbo.L_Currency lc with (nolock) on hl.CurrencyCode = lc.Code
/*
inner join CurrencyConvert c with (nolock) on h.Hotel_Code = c.Hotel_Code and h.LocalCurrencyCode = c.Code
*/
inner join FGuest r with (nolock) on gpr.LoginConfirmationNum = r.LoginConfirmationNum
inner join PlannerEvent pe with (nolock) on gpr.DescID = pe.ID
inner join RoomType_Code rc with (nolock) on pe.Hotel_Code = rc.Hotel_Code and pe.RoomTypeCodeUpgrade = rc.RoomCode and rc.LanguageID=1
where gpr.Event='RoomUpgrade' and hl.LanguageID=1";

                var subquery = "";
                //if (searchCriteria.HotelName)
                //{

                //}
                //Hotel Name
                //Get all requests based on seach criteria, and map returned DTO to a view model

                if (!string.IsNullOrWhiteSpace(searchCriteria.HotelName))
                {
                    subquery += string.Format("h.Hotel_Code = '{0}' and ", searchCriteria.HotelName);
                }
                else
                {
                    //Based on user hotel mapping to get back hotel list, then only show those hotels
                    subquery += string.Format(@"exists (select HotelCode from ConciergeHotelAccessMapping hm with (nolock)
	Where hm.ActiveYN = 1 and hm.HotelCode = r.HOTEL_CODE and hm.ConciergeID = N'{0}') and "    , searchCriteria.UserName);
                }

                //DateRequest
                if (searchCriteria.DateRequested != null)
                {
                    var startDate = searchCriteria.DateRequested.Value.Date;
                    var endDate   = searchCriteria.DateRequested.Value.Date.AddDays(1);
                    subquery += string.Format("gpr.CreatedDate >= '{0}' and gpr.CreatedDate < '{1}' and ", startDate.ToString("MM/dd/yyyy"), endDate.ToString("MM/dd/yyyy"));
                }

                //Arrival Date From
                if (searchCriteria.ArrivalDateFrom != null)
                {
                    var date = searchCriteria.ArrivalDateFrom.Value.Date;
                    subquery += string.Format("r.ArrivalDate >= '{0}' and ", date.ToString("MM/dd/yyyy"));
                }

                //Arrival Date To
                if (searchCriteria.ArrivalDateTo != null)
                {
                    var date = searchCriteria.ArrivalDateTo.Value.Date.AddDays(1);
                    subquery += string.Format("r.ArrivalDate < '{0}' and ", date.ToString("MM/dd/yyyy"));
                }

                //FirstName
                if (!string.IsNullOrWhiteSpace(searchCriteria.FirstName))
                {
                    subquery += string.Format("r.FName like N'%{0}%' and ", searchCriteria.FirstName.Replace("'", "''"));
                }

                //Last name
                if (!string.IsNullOrWhiteSpace(searchCriteria.LastName))
                {
                    subquery += string.Format("r.LName like N'%{0}%' and ", searchCriteria.LastName.Replace("'", "''"));
                }

                //Booked RoomType
                if (!string.IsNullOrWhiteSpace(searchCriteria.BookedRoomType))
                {
                    subquery += string.Format("r.RoomType = '{0}' and ", searchCriteria.BookedRoomType);
                }

                //Request Status
                if (!string.IsNullOrWhiteSpace(searchCriteria.RequestStatus))
                {
                    if (searchCriteria.RequestStatus.Equals("Lapsed"))
                    {
                        subquery += string.Format("gpr.Status = '{0}' and ", "Requested");
                        subquery += string.Format("r.ArrivalDate < '{0}' and ", DateTime.Today.ToString("MM/dd/yyyy"));
                    }
                    else if (searchCriteria.RequestStatus.Equals("Requested"))
                    {
                        subquery += string.Format("gpr.Status = '{0}' and ", searchCriteria.RequestStatus);
                        subquery += string.Format("r.ArrivalDate >= '{0}' and ", DateTime.Today.ToString("MM/dd/yyyy"));
                    }
                    else
                    {
                        subquery += string.Format("gpr.Status = '{0}' and ", searchCriteria.RequestStatus);
                    }
                }

                //Email
                if (!string.IsNullOrWhiteSpace(searchCriteria.Email))
                {
                    subquery += string.Format("r.Email like N'%{0}%' and ", searchCriteria.Email);
                }

                if (!string.IsNullOrEmpty(subquery))
                {
                    subquery = subquery.Substring(0, subquery.Length - " and ".Length);
                    query   += " and (" + subquery + ")";
                }
                list = this.DataContext.Database.SqlQuery <RequestSearchResultDTO>(query).ToList();
            }
            catch (Exception ex)
            {
                var error = ex.Message;
            }
            return(list);
        }
Пример #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PagedList{T}"/> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.
 /// </summary>
 /// <param name="collection">The collection whose elements are copied to the new list.</param>
 /// <param name="paging">Information about the current page of information contained in the list.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="collection"/> is null.</exception>
 public PagedList(IEnumerable <T> collection, PagingInformation paging) : base(collection)
 {
     Paging = paging;
 }
Пример #28
0
        // GET
        public async Task <IActionResult> List(PagingInformation pagingInformation, CancellationToken cancellationToken)
        {
            var model = await _submissionService.ListAsync(pagingInformation, cancellationToken);

            return(View(MaoToViewModel(model)));
        }
Пример #29
0
        /// <summary>
        /// Get all requests based on search criteria
        /// </summary>
        /// <param name="searchCriteria"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public IList <ReportSearchResultDTO> GetReportBySearchCriteria(ReportSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)//, string DateFormatForALL)
        {
            IList <ReportSearchResultDTO> list = eUpgradeRepo.GetReportBySearchCriteria(searchCriteria, pageInfo);

            pageInfo.RecordsTotal = list.Count();

            //Setup Order, the order that passed in like "columnname asc, columnname desc"
            var query = list.AsEnumerable();

            if (!string.IsNullOrWhiteSpace(pageInfo.OrderColumn))
            {
                var orderString = TransformOrder(pageInfo.OrderColumn);
                query = query.OrderBy(orderString);
            }
            else
            {
                //query = query.OrderByDescending(p => p.ConfirmedDate);
                query = query.OrderByDescending(p => p.ConfirmedDate).OrderBy(p => p.HotelCode);
            }

            //Setup paging
            query = query.Skip(pageInfo.StartIndex).Take(pageInfo.PageSize);

            list = query.ToList();
            //if (string.IsNullOrEmpty(searchCriteria.HotelName) && !string.IsNullOrEmpty(DateFormatForALL))
            //{
            //    foreach (var it in list)
            //    {
            //        it.DateFormat = DateFormatForALL.ToLower().Replace("m", "M");
            //    }
            //}
            return(list);
        }
        public IList <UserSearchResultDTO> getUserBySearchCriteria(UserSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)
        {
            var query = from cl in conciergeLoginRepo.GetAll()
                        join h in hotelRepo.GetAll() on cl.HOTEL_CODE equals h.Hotel_Code
                        //select new { cl };
                        select new UserSearchResultDTO()
            {
                id          = cl.ID,
                HotelCode   = cl.HOTEL_CODE,
                ConciergeID = cl.ConciergeID,
                FName       = cl.FName,
                LName       = cl.LName,
                Phone       = cl.Phone,
                IsActive    = cl.Active,
                AccessLevel = cl.AccessLevel,
                DateFormat  = h.DateFormat,
            };

            //Hotel Name
            if (!string.IsNullOrWhiteSpace(searchCriteria.HotelName))
            {
                //query = query.Where(p => p.cl.HOTEL_CODE == searchCriteria.HotelName);
                query = query.Where(p => p.HotelCode == searchCriteria.HotelName);
            }

            pageInfo.RecordsTotal = query.Count();

            //Setup Order, the order that passed in like "columnname asc, columnname desc"
            if (!string.IsNullOrWhiteSpace(pageInfo.OrderColumn))
            {
                var orderString = TransformOrder(pageInfo.OrderColumn.TrimEnd(','));
                query = query.OrderBy(orderString);
            }
            else
            {
                //query = query.OrderByDescending(p => p.cl.ID);
                query = query.OrderByDescending(p => p.id);
            }

            //Setup paging
            if (pageInfo.PageSize == -1 && pageInfo.StartIndex == -1)
            {
            }
            else
            {
                query = query.Skip(pageInfo.StartIndex).Take(pageInfo.PageSize);
            }
            //Get column that we need
            //var list = query.Select(x => new UserSearchResultDTO()
            //{
            //    id = x.cl.ID,
            //    HotelCode = x.cl.HOTEL_CODE,
            //    ConciergeID = x.cl.ConciergeID,
            //    FName = x.cl.FName,
            //    LName = x.cl.LName,
            //    Phone = x.cl.Phone,
            //    IsActive = x.cl.Active,
            //    AccessLevel = x.cl.AccessLevel

            //}).ToList();



            //return list;
            return(query.ToList());
        }
Пример #31
0
        public IList <ImagesSearchResultDTO> getUpGradeTypeImageBySearchCriteria(ImagesSearchCriteriaDTO searchCriteria, PagingInformation pageInfo)
        {
            IList <string> hotelCodeList = userAccountService.GetUserMappedHotelCodes(searchCriteria.UserName);

            if (hotelCodeList != null && hotelCodeList.Any())
            {
                List <RoomType_Code> roomtypeList = (from grtc in roomtypeRepo.GetAll()
                                                     where hotelCodeList.Contains(grtc.Hotel_Code) && grtc.IsActive == true && grtc.ImageYN == "Y" && grtc.LanguageId == 1
                                                     select grtc).ToList();

                //filter Hotel Name
                if (!string.IsNullOrWhiteSpace(searchCriteria.HotelName))
                {
                    roomtypeList = roomtypeList.Where(p => p.Hotel_Code == searchCriteria.HotelName).ToList();
                }

                //pageInfo.RecordsTotal = roomtypeList.Count();

                List <RoomImage> roomImages = imagesRepo.GetAll().ToList();

                //Get column that we need
                var list = roomtypeList.AsQueryable().Select(x => new ImagesSearchResultDTO()
                {
                    id                  = x.id,
                    Hotel_Code          = x.Hotel_Code,
                    RoomCode            = x.RoomCode,
                    RoomDescription     = x.RoomDescription,
                    RoomLongDescription = x.RoomLongDescription,
                    PriceDesc           = x.PriceDesc,
                    IsActive            = x.IsActive,
                    AddOnYN             = x.AddOnYN,
                    ImageYN             = x.ImageYN,
                    UpgradeType         = x.AddOnYN == "Y" ? "Add-on" : "Room Upgrade",
                    ImagesCount         = roomImages.Where(y => y.HotelCode == x.Hotel_Code && y.RoomCode == x.RoomCode).ToList().Count,
                    LanguageId          = x.LanguageId,
                    Images              = roomImages.Where(y => y.HotelCode == x.Hotel_Code && y.RoomCode == x.RoomCode).OrderBy(p => p.SortOrder).ToList()
                }).ToList();


                pageInfo.RecordsTotal = list.Count();

                if (!string.IsNullOrWhiteSpace(pageInfo.OrderColumn))
                {
                    string orderString = pageInfo.OrderColumn.TrimEnd(',');
                    list = list.AsQueryable().OrderBy(orderString).ToList();
                }
                else
                {
                    list = list.AsQueryable().OrderByDescending(p => p.id).ToList();
                }

                //Setup paging
                if (pageInfo.PageSize == -1 && pageInfo.StartIndex == -1)
                {
                }
                else
                {
                    list = list.AsQueryable().Skip(pageInfo.StartIndex).Take(pageInfo.PageSize).ToList();
                }

                return(list);
            }
            else
            {
                return(null);
            }
        }