public ProfileResponse CreateProfileResponse(ProfileEN pProfileID) { ProfileResponse response = new ProfileResponse(); UserProfile profile = new UserProfile(); response.profile = new UserProfile(); try { response.profile.Id = pProfileID.ProfileID; response.profile.birthday = pProfileID.Birthday; response.profile.first_name = pProfileID.FirstName; response.profile.last_name = pProfileID.LastName; response.profile.verified = pProfileID.Verified; response.profile.email = pProfileID.Email; response.profile.NickName = pProfileID.Nickname; response.profile.vendorId = pProfileID.VendorID; response.profile.Iso2code = pProfileID.Iso2Code; response.profile.Symbol = pProfileID.Symbol; response.profile.Personphone = pProfileID.PersonPhone; response.profile.LastSale = pProfileID.LastSale; } catch (Exception ex) { Console.WriteLine(ex.InnerException); EventViewerLoggerBL.LogError(ex.Message); } return(response); }
void aTimer_Tick(object sender, EventArgs e) { var api = ConfigurationManager.AppSettings["Api"]; if (api == "RecarGO") { EventViewerLoggerBL.LogError("Inicia Timer..."); LeaderBoardsInteractor interactor = new LeaderBoardsInteractor(); var responseSuccess = interactor.createResponseSaveJson(); } }
public BuildResponse CreateBuildResponse(BuildVersionEN pBuildVersion) { BuildResponse response = new BuildResponse(); try { response.Valid = pBuildVersion.Valid; response.RequiredVersion = pBuildVersion.VersionName; response.Platform = pBuildVersion.Platform; response.Message = pBuildVersion.Result; } catch (Exception ex) { Console.WriteLine(ex.InnerException); EventViewerLoggerBL.LogError("BuildValidatorInteractor: " + ex.Message); } return(response); }
public ProductsResponse CreateProductsResponse(List <ProductEN> pProducts) { ProductsResponse response = new ProductsResponse(); response.products = new List <TopupProducts>(); try { var operatorProducts = pProducts.GroupBy(pr => pr.Brand) .Select(grp => grp.FirstOrDefault()).ToList().OrderBy(op => op.OperatorRelevance); foreach (var operatr in operatorProducts) { TopupProducts topupProduct = new TopupProducts(); topupProduct.denomination = new List <Product>(); topupProduct.mno = operatr.Brand; var products = pProducts.Where(br => String.Equals(br.Brand, operatr.Brand)).ToList(); foreach (var prod in products) { Product product = new Product(); product.Amount = Convert.ToString(prod.Amount); product.Code = prod.Code; product.Description = prod.Description; product.PackageCode = prod.PackageCode; product.Relevance = prod.Relevance; topupProduct.denomination.Add(product); } response.products.Add(topupProduct); } } catch (Exception ex) { Console.WriteLine(ex.InnerException); EventViewerLoggerBL.LogError(ex.Message); } return(response); }
public IResponse createResponseSaveJson() { GenericApiResponse response = new GenericApiResponse(); List <LeaderBoardsResponse> list = new List <LeaderBoardsResponse>(); List <LeaderBoards> listAllLeaderBoards = new List <LeaderBoards>(); try { LeaderBoards Leaderboards = new LeaderBoards(); var pLeaderboards = gameBL.GetLeaderBoards(); var pLastWinner = gameBL.GetLastWinner(); listAllLeaderBoards.Add(Leaderboards); LeaderBoardsResponse resultToday = new LeaderBoardsResponse(); resultToday.LastWinner = pLastWinner.LastWinnerOnYesterday; resultToday.Leaderboards = pLeaderboards.ListLeaderBoardsToday; resultToday.filter = "Today"; list.Add(resultToday); LeaderBoardsResponse resultWeek = new LeaderBoardsResponse(); resultWeek.LastWinner = pLastWinner.LastWinnerOnWeek; resultWeek.Leaderboards = pLeaderboards.ListLeaderBoardsWeek; resultWeek.filter = "Week"; list.Add(resultWeek); LeaderBoardsResponse resultMonth = new LeaderBoardsResponse(); resultMonth.LastWinner = pLastWinner.LastWinnerOnMonth; resultMonth.Leaderboards = pLeaderboards.ListLeaderBoardsMonth; resultMonth.filter = "Month"; list.Add(resultMonth); LeaderBoardsResponse resultOverAll = new LeaderBoardsResponse(); resultOverAll.Leaderboards = pLeaderboards.ListLeaderBoardsOverAll; resultOverAll.filter = "OverAll"; list.Add(resultOverAll); string json = JsonConvert.SerializeObject(list, Formatting.Indented); EventViewerLoggerBL.LogError("json data: " + json); var appData = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "Repository"); foreach (var file in Directory.EnumerateFiles(appData)) { var dest = Path.Combine(appData, Path.GetFileName(file)); if (!File.Exists(dest)) { File.Copy(file, dest); } System.IO.File.WriteAllText(dest, json); } response.HttpCode = 200; response.InternalCode = "00"; response.Message = "Success"; } catch (Exception ex) { EventViewerLoggerBL.LogError(ex.Message); response = null; } return(response); }