public OneSignalNotificationResponse SendSeletiva(NotificacaoSeletiva notificacao, string chaveAppId, string chaveGcm) { using (MiniProfiler.Current.Step("enviando seletiva")) { IDictionary <string, string> additionalInfo = new Dictionary <string, string> (); additionalInfo.Add("notificacaoTipoId", (notificacao.NotificacaoTipoId.Id).ToString()); additionalInfo.Add("infoAdicional", notificacao.InfoAdicional); var oneSignalObject = new OneSignalNotification() { AppId = ConfigurationProvider.Get("Settings:" + chaveAppId), GcmKey = ConfigurationProvider.Get("Settings:" + chaveGcm), Message = new OneSignalMessage(notificacao.Mensagem), Title = new OneSignalMessage(notificacao.Titulo), Devices = notificacao.DevicesUsuarios, Data = additionalInfo, DelayedOption = UseInteligentDelivery(notificacao.NotificacaoTipoId.Id) ? "last-active" : "null" }; OneSignalNotificationResponse data = new OneSignalNotificationResponse(); using (var client = HttpCalls.CreateClient(ConfigurationProvider.Get("Settings:oneSignalUrl"))) { try { var response = HttpCalls.PostData(client, ConfigurationProvider.Get("Settings:oneSignalNotificationResource"), oneSignalObject); data.Sucesso = true; data.Message = response; } catch (Exception ex) { data.Sucesso = false; data.Message = ex.Message; } } return(data); } }
public string Download(string url) { string extension = Path.GetExtension(url); string relativeDateBasedPath = TimeLogProvider.GenerateDateBasedPath(); string saveToPath = $"{Configuration["FrixxerDownloadToRoot"]}{ relativeDateBasedPath }{ Randomizer.GenerateString(12) }{extension}"; /* We'll perform the actual download here. We'll do it later. We do not handle * whether there was any sort of error, though. */ if (!File.Exists(saveToPath)) { HttpResponseMessage response = HttpCalls.GetAsync(url, acceptHeader: GetAcceptHeaderValue(url)).Result; string pathRoot = Path.GetDirectoryName(saveToPath); if (!Directory.Exists(pathRoot)) { Directory.CreateDirectory(pathRoot); } Stream stream = response.Content.ReadAsStreamAsync().Result; using (FileStream fileStream = new FileStream(saveToPath, FileMode.Create, FileAccess.Write)) { stream.CopyToAsync(fileStream).Wait(); stream.Flush(); } } return(saveToPath.Substring(Configuration["FrixxerFilesRoot"].Length)); }
public List <UserDetails> updateuserProfile() { string userid = Session["CID"].ToString(); List <UserDetails> editobj = new List <UserDetails>(); return(HttpCalls.HttpclientListcall(editobj, "Register", "GetUserProfile" + "?cusid=" + userid)); }
public List <Showdates> GetMovieDate(string MovieID) { List <Showdates> showdate = new List <Showdates>(); return(HttpCalls.HttpclientListcall(showdate, "BookMovie", "GetMovieDate" + "?MovieId=" + MovieID)); //var list = new List<BookMovieTicket>(); //var httpClient = new HttpClient(); //httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //HttpResponseMessage response; //response = httpClient.GetAsync(webapiurl + "/BookMovie/GetMovieDate?MovieId=" + MovieID).Result; //response.EnsureSuccessStatusCode(); //List<Showdates> stateList = response.Content.ReadAsAsync<List<Showdates>>().Result; ////if (response.IsSuccessStatusCode) ////{ //// using (HttpContent content = response.Content) //// { //// string jsonS = response.Content.ReadAsStringAsync().Result; //// var ds = JsonConvert.DeserializeObject(jsonS); //// return ds; //// } ////} //if (!object.Equals(stateList, null)) //{ // var states = stateList.ToList(); // return states; //} //else //{ // return null; //} }
private async Task Initialize(string threadid) { await Task.Delay(1000); HttpCalls call = new HttpCalls(); List <MsgModel> msgs = await call.GetThreadAsync(threadid); _question = msgs[0]; msgs.RemoveAt(0); _answerlist = QaikuExtensions.ToObservableCollection <MsgModel>(msgs); }
public async Task <PublishDeltaResult> PublishProductDeltas(IEnumerable <Product> products, IEnumerable <DeletedProductSku> deletedProducts, IEnumerable <AccountPrice> accountPrices, IEnumerable <DeletedAccountPrice> deletedAccountPrices, string accessKey) { var deltas = new List <ProcessedProductDelta>(); var publishDeltaResult = new PublishDeltaResult(); var endpoint = RegionEndpoints.GetRegionEndpoints(region); var fullEndpoint = $"{endpoint.APIEndpoint}{deltaEndpointSuffix}"; try { deltas = ConversionManager.ProcessProductDeltas(products, deletedProducts, accountPrices, deletedAccountPrices, accessKey); } catch (Exception e) { return(new PublishDeltaResult { Success = false, Errors = new List <PublishDeltaError> { new PublishDeltaError { Error = e.Message, Skus = products.Count() > 0 ? products.Select(prod => prod.Sku) : null, DeletedSkus = deletedProducts.Count() > 0 ? deletedProducts.Select(deletedProd => deletedProd.Sku) : null, AccountPrices = accountPrices, DeletedAccountPrices = deletedAccountPrices } } }); } foreach (var delta in deltas) { try { var json = JSONSerialization.SerializeToJSON(delta); var deltaResult = await HttpCalls.Post <DeltaResult>(json, fullEndpoint); publishDeltaResult.Tokens.Add(deltaResult.Token); } catch (Exception e) { publishDeltaResult.Errors.Add(new PublishDeltaError { Error = e.Message, Skus = products.Count() > 0 ? products.Select(prod => prod.Sku) : null, DeletedSkus = deletedProducts.Count() > 0 ? deletedProducts.Select(deletedProd => deletedProd.Sku) : null, AccountPrices = accountPrices, DeletedAccountPrices = deletedAccountPrices }); } } publishDeltaResult.Success = publishDeltaResult.Errors.Count == 0; return(publishDeltaResult); }
//Toggles the state of the message private async void StateButton_Clicked(object sender, EventArgs e) { if (_message.State == 1) { _message.State = 3; } else { _message.State--; } HttpCalls call = new HttpCalls(); MsgModel updated = await call.PutStateAsync(_message.id, _message); _message = updated; BindingContext = await QuestionThreadPageModel.Update(_message, User); }
//Fetches the user's sent and received messages async private async Task Initialize() { await Task.Delay(1000); HttpCalls call = new HttpCalls(); List<MsgModel> msgs = new List<MsgModel>() ; List<MsgModel> sent = await call.GetSentMessagesAsync(User.UserId); List<MsgModel> received = await call.GetReceivedMessagesAsync(User.UserId); List<string> Threadids = new List<string>() ; foreach (var item in sent) { if (!Threadids.Contains(item.ThreadId)) { Threadids.Add(item.ThreadId); if (item.Category==1) { msgs.Add(item); } } continue; } foreach (var item in received) { if (!Threadids.Contains(item.ThreadId)) { Threadids.Add(item.ThreadId); List<MsgModel> thread = await call.GetThreadAsync(item.ThreadId); MsgModel originalquestion = thread[0]; msgs.Add(originalquestion); } } msgs = msgs.OrderBy(m => m.State).ToList(); _messages = QaikuExtensions.ToObservableCollection<MsgModel>(msgs); }
private async Task <QueryTokensResult> CallTokenStatus(IEnumerable <string> tokens) { var queryResult = new QueryTokensResult(); var tokenFeed = new TokenFeed { AppKey = _accessKey, Tokens = tokens.ToArray() }; var json = JSONSerialization.SerializeToJSON(tokenFeed); var resonse = await HttpCalls.Post <JArray>(json, _fullEndpoint); if (resonse != null) { foreach (var jsonObject in resonse) { var token = JsonConvert.DeserializeObject <TokenStatus>(jsonObject.ToString()); queryResult.TokenStatuses.Add(token); } } return(queryResult); }
public List <TicketAvaliblity> GetTicketavl(string date, string MovieID) { List <TicketAvaliblity> movielist = new List <TicketAvaliblity>(); return(HttpCalls.HttpclientListcall(movielist, "BookMovie", "CheckAvaliblity" + "?showdate=" + date + "&movie=" + MovieID)); }
public List <ComplientList> AdminComplientsDetailsmethod() { List <ComplientList> lstcomplient = new List <ComplientList>(); return(HttpCalls.HttpclientListcall(lstcomplient, "admin", "GetComplients")); }
public string RaiseComplient(ComplientStatus obj) { return(HttpCalls.Httpclientcall(obj, "BookMovie", "Complient")); }
public List <MovieReviewScore> MovieReviewScores() { List <MovieReviewScore> movielist = new List <MovieReviewScore>(); return(HttpCalls.HttpclientListcall(movielist, "BookMovie", "ShowReview")); }
public List <BookMovieTicket> MyTickets(string uid) { List <BookMovieTicket> movieticket = new List <BookMovieTicket>(); return(HttpCalls.HttpclientListcall(movieticket, "BookMovie", "MyBooking" + "?cusid=" + uid)); }
public List <BookMovieTicket> TicketDetails(string bookingid) { List <BookMovieTicket> movieticket = new List <BookMovieTicket>(); return(HttpCalls.HttpclientListcall(movieticket, "BookMovie", "Get" + "?bookid=" + bookingid)); }
public List <MovieDetailsdelete> MovieRunningNow() { List <MovieDetailsdelete> movielist = new List <MovieDetailsdelete>(); return(HttpCalls.HttpclientListcall(movielist, "Register", "GetAllMovie")); }
public string BookMovieTic(BookMovie obj) { return(HttpCalls.Httpclientcall(obj, "BookMovie", "BookTicket")); }
public string AddMoviemethod(movieDetailsList obj) { return(HttpCalls.Httpclientcall(obj, "Admin", "AddMovie")); }
public string AddUserDetails(UserData obj) { return(HttpCalls.Httpclientcall(obj, "Register", "createUser")); }
public List <movieDetailsList> AdminMovieDetails() { List <movieDetailsList> movobj = new List <movieDetailsList>(); return(HttpCalls.HttpclientListcall(movobj, "admin", "GetMovieRunning")); }
public string UpdateUserDetails(UserData obj) { obj.CID = int.Parse(Session["CID"].ToString()); return(HttpCalls.Httpclientcall(obj, "Register", "UpdateUser")); }
public string ChangePricemethod(ChangePrice obj) { return(HttpCalls.Httpclientcall(obj, "Admin", "UpdatePrice")); }
public string AddSeatMethod(AddSeats obj) { return(HttpCalls.Httpclientcall(obj, "Admin", "Updateseat")); }
public string ValidateUser(UsersLogin obj) { return(HttpCalls.Httpclientcall(obj, "Register", "loginUser")); }