public async void RemovePushNotificationTokenForAllWorkspaces(String DeviceId) { try { SimpleString ssDeviceId = new SimpleString(); ssDeviceId.Value = DeviceId; HttpResponseMessage resp = await this.PostAsync(Common.WorkspaceApi + "/user/remove-push-notification-all", ssDeviceId); if (resp.IsSuccessStatusCode && !string.IsNullOrEmpty(DeviceId)) { Workspace currentWS = Common.CurrentWorkspace; currentWS.PushNotifDateSent = null; var workspaces = Common.Instance.GetWorkspaces(); foreach (Workspace ws in workspaces) { ws.PushNotifDateSent = null; Common.Instance._sqlconnection.Update(ws); } } //Common.Instance.DeleteAll<PushNotificationSettings>(); } catch (Exception ex) { } }
/// <summary> /// Sends the <see cref="String"/> object through the firebase cloud messaging server /// </summary> /// <param name="token"><see cref="string"/> to send</param> /// <returns><see cref="bool"/> response from the firebase cloud messaging server</returns> public async void SetPushNotificationTokenLegacy(String sToken) { try { SimpleString token = new SimpleString(); token.Value = sToken; HttpResponseMessage resp = await this.PostAsync(Common.WorkspaceApi + "/user/set-push-notification-token", token); //HttpResponseMessage resp = this.Post("https://gjokokoco-demo.projectinsight.net/api/user/set-push-notification-token", sToken); Workspace ws = Common.CurrentWorkspace; if (resp.IsSuccessStatusCode && !string.IsNullOrEmpty(sToken)) { ws.PushNotifDateSent = DateTime.Now; } else { ws.PushNotifDateSent = null; } Common.Instance._sqlconnection.Update(ws); } catch (Exception ex) { Workspace ws = Common.CurrentWorkspace; ws.PushNotifDateSent = null; Common.Instance._sqlconnection.Update(ws); } }
public async Task <IActionResult> DeletePost([FromBody] SimpleString id) { int PostID = Int32.Parse(id.Value); BlogUserIdentity user = await _userManager.FindByNameAsync(User.Identity.Name); var UsersBlog = await _appContext.Blogs.FirstOrDefaultAsync(ob => ob.BlogUserIdentity == user); var postToRemove = _appContext.Posts.FirstOrDefault(ob => ob.PostId == PostID); if (postToRemove != null && postToRemove.Blog == UsersBlog) { _appContext.Posts.Remove(postToRemove); await _appContext.SaveChangesAsync(); await _fileService.DeletePostDirectory(user, postToRemove.Title, postToRemove.DateOfPost); return(Ok()); } else// if post was not found or { return(Conflict()); } }
public override Equality Visit(SimpleString simpleString) => new Equality( @false, another => another.Content == simpleString.Content, @false, @false, @false );
public void Create_CandidateDirectories(SimpleString directories) { //добавление новой папки app.hiringHelper.createCandidateDirectories(directories); Assert.AreEqual(directories.value, app.hiringHelper.getDirectoryName()); }
public void Compare_Image_WorkHistory(SimpleString workHistoryType) { //клик по кнопке добавления app.employeeHelper.openNewWorkInfoPopup(workHistoryType.value); //Проверка соответствия скриншотов Assert.IsTrue(app.screenHelper.NewWorkInfoPopupScreen(workHistoryType.value)); }
public void Compare_Image_Documents(SimpleString docType) { //клик по кнопке добавления app.userHelper.clickAddButton(); app.employeeHelper.openNewDocumentsPopup(docType.value); //Проверка соответствия скриншотов Assert.IsTrue(app.screenHelper.NewDocumentPopupScreen(docType.value)); }
public void createCandidateDirectories(SimpleString directories) { pages.candidatePage.ensurePageLoaded(); pages.candidatePage.setDirectoryName(directories.value); //секунда ожидания для создания папки pages.newCandidatePopup.waitSecond(); }
public override None Visit(SimpleString simpleString) { if (simpleString.Content == "OK") { return(new None()); } throw Exception(simpleString); }
/// <summary> /// Creates the Scene /// </summary> /// <param name="game">Current game reference</param> /// <param name="spriteBatch">spriteBatch to draw with</param> public HelpScene(Game game, SpriteBatch spriteBatch) : base(game) { this.spriteBatch = spriteBatch; // Creating message message = new SimpleString(game, spriteBatch, resources.RegularFont, new Vector2(200, 200), msg, ColourSchemes.boldColour); Components.Add(message); }
public override Response Visit(SimpleString simpleString) { if (simpleString.Content == "OK") { return(Response.OperationPerformed); } throw Exception(simpleString); }
public async Task UpdateAsyncTest() { var simpleItem = new SimpleString { Str = $"simple string update {_rnd.Next(0, 10)}", Id = 1 }; var updateResult = await _repository.UpdateAsync(simpleItem); Assert.IsTrue(updateResult); }
public void Compare_Image_NewTimeOff(SimpleString timeofftype) { //клик по кнопке добавления app.userHelper.clickNewTimeOffsButton(); //выбор типа отпуска app.timeoffHelper.selectType(timeofftype.value); //Проверка скриншота Assert.IsTrue(app.screenHelper.NewTimeOffPopupScreen(timeofftype.value)); }
public async Task CreateAsyncTest() { var simpleItem = new SimpleString { Str = $"simple string {_rnd.Next(0, 10)}" }; var result = await _repository.CreateAsync(simpleItem); Assert.IsNotNull(result); }
public void UpdateTest() { var simpleItem = new SimpleString { Str = $"simple string update {_rnd.Next(0, 10)}", Id = 2 }; var updateResult = _repository.Update(simpleItem); Assert.IsTrue(updateResult); }
public void CreateTest() { var simpleItem = new SimpleString { Str = $"simple string {_rnd.Next(0, 10)}" }; var result = _repository.Create(simpleItem); Assert.IsNotNull(result); }
/// <summary> /// Finding and showing the highscores /// </summary> public void ReadFromFile() { highScores = new SimpleString(Game, spriteBatch, resources.MonoFont, new Vector2(GraphicsDevice.Viewport.Width / 2f, GraphicsDevice.Viewport.Height / 2f), Resources.FormattedHighScores(), ColourSchemes.boldColour, SimpleString.TextAlignH.Middle, SimpleString.TextAlignV.Middle); this.Components.Add(highScores); }
public IActionResult BlogNameCheck([FromBody] SimpleString Name) { var Blog = _appContext.Blogs.Where(b => b.BlogName == Name.Value).FirstOrDefault(); if (Blog == null) { return(Ok()); } else { return(Conflict()); } }
public IActionResult LoginCheck([FromBody] SimpleString Login) { var user = _userManager.Users.FirstOrDefault(ob => ob.UserName == Login.Value); if (user == null) { return(Ok()); } else { return(Conflict()); } }
public override Response Visit(SimpleString simpleString) { return(simpleString.Content switch { BackgroundSavingStarted => new Response( Outcome.BackgroundSavingStarted, BackgroundSavingStarted ), BackgroundSavingScheduled => new Response( Outcome.BackgroundSavingScheduled, BackgroundSavingScheduled ), _ => throw Exception(simpleString) });
public IActionResult CertainPost([FromBody] SimpleString _id) { int id = Int32.Parse(_id.Value); var post = _appContext.Posts.FirstOrDefault(ob => ob.Blog.BlogId == 2).Include(ob => ob.Comments).FirstOrDefault(Obpost => Obpost.PostId == id); if (post == null) { return(Conflict()); } else { var DateOfPost = new DateTime(post.DateOfPost); var ResponsePost = new PostViewModel() { DateOfPost = DateOfPost, PostId = post.PostId, Thumbnail = post.Thumbnail, Title = post.Title, ContentOne = post.ContentOne, ContentTwo = post.ContentTwo, BlogId = post.Blog.BlogId, BlogName = post.Blog.BlogName, Comments = post.Comments.ToList() }; if (post.Images != null) { foreach (var item in post.Images) { ResponsePost.Images.Add(item.Src); } } if (post.PostTags != null) { foreach (var item in post.PostTags) { ResponsePost.PostTags.Add(item.Tag.Name); } } string jsonResult = JsonConvert.SerializeObject(ResponsePost); return(Ok(jsonResult)); } }
public async void RemovePushNotificationTokenForWorkspace(String DeviceId) { try { SimpleString ssDeviceId = new SimpleString(); ssDeviceId.Value = DeviceId; HttpResponseMessage resp = await this.PostAsync(this.RESTBaseUri + "/user/remove-push-notification", ssDeviceId); if (resp.IsSuccessStatusCode && !string.IsNullOrEmpty(DeviceId)) { } //Common.Instance.DeleteAll<PushNotificationSettings>(); } catch (Exception ex) { } }
public async Task <IActionResult> ChangeDescription(SimpleString NewDescription) { if (NewDescription.Value.Length <= 1000) { BlogUserIdentity user = await _userManager.FindByNameAsync(User.Identity.Name); Blog UserBlog = user.Blog; UserBlog.Description = NewDescription.Value; _appContext.Blogs.Update(UserBlog); return(Ok()); } else { return(Conflict()); } }
public static string ToSimpleLowerText(this string value) { SimpleString simpleString = new SimpleString(value); simpleString.ParseText((index, charValue) => { if (charValue == ' ') { return(true); } if (!Regex.IsMatch(charValue.ToString(), "^[0-9A-Za-z ]+$")) { return(false); } return(true); }); string result = simpleString; return(result?.ToLower()); }
/// <summary> /// Sets the push the notification token for the supplied device id, token and <see cref="User"/>. URL: /api/set-push-notification /// </summary> /// <param name="deviceId"><see cref="SimpleString"/> device ID (id of the phone)</param> /// <param name="pushNotificationToken"> <see cref="SimpleString"/> push notification token</param> /// <returns><see cref="User"/> matching the Id.</returns> public HttpResponseMessage SetPushNotificationToken(String DeviceId, String Token) { try { SimpleString pushNotificationToken = new SimpleString(); pushNotificationToken.Value = Token; this.AddQueryParam("deviceId", DeviceId.ToString()); HttpResponseMessage resp = this.Post(this.RESTBaseUri + "/user/set-push-notification", pushNotificationToken); return(resp); } catch (Exception ex) { return(null); //Workspace ws = Common.CurrentWorkspace; //ws.PushNotifDateSent = null; //Common.Instance._sqlconnection.Update(ws); } }
public override long Visit(SimpleString simpleString) => throw new VisitException("Integer expected", simpleString);
public override bool Visit(SimpleString simpleString) => simpleStringEquality(simpleString);
public void Visit(SimpleString simpleString) { EmitStackUp($"ldstr {simpleString.Value}"); }
public override IReadOnlyList <T> Visit(SimpleString simpleString) { var list = listVisitor.Visit(simpleString); return(Project(list)); }
/// <summary> /// Returns the hash code of the current object. /// </summary> /// <returns>The hash code of the current object</returns> public override int GetHashCode() => SimpleString.GetHashCode();