示例#1
0
        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)
            {
            }
        }
示例#2
0
        /// <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);
            }
        }
示例#3
0
        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());
            }
        }
示例#4
0
 public override Equality Visit(SimpleString simpleString) => new Equality(
     @false,
     another => another.Content == simpleString.Content,
     @false,
     @false,
     @false
     );
示例#5
0
        public void Create_CandidateDirectories(SimpleString directories)
        {
            //добавление новой папки
            app.hiringHelper.createCandidateDirectories(directories);

            Assert.AreEqual(directories.value, app.hiringHelper.getDirectoryName());
        }
示例#6
0
 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));
 }
示例#8
0
        public void createCandidateDirectories(SimpleString directories)
        {
            pages.candidatePage.ensurePageLoaded();

            pages.candidatePage.setDirectoryName(directories.value);
            //секунда ожидания для создания папки
            pages.newCandidatePopup.waitSecond();
        }
示例#9
0
        public override None Visit(SimpleString simpleString)
        {
            if (simpleString.Content == "OK")
            {
                return(new None());
            }

            throw Exception(simpleString);
        }
示例#10
0
        /// <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);
        }
示例#11
0
            public override Response Visit(SimpleString simpleString)
            {
                if (simpleString.Content == "OK")
                {
                    return(Response.OperationPerformed);
                }

                throw Exception(simpleString);
            }
示例#12
0
        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));
 }
示例#14
0
        public async Task CreateAsyncTest()
        {
            var simpleItem = new SimpleString {
                Str = $"simple string {_rnd.Next(0, 10)}"
            };
            var result = await _repository.CreateAsync(simpleItem);

            Assert.IsNotNull(result);
        }
示例#15
0
        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);
        }
示例#16
0
        public void CreateTest()
        {
            var simpleItem = new SimpleString {
                Str = $"simple string {_rnd.Next(0, 10)}"
            };
            var result = _repository.Create(simpleItem);

            Assert.IsNotNull(result);
        }
示例#17
0
 /// <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);
 }
示例#18
0
        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());
            }
        }
示例#19
0
        public IActionResult LoginCheck([FromBody] SimpleString Login)
        {
            var user = _userManager.Users.FirstOrDefault(ob => ob.UserName == Login.Value);

            if (user == null)
            {
                return(Ok());
            }
            else
            {
                return(Conflict());
            }
        }
示例#20
0
 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)
     });
示例#21
0
        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));
            }
        }
示例#22
0
        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)
            {
            }
        }
示例#23
0
        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());
            }
        }
示例#24
0
        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());
        }
示例#25
0
        /// <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);
            }
        }
示例#26
0
 public override long Visit(SimpleString simpleString) => throw new VisitException("Integer expected", simpleString);
示例#27
0
 public override bool Visit(SimpleString simpleString) => simpleStringEquality(simpleString);
示例#28
0
 public void Visit(SimpleString simpleString)
 {
     EmitStackUp($"ldstr {simpleString.Value}");
 }
示例#29
0
        public override IReadOnlyList <T> Visit(SimpleString simpleString)
        {
            var list = listVisitor.Visit(simpleString);

            return(Project(list));
        }
示例#30
0
 /// <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();