コード例 #1
0
        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();
        }
コード例 #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()));
コード例 #3
0
ファイル: Global.asax.cs プロジェクト: hw3jung/Chanel
 public void DailyTask()
 {
     try
     {
         CommentHandler.commentReminderMail();
         TransactionHandler.AutoConfirmTransaction();
     }
     catch (Exception ex)
     {
         Console.Write("error sending scheduled emails");
     }
 }
コード例 #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();
            }
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #7
0
        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(""));
        }
コード例 #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);
        }
コード例 #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;
                }
            }
        }
コード例 #10
0
ファイル: Gig.cs プロジェクト: smithydll/boxsocial
 void Gig_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Gig_CommentPosted);
 }
コード例 #11
0
 public NewsPageController(CommentHandler handler)
 {
     this.handler = handler;
 }
コード例 #12
0
 public CommentController(CommentHandler commentHandler)
 {
     CommentHandler = commentHandler;
 }
コード例 #13
0
ファイル: Gallery.cs プロジェクト: smithydll/boxsocial
 /// <summary>
 /// 
 /// </summary>
 private void Gallery_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Gallery_CommentPosted);
     ItemDeleted += new ItemDeletedEventHandler(Gallery_ItemDeleted);
 }
コード例 #14
0
ファイル: Group.cs プロジェクト: smithydll/boxsocial
 void UserGroup_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(UserGroup_CommentPosted);
 }
コード例 #15
0
ファイル: Musician.cs プロジェクト: smithydll/boxsocial
 void Musician_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Musician_CommentPosted);
 }
コード例 #16
0
 public GenericCommandResult Delete([FromBody] DeleteCommentCommand command, [FromServices] CommentHandler handler)
 {
     return((GenericCommandResult)handler.Handle(command));
 }
コード例 #17
0
ファイル: Event.cs プロジェクト: smithydll/boxsocial
 private void Event_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Event_CommentPosted);
 }
コード例 #18
0
ファイル: GalleryItem.cs プロジェクト: smithydll/boxsocial
 void GalleryItem_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(GalleryItem_CommentPosted);
     ItemDeleted += new ItemDeletedEventHandler(GalleryItem_ItemDeleted);
     ItemUpdated += new EventHandler(GalleryItem_ItemUpdated);
 }
コード例 #19
0
ファイル: AsyncClient.cs プロジェクト: andreichayeuski/Foxter
 private static void Send(Socket client, Comment data)
 {
     byte[] byteData = CommentHandler.ConvertCommentToByteArray(data);
     client.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), client);
 }
コード例 #20
0
ファイル: Network.cs プロジェクト: smithydll/boxsocial
 void Network_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Network_CommentPosted);
 }
コード例 #21
0
ファイル: User.cs プロジェクト: smithydll/boxsocial
 void User_ItemLoad()
 {
     ItemUpdated += new EventHandler(User_ItemUpdated);
     ItemDeleted += new ItemDeletedEventHandler(User_ItemDeleted);
     OnCommentPosted += new CommentHandler(User_CommentPosted);
 }
コード例 #22
0
ファイル: Release.cs プロジェクト: smithydll/boxsocial
 void Release_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Release_CommentPosted);
 }
コード例 #23
0
ファイル: AsyncClient.cs プロジェクト: andreichayeuski/Foxter
        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();
            }
        }
コード例 #24
0
ファイル: Task.cs プロジェクト: smithydll/boxsocial
 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;
     }
 }
コード例 #25
0
ファイル: BlogEntry.cs プロジェクト: smithydll/boxsocial
 /// <summary>
 /// ItemLoad event
 /// </summary>
 void BlogEntry_ItemLoad()
 {
     ItemUpdated += new EventHandler(BlogEntry_ItemUpdated);
     ItemDeleted += new ItemDeletedEventHandler(BlogEntry_ItemDeleted);
     OnCommentPosted += new CommentHandler(BlogEntry_CommentPosted);
 }
コード例 #26
0
ファイル: Article.cs プロジェクト: smithydll/boxsocial
 void Article_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(Article_CommentPosted);
 }
コード例 #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;
        }
コード例 #28
0
 private void ApplicationEntry_ItemLoad()
 {
     OnCommentPosted += new CommentHandler(ApplicationEntry_CommentPosted);
 }