private PostingService CreatePostingService()
        {
            var userID         = Guid.Parse(User.Identity.GetUserId());
            var postingService = new PostingService(userID);

            return(postingService);
        }
        private void runBtn_Click(object sender, RoutedEventArgs e)
        {
            var date = new DateTime(2020, 11, 30);//year, m, d

            if (date < DateTime.Now)
            {
                System.Windows.MessageBox.Show("Update required!");
                System.Windows.Application.Current.Shutdown();
                return;
            }



            if (String.IsNullOrEmpty(loginBox.Text) || String.IsNullOrEmpty(passBox.Text) || String.IsNullOrEmpty(path.Text))
            {
                System.Windows.MessageBox.Show("Fill in all the fields");
                return;
            }
            else
            {
                service             = new PostingService();
                service.endPosting += Result;

                posts.Login    = loginBox.Text;
                posts.Password = passBox.Text;

                if (!String.IsNullOrEmpty(loginBox.Text))
                {
                    posts.Message = messageBox.Text;
                }

                if (timerBox.SelectedIndex != 0)
                {
                    posts.Interval = Convert.ToInt32(timerBox.Text);
                }

                posts.FolderPath = path.Text;

                foreach (var item in Directory.GetFiles(posts.FolderPath).ToList())
                {
                    var res = item.Replace("\\", "/");
                    posts.PhotosFullName.Add(res);
                }

                runBtn.IsEnabled  = false;
                stopBtn.IsEnabled = true;

                service.Login(posts.Login, posts.Password);

                if (random)
                {
                    posts.Random = true;
                }

                var task = Task.Factory.StartNew(() =>
                {
                    service.Start(posts);
                });
            }
        }
        public IHttpActionResult Get(int id)
        {
            PostingService postingService = new PostingService();
            var            posting        = postingService.GetPostingByID(id);

            return(Ok(posting));
        }
        public IHttpActionResult GetAll()
        {
            PostingService postingService = new PostingService();
            var            postings       = postingService.ViewAllPostings();

            return(Ok(postings));
        }
Example #5
0
 public PlayFileModule(IHttpClientFactory httpClientFactory, PlayFormatService playFormatService, PostingService postingService, INotificationService notificationService)
 {
     _httpClientFactory   = httpClientFactory;
     _playFormatService   = playFormatService;
     _postingService      = postingService;
     _notificationService = notificationService;
 }
        public IHttpActionResult GetAll()
        {
            PostingService postingService = CreatePostingService();
            var            postings       = postingService.GetPostings();

            return(Ok(postings));
        }
        public IHttpActionResult Delete(int id)
        {
            PostingService postingService = CreatePostingService();

            if (!postingService.DeletePosting(id))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
        public IHttpActionResult Put(PostingUpdate model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            PostingService postingService = CreatePostingService();

            if (!postingService.UpdatePosting(model))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Example #9
0
 /// <summary>
 /// Gets PostingService
 /// </summary>
 public PostingService GetPostingService()
 {
     if (postingService == null)
     {
         postingService = new PostingService();
         postingService.ResourcePath      = ReconciliationResourcePath.RECONCILIATON_POSTING_RESOURCE_PATH;
         postingService.GroupService      = GetGroupService();
         postingService.FileService       = GetFileService();
         postingService.ModelService      = GetModelService();
         postingService.periodNameService = GetPeriodNameService();
         postingService.measureService    = GetMeasureService();
         configureService(postingService);
     }
     return(postingService);
 }