コード例 #1
0
        private void versionsGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == (int)GridActionsControlCodes.Open)
                {
                    DocumentVersionDTO documentVersion = (DocumentVersionDTO)documentVersionDTOBindingSource[e.RowIndex];

                    saveFileDialog.FileName = documentDto.Title;
                    saveFileDialog.Filter   = String.Format("Dokument (*.{0})|*.{0}", documentDto.Extension);

                    DialogResult result = saveFileDialog.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        _filesService.LoadFileFromServer(documentVersion.FilePath, saveFileDialog.FileName);
                    }

                    return;
                }
                if (e.ColumnIndex == (int)GridActionsControlCodes.SeeComments)
                {
                    this.commentsPanel.Visible = true;
                    DocumentVersionDTO documentVersion = (DocumentVersionDTO)documentVersionDTOBindingSource[e.RowIndex];
                    LoadComments(documentVersion.Id);
                    return;
                }
            }
            catch (Exception ex)
            {
                BusinessServiceBase.logger.Error(ex.Message);
            }
        }
コード例 #2
0
        private void btnOpenForRead_Click(object sender, EventArgs e)
        {
            this.lblError.Text = String.Empty;

            if (!_formsService.DocumentsService.TryOpenDocumentForReading(documentDto.Id, _formsService.GetLoggedUser().Id))
            {
                this.lblError.Text = "Drugi korisnik trenutno piše nad ovim dokumentom.";
                return;
            }

            saveFileDialog.FileName = documentDto.Title;
            saveFileDialog.Filter   = String.Format("Dokument (*.{0})|*.{0}", documentDto.Extension);

            DialogResult result = saveFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string filePath = _formsService.DocumentsService.GetLastDocumentVersionFilePath(documentDto.Id);
                _filesService.LoadFileFromServer(filePath, saveFileDialog.FileName);

                SetOpenedForReadView();
            }
        }