public async Task <List <MerchantCategoryDto> > GetAll(MerchantByCategory MerchantByCategory) { int countryID = await _LookupTypeValuesService.GetCountryID(MerchantByCategory.Ipcountry); //return this.Repository.Where(m => m.CategoryID == CategoryID).ToList(); var getMerchantCategory = (from s in this.Repository.Where(m => m.CategoryID == MerchantByCategory.CategoryID) where s.Merchant.Users.Status == 1 where s.Merchant.MerchantRequest.LookupTypeValues.Description == "Approved" select new { s.Merchant, s.MerchantID, s.Merchant.Country, s.Merchant.MerchantRedirection, }).ToList(); List <MerchantCategoryDto> MerchantCategorylist = new List <MerchantCategoryDto>(); foreach (var MerchantCategory in getMerchantCategory) { if (MerchantCategory.Merchant.MerchantSellCountries != null) { foreach (var MerchantSellCategory in MerchantCategory.Merchant.MerchantSellCountries) { if (MerchantSellCategory.Country == countryID) { MerchantCategoryDto MerchantCategoryDto = new MerchantCategoryDto(); MerchantCategoryDto.MerchantID = MerchantCategory.MerchantID; MerchantCategoryDto.MerchantName = MerchantCategory.Merchant.Name; MerchantCategoryDto.MerchantCountry = MerchantCategory.Country; //MerchantCategoryDto.MerchantUrl = MerchantCategory.Merchant.Website; MerchantCategoryDto.MerchantWebImage = MerchantCategory.Merchant.CompanyImage; MerchantCategoryDto.MerchantProfileImage = MerchantCategory.Merchant.ProfileImage; string Merchantatt = ""; if (MerchantCategory.MerchantRedirection.Count > 0) { foreach (var MerchantRedirection in MerchantCategory.MerchantRedirection) { Merchantatt += "&" + MerchantRedirection.Attribute + "=" + MerchantRedirection.Value; } } if (Merchantatt != "" && MerchantCategory.Merchant.MerchantRedirectionUrl != "") { MerchantCategoryDto.MerchantUrl = MerchantCategory.Merchant.MerchantRedirectionUrl + "?MerchantID=" + MerchantCategory.MerchantID + Merchantatt; } if (Merchantatt == "" && MerchantCategory.Merchant.MerchantRedirectionUrl != "") { MerchantCategoryDto.MerchantUrl = MerchantCategory.Merchant.MerchantRedirectionUrl; } MerchantCategorylist.Add(MerchantCategoryDto); } } } } return(MerchantCategorylist); }
public async Task <List <GetAdminPromotionalDto> > GetAdminHomePromotional(string Ipcountry, string CountryTimezone) { var getAdminPromotionallist = (from s in this.Repository select new { s.Id, s.Promotionalcountries, s.EnglishImage, s.ArabicImage, s.PromotionalURL, s.AdminPromotionalCountries, s.Promotionaldescription, s.Status, s.StartDate, s.EndDate, s.IsDefault, s.TimeZone, }).Where(m => m.Status.Equals(1)) .OrderBy(m => m.StartDate).ToList(); List <GetAdminPromotionalDto> Promotionallist = new List <GetAdminPromotionalDto>(); if (Ipcountry.ToUpper() != "NULL" && CountryTimezone.ToUpper() != "NULL") { int countryID = await _LookupTypeValuesService.GetCountryID(Ipcountry); DateTime Presentdate = Convert.ToDateTime(GetPresentdate); DateTime Timezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Presentdate, TimeZoneInfo.Local.Id, CountryTimezone); if (getAdminPromotionallist.Count > 0) { var getAdminPromotionalActivelist = getAdminPromotionallist.Where(m => m.IsDefault != "1"); foreach (var AdminPromotional in getAdminPromotionalActivelist) { DateTime StartTimezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(AdminPromotional.StartDate, AdminPromotional.TimeZone, CountryTimezone); DateTime ENDTimezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(AdminPromotional.EndDate, AdminPromotional.TimeZone, CountryTimezone); if (StartTimezone <= Timezone && ENDTimezone >= Timezone) { int PromotionalCountries = 0; foreach (var AdminPromotionalCountries in AdminPromotional.AdminPromotionalCountries) { if (AdminPromotionalCountries.LookupTypeValues.Id == countryID) { PromotionalCountries++; } } if (PromotionalCountries > 0) { GetAdminPromotionalDto GetAdminPromotionalDto = new GetAdminPromotionalDto(); GetAdminPromotionalDto.PromotionalId = AdminPromotional.Id; GetAdminPromotionalDto.Countries = AdminPromotional.Promotionalcountries; GetAdminPromotionalDto.ArabicImage = AdminPromotional.ArabicImage; GetAdminPromotionalDto.EnglishImage = AdminPromotional.EnglishImage; GetAdminPromotionalDto.AdminPromotionalURL = AdminPromotional.PromotionalURL; if (!string.IsNullOrEmpty(AdminPromotional.PromotionalURL)) { if (AdminPromotional.PromotionalURL.ToUpper().Contains("HTTP") || AdminPromotional.PromotionalURL.ToUpper().Contains("HTTPS")) { GetAdminPromotionalDto.AdminPromotionalURL = AdminPromotional.PromotionalURL; } else { GetAdminPromotionalDto.AdminPromotionalURL = "http://" + AdminPromotional.PromotionalURL; } } GetAdminPromotionalDto.AdminPromotionalDescription = AdminPromotional.Promotionaldescription; GetAdminPromotionalDto.StartDate = AdminPromotional.StartDate; GetAdminPromotionalDto.EndDate = AdminPromotional.EndDate; GetAdminPromotionalDto.Status = AdminPromotional.Status; Promotionallist.Add(GetAdminPromotionalDto); } } } } } if (getAdminPromotionallist.Count > 0 && Promotionallist.Count == 0) { var getAdminPromotionalDefaultlist = getAdminPromotionallist.Where(m => m.IsDefault == "1"); foreach (var AdminPromotional in getAdminPromotionalDefaultlist) { GetAdminPromotionalDto GetAdminPromotionalDto = new GetAdminPromotionalDto(); GetAdminPromotionalDto.PromotionalId = AdminPromotional.Id; GetAdminPromotionalDto.EnglishImage = AdminPromotional.EnglishImage; GetAdminPromotionalDto.ArabicImage = AdminPromotional.ArabicImage; GetAdminPromotionalDto.AdminPromotionalURL = AdminPromotional.PromotionalURL; if (!string.IsNullOrEmpty(AdminPromotional.PromotionalURL)) { if (AdminPromotional.PromotionalURL.ToUpper().Contains("HTTP") || AdminPromotional.PromotionalURL.ToUpper().Contains("HTTPS")) { GetAdminPromotionalDto.AdminPromotionalURL = AdminPromotional.PromotionalURL; } else { GetAdminPromotionalDto.AdminPromotionalURL = "http://" + AdminPromotional.PromotionalURL; } } GetAdminPromotionalDto.AdminPromotionalDescription = AdminPromotional.Promotionaldescription; GetAdminPromotionalDto.Status = AdminPromotional.Status; Promotionallist.Add(GetAdminPromotionalDto); } } return(Promotionallist.ToList()); }
public async Task <List <GetBannerDto> > GetAllBanner(string Ipcountry, string CountryTimezone) { DateTime Presentdate = Convert.ToDateTime(GetPresentdate); var getBannerlist = (from s in this.Repository select new { s.Id, s.MerchantID, s.Merchant.Name, s.Merchant.Email, MerchantStatus = s.Merchant.Users.Status, s.Country, s.EnglishImage, s.ArabicImage, s.BannerURL, s.BannerDescription, s.Status, s.StartDate, s.EndDate, s.MerchantBanner, s.TimeZone, }).Where(m => m.Status.Equals(1) && m.MerchantStatus.Equals(1)) .OrderBy(m => m.StartDate).ToList(); List <GetBannerDto> Bannerlist = new List <GetBannerDto>(); if (Ipcountry.ToUpper() != "NULL" && CountryTimezone.ToUpper() != "NULL") { int countryID = await _LookupTypeValuesService.GetCountryID(Ipcountry); DateTime Timezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Presentdate, TimeZoneInfo.Local.Id, CountryTimezone); if (getBannerlist.Count > 0) { foreach (var Banner in getBannerlist) { DateTime StartTimezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Banner.StartDate, Banner.TimeZone, CountryTimezone); DateTime ENDTimezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Banner.EndDate, Banner.TimeZone, CountryTimezone); if (StartTimezone <= Timezone && ENDTimezone >= Timezone) { int BannerCountries = 0; foreach (var MerchantBanner in Banner.MerchantBanner) { if (MerchantBanner.CountryID == countryID) { BannerCountries++; } } if (BannerCountries > 0) { GetBannerDto BannerDto = new GetBannerDto(); BannerDto.BannerId = Banner.Id; BannerDto.MerchantId = Banner.MerchantID; BannerDto.MerchantName = Banner.Name; BannerDto.Countries = Banner.Country; BannerDto.EnglishImage = Banner.EnglishImage; BannerDto.ArabicImage = Banner.ArabicImage; BannerDto.BannerURL = Banner.BannerURL; if (!string.IsNullOrEmpty(Banner.BannerURL)) { if (Banner.BannerURL.ToUpper().Contains("HTTP") || Banner.BannerURL.ToUpper().Contains("HTTPS")) { BannerDto.BannerURL = Banner.BannerURL; } else { BannerDto.BannerURL = "http://" + Banner.BannerURL; } } BannerDto.BannerDescription = Banner.BannerDescription; BannerDto.StartDate = Banner.StartDate; BannerDto.EndDate = Banner.EndDate; BannerDto.Status = Banner.Status; Bannerlist.Add(BannerDto); } } } } } return(Bannerlist.ToList()); }
public async Task <List <GetDealDto> > GetAllDeal(string Ipcountry, string CountryTimezone) { var getDeallist = (from s in this.Repository select new { s.Id, s.MerchantId, s.Merchant.Name, s.Merchant.Email, MerchantStatus = s.Merchant.Users.Status, s.DealName, s.DealCode, s.Country, s.EnglishImage, s.ArabicImage, s.DealURL, s.DealDescription, s.Status, s.StartDate, s.EndDate, s.MerchantDeal, s.TimeZone, }).Where(m => m.Status.Equals(1) && m.MerchantStatus.Equals(1)) .OrderBy(m => m.StartDate).ToList(); List <GetDealDto> Deallist = new List <GetDealDto>(); if (Ipcountry.ToUpper() != "NULL" && CountryTimezone.ToUpper() != "NULL") { int countryID = await _LookupTypeValuesService.GetCountryID(Ipcountry); DateTime Timezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Presentdate, TimeZoneInfo.Local.Id, CountryTimezone); if (getDeallist.Count > 0) { foreach (var Deal in getDeallist) { DateTime StartTimezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Deal.StartDate, Deal.TimeZone, CountryTimezone); DateTime ENDTimezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Deal.EndDate, Deal.TimeZone, CountryTimezone); if (StartTimezone <= Timezone && ENDTimezone >= Timezone) { int DealCountries = 0; foreach (var MerchantDeal in Deal.MerchantDeal) { if (MerchantDeal.CountryID == countryID) { DealCountries++; } } if (DealCountries > 0) { GetDealDto DealDto = new GetDealDto(); DealDto.DealId = Deal.Id; DealDto.MerchantId = Deal.MerchantId; DealDto.MerchantName = Deal.Name; DealDto.Countries = Deal.Country; DealDto.EnglishImage = Deal.EnglishImage; DealDto.ArabicImage = Deal.ArabicImage; if (!string.IsNullOrEmpty(Deal.DealURL)) { if (Deal.DealURL.ToUpper().Contains("HTTP") || Deal.DealURL.ToUpper().Contains("HTTPS")) { DealDto.DealURL = Deal.DealURL; } else { DealDto.DealURL = "http://" + Deal.DealURL; } } DealDto.DealName = Deal.DealName; DealDto.DealDescription = Deal.DealDescription; DealDto.StartDate = Deal.StartDate; DealDto.EndDate = Deal.EndDate; DealDto.Status = Deal.Status; Deallist.Add(DealDto); } } } } } return(Deallist.ToList()); }
public async Task <List <GetCategorylistDto> > GetAll(GetCategoryDto GetCategoryDto) { List <GetCategorylistDto> Categorylist = new List <GetCategorylistDto>(); //return Repository.OrderBy(x => x.Priority).ToList(); int countryID = await _LookupTypeValuesService.GetCountryID(GetCategoryDto.Ipcountry); var getCategory = (from s in this.Repository select new { s.Id, s.Image, s.Name, s.Priority, s.IsActive, //s.MerchantCategory }).ToList(); if (GetCategoryDto.Type != "A") { getCategory = getCategory.Where(m => m.IsActive.Equals(1)).ToList() .OrderBy(x => x.Priority).ToList(); foreach (var Category in getCategory) { int Merchantcount = 0; GetCategorylistDto CategoryDto = new GetCategorylistDto(); CategoryDto.Id = Category.Id; CategoryDto.Image = Category.Image; CategoryDto.Name = Category.Name; CategoryDto.Priority = Category.Priority; CategoryDto.IsActive = Category.IsActive; //foreach (var MerchantCategory in Category.MerchantCategory) //{ // if (MerchantCategory.Merchant != null && MerchantCategory.Merchant.MerchantSellCountries != null) // { // foreach (var MerchantSellCategory in MerchantCategory.Merchant.MerchantSellCountries) // { // if (MerchantSellCategory.Country == countryID) // { // if (MerchantCategory.Merchant.MerchantRequest != null) // { // if (MerchantCategory.Merchant.MerchantRequest.ApprovalStatus != 0) // { // if (MerchantCategory.Merchant.MerchantRequest.ApprovalStatus == 26) // { // Merchantcount++; // } // } // } // } // } // } //} CategoryDto.MerchantCount = Merchantcount; Categorylist.Add(CategoryDto); } } else { foreach (var Category in getCategory) { GetCategorylistDto CategoryDto = new GetCategorylistDto(); CategoryDto.Id = Category.Id; CategoryDto.Image = Category.Image; CategoryDto.Name = Category.Name; CategoryDto.Priority = Category.Priority; CategoryDto.IsActive = Category.IsActive; Categorylist.Add(CategoryDto); } } return(Categorylist.OrderBy(x => x.Priority).ToList()); }