private void dataGridViewSalesLeads_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            frmComment     newCommnt  = new frmComment();
            CommentHandler newhandler = new CommentHandler(newCommnt, new Comment.Comment());

            newCommnt.SelectedSalesLeadsID = (int)dataGridViewSalesLeads.SelectedRows[0].Cells[0].Value;
            newCommnt.Show();
        }
Exemple #2
0
        private async Task <ErrorResponce> Comment(CommentFormData formData)
        {
            var handler = new CommentHandler(_dbContext);

            return(await handler.Handle(
                       new ProjectHandlerData <(string userName, CommentFormData formData), ErrorResponce>
            {
                Data = ("user", formData),
                Project = _dbContext.Projects.First(project => project.Name == "project")
            }, new CancellationToken()));
Exemple #3
0
 public void DailyTask()
 {
     try
     {
         CommentHandler.commentReminderMail();
         TransactionHandler.AutoConfirmTransaction();
     }
     catch (Exception ex)
     {
         Console.Write("error sending scheduled emails");
     }
 }
Exemple #4
0
        private void cmdRemoveMarkers_Click(object sender, EventArgs e)
        {
            ClearEditor();
            Note("Processing...");

            List <ProjectFile> translatableFiles = _filesController.SelectedFiles.Where(f => f.Role == FileRole.Translatable).ToList();

            if (translatableFiles.Count == 0)
            {
                Note("No translatable files are selected");
            }

            List <ProjectFile> validFiles   = new List <ProjectFile>();
            List <string>      invalidFiles = new List <string>();

            foreach (ProjectFile file in translatableFiles)
            {
                _processor.Open(file.LocalFilePath);
                if (!CommentHandler.ContainsComments(file.LocalFilePath))
                {
                    string fileName = Path.GetFileNameWithoutExtension(file.LocalFilePath);
                    invalidFiles.Add(fileName);
                }
                else
                {
                    _processor.RemoveMarkers(_settings);
                    validFiles.Add(file);
                }
                _processor.Close();
            }
            if (invalidFiles.Count > 0)
            {
                if (invalidFiles.Count == 1)
                {
                    Note("This file does not contain markers: " + invalidFiles[0]);
                }
                else
                {
                    Note("These files do not contain markers: " + string.Join(", ", invalidFiles.ToArray()));
                }
            }
            if (validFiles.Count > 0)
            {
                Note("");
                _editorController.Open(validFiles, EditingMode.Review);
            }
            else
            {
                ClearNotes();
            }
        }
Exemple #5
0
        public async Task Handle(Func <bool> condition = null)
        {
            await ForEach(i =>
            {
                switch (i.Kind)
                {
                case ItemKind.Comment:
                    CommentHandler?.Invoke(i.GetComment());
                    break;

                case ItemKind.Link:
                    LinkHandler?.Invoke(i.GetLink());
                    break;
                }
            }, condition);
        }
Exemple #6
0
        public void Open(string path)
        {
            _path = path;
            _doc  = new XmlDocument();
            _doc.Load(path);
            _doc.PreserveWhitespace = true;

            _nsmgr = new XmlNamespaceManager(_doc.NameTable);
            _nsmgr.AddNamespace("o", "urn:oasis:names:tc:xliff:document:1.2");
            _nsmgr.AddNamespace("s", "http://sdl.com/FileTypes/SdlXliff/1.0");
            _nsmgr.AddNamespace("sdl", "http://sdl.com/FileTypes/SdlXliff/1.0");

            _commenter           = new CommentHandler(_doc, _nsmgr);
            _locker              = new LockHandler(_doc, _nsmgr, _commenter);
            _selector            = new SegmentSelector(_doc, _nsmgr, _commenter, _locker);
            _selector.GetContext = true;
        }
        public JsonResult newComment(string comment, ActionBy commentor, int userId, int OtherUserId, int transactionId)
        {
            Comment newComment = new Comment(
                -1,
                comment,
                userId,
                commentor,
                transactionId,
                1,
                0,
                DateTime.Now,
                DateTime.Now
                );

            CommentHandler.createComment(newComment);

            return(Json(""));
        }
Exemple #8
0
        public void ConfigureCommentSettings()
        {
            if (!ContentReference.IsNullOrEmpty(this.CommentFolder))
            {
                return;
            }

            var contentRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <IContentRepository>();
            var newCommentFolder  = CommentHandler.AddNewCommentFolder(contentRepository, this);

            if (newCommentFolder == null)
            {
                return;
            }

            var editableNewsPage = this.CreateWritableClone() as NewsPage;

            editableNewsPage.CommentFolder = newCommentFolder.ContentLink;

            contentRepository.Save(editableNewsPage, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.Publish);
        }
Exemple #9
0
        public TransactionCommentModel(Transaction transaction, string userName)
        {
            Details         = new TransactionDetailModel(transaction);
            profile         = ProfileHandler.GetProfile(userName);
            UserId          = profile.ProfileId;
            UserDisplayName = profile.Name;
            UserFacebookId  = profile.FacebookId;

            if (UserId == transaction.BuyerId)
            {
                CounterPartyId = transaction.SellerId;
                UserAction     = ActionBy.Buyer;
            }
            else
            {
                CounterPartyId = transaction.BuyerId;
                UserAction     = ActionBy.Seller;
            }

            Profile counterPartyProfile = ProfileHandler.GetProfile(CounterPartyId);

            CounterPartyDisplayName = counterPartyProfile.Name;
            CounterPartyFacebookId  = counterPartyProfile.FacebookId;

            // load comments
            Comments = CommentHandler.getComments(transaction.TransactionId);
            foreach (Comment comment in Comments)
            {
                if (comment.UserId == UserId)
                {
                    comment.CommentByCurrentUser = true;
                }
                else
                {
                    comment.CommentByCurrentUser = false;
                }
            }
        }
Exemple #10
0
 void Gig_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Gig_CommentPosted);
 }
 public NewsPageController(CommentHandler handler)
 {
     this.handler = handler;
 }
Exemple #12
0
 public CommentController(CommentHandler commentHandler)
 {
     CommentHandler = commentHandler;
 }
Exemple #13
0
 /// <summary>
 /// 
 /// </summary>
 private void Gallery_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Gallery_CommentPosted);
     ItemDeleted += new ItemDeletedEventHandler(Gallery_ItemDeleted);
 }
Exemple #14
0
 void UserGroup_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(UserGroup_CommentPosted);
 }
Exemple #15
0
 void Musician_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Musician_CommentPosted);
 }
Exemple #16
0
 public GenericCommandResult Delete([FromBody] DeleteCommentCommand command, [FromServices] CommentHandler handler)
 {
     return((GenericCommandResult)handler.Handle(command));
 }
Exemple #17
0
 private void Event_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Event_CommentPosted);
 }
Exemple #18
0
 void GalleryItem_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(GalleryItem_CommentPosted);
     ItemDeleted += new ItemDeletedEventHandler(GalleryItem_ItemDeleted);
     ItemUpdated += new EventHandler(GalleryItem_ItemUpdated);
 }
Exemple #19
0
 private static void Send(Socket client, Comment data)
 {
     byte[] byteData = CommentHandler.ConvertCommentToByteArray(data);
     client.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), client);
 }
Exemple #20
0
 void Network_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Network_CommentPosted);
 }
Exemple #21
0
 void User_ItemLoad()
 {
     ItemUpdated += new EventHandler(User_ItemUpdated);
     ItemDeleted += new ItemDeletedEventHandler(User_ItemDeleted);
     OnCommentPosted += new CommentHandler(User_CommentPosted);
 }
Exemple #22
0
 void Release_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Release_CommentPosted);
 }
Exemple #23
0
        private static void ReceiveCallback(IAsyncResult ar)
        {
            try
            {
                if (TypeOfTheInfo == TypeOfInfo.User)
                {
                    ar.AsyncWaitHandle.WaitOne(2000);
                }
                if (TypeOfTheInfo == TypeOfInfo.Comment)
                {
                    ar.AsyncWaitHandle.WaitOne(2000);
                }
                StateObject state = (StateObject)ar.AsyncState;

                Socket client = state.workSocket;

                client.EndReceive(ar);

                switch (TypeOfTheInfo)
                {
                case TypeOfInfo.Films:
                {
                    films = FilmHandler.ConvertByteArrayToFilmList(state.buffer);
                    break;
                }

                case TypeOfInfo.Cinemas:
                {
                    cinemas = CinemaHandler.ConvertByteArrayToCinemaList(state.buffer);
                    break;
                }

                case TypeOfInfo.Users:
                {
                    users = UserHandler.ConvertByteArrayToUserList(state.buffer);
                    break;
                }

                case TypeOfInfo.User:
                {
                    flagUser = false;
                    break;
                }

                case TypeOfInfo.Favourites:
                {
                    favourites = FavouritesHandler.ConvertByteArrayToFavouritesList(state.buffer);
                    break;
                }

                case TypeOfInfo.Concerts:
                {
                    concerts = ConcertHandler.ConvertByteArrayToConcertList(state.buffer);
                    break;
                }

                case TypeOfInfo.Exhibitions:
                {
                    exhibitions = ExhibitionHandler.ConvertByteArrayToExhibitionList(state.buffer);
                    break;
                }

                case TypeOfInfo.Comments:
                {
                    comments = CommentHandler.ConvertByteArrayToCommentList(state.buffer);
                    break;
                }

                case TypeOfInfo.Favourite:
                {
                    flagFavourite = false;
                    break;
                }

                case TypeOfInfo.Comment:
                {
                    flagComment = false;
                    break;
                }

                default:
                {
                    break;
                }
                }

                receiveDone.Set();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Application application = Application.Current;
                application.Shutdown();
            }
        }
Exemple #24
0
 void Task_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Task_CommentPosted);
     if (percentageComplete == 100 || (TaskStatus)status == TaskStatus.Completed)
     {
         status = (byte)TaskStatus.Completed;
     }
     else if (UnixTime.UnixTimeStamp() > dueTimeRaw && (TaskStatus)status != TaskStatus.Overdue)
     {
         status = (byte)TaskStatus.Overdue;
     }
 }
Exemple #25
0
 /// <summary>
 /// ItemLoad event
 /// </summary>
 void BlogEntry_ItemLoad()
 {
     ItemUpdated += new EventHandler(BlogEntry_ItemUpdated);
     ItemDeleted += new ItemDeletedEventHandler(BlogEntry_ItemDeleted);
     OnCommentPosted += new CommentHandler(BlogEntry_CommentPosted);
 }
Exemple #26
0
 void Article_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Article_CommentPosted);
 }
Exemple #27
0
        private void cmdAddMarkers_Click(object sender, EventArgs e)
        {
            /* was a requirement, no longer
             * if (chkSkipLocked.CheckState == CheckState.Indeterminate)
             * {
             *  MessageBox.Show("Please select how to handle locked segments in the options first.", "Undefined option", MessageBoxButtons.OK, MessageBoxIcon.Information);
             *  return;
             * }
             */
            ClearEditor();
            Note("Processing...");
            UpdateSettingsFromUi();

            List <ProjectFile> translatableFiles = _filesController.SelectedFiles.Where(f => f.Role == FileRole.Translatable).ToList();

            if (translatableFiles.Count == 0)
            {
                Note("No translatable files are selected");
            }
            Shuffle(translatableFiles);

            List <ProjectFile> validFiles         = new List <ProjectFile>();
            List <string>      alreadyMarkedFiles = new List <string>();
            bool addedMarkers = false;

            int totalSelectedWords = 0;
            int totalSegments      = 0;

            int    totalWords = 0;
            double fraction   = 1;


            if (_settings.LimitByWords)
            {
                foreach (ProjectFile file in translatableFiles)
                {
                    // When a file is first opened, need to trigger word count
                    if (file.AnalysisStatistics.Total.Words == 0)
                    {
                        _projectsController.CurrentProject.RunAutomaticTask(new Guid[] { file.Id }, AutomaticTaskTemplateIds.WordCount);
                    }
                }
                // for some weird reason, the word count statistics are not updated unless
                // we jump through the hoop of reselecting the files
                translatableFiles = _filesController.SelectedFiles.Where(f => f.Role == FileRole.Translatable).ToList();
                foreach (ProjectFile file in translatableFiles)
                {
                    totalWords += file.AnalysisStatistics.Total.Words;
                }
                fraction = (double)totalWords / _settings.TotalWords;
            }

            int requestedWords = _settings.TotalWords;

            foreach (ProjectFile file in translatableFiles)
            {
                _processor.Open(file.LocalFilePath);
                if (CommentHandler.ContainsComments(file.LocalFilePath))
                {
                    string fileName = Path.GetFileNameWithoutExtension(file.LocalFilePath);
                    alreadyMarkedFiles.Add(fileName);
                }
                else
                {
                    if (_settings.LimitByWords)
                    {
                        _settings.TotalWords = (int)(file.AnalysisStatistics.Total.Words / fraction);
                    }
                    bool addedThisFile = _processor.AddMarkers(_settings);
                    totalSegments += _processor.Segments;
                    addedMarkers   = addedMarkers || addedThisFile;
                    if (addedThisFile)
                    {
                        validFiles.Add(file);
                    }
                    if (_settings.LimitByWords)
                    {
                        totalSelectedWords += _processor.Words;
                        if (totalSelectedWords > requestedWords)
                        {
                            _processor.Close();
                            break;
                        }
                    }
                }
                _processor.Close();
            }
            if (_settings.LimitByWords)
            {
                Note($"Selected {totalSelectedWords} words in {totalSegments} segments.");
            }
            else
            {
                Note($"Selected {totalSegments} segments.");
            }

            if (alreadyMarkedFiles.Count > 0)
            {
                if (alreadyMarkedFiles.Count == 1)
                {
                    Note("This file does already contain markers: " + alreadyMarkedFiles[0]);
                }
                else
                {
                    Note("These files do already contain markers: " + string.Join(", ", alreadyMarkedFiles.ToArray()));
                }
            }

            if (validFiles.Count > 0)
            {
                if (!addedMarkers)
                {
                    Note("No segment could be found that matches the settings.");
                }
                else
                {
                    // was a requirement, no longer
                    // chkSkipLocked.CheckState = CheckState.Indeterminate;
                    _editorController.Open(validFiles, EditingMode.Review);
                }
            }
            else
            {
                ClearNotes();
            }
            // was a requirement, no longer
            // chkSkipLocked.CheckState = CheckState.Indeterminate;
        }
 private void ApplicationEntry_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(ApplicationEntry_CommentPosted);
 }