Esempio n. 1
0
        private void btnView_Click(object sender, EventArgs e)
        {
            if (dgvIssueList.SelectedRows.Count <= 0)
            {
                return;
            }

            var selectedRow = dgvIssueList.SelectedRows;

            var Location = selectedRow[0].Cells["Location"].Value.ToString();
            var FileName = selectedRow[0].Cells["FileName"].Value.ToString();

            string filePathName =
                Utils.getFilePathName(Location,
                                      FileName);


            if (!string.IsNullOrEmpty(filePathName))
            {
                WordDocumentTasks.OpenDocument(filePathName, vkReadOnly: true);
            }
            else
            {
                MessageBox.Show(@"Document is empty.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Open document
        /// </summary>
        /// <param name="document"></param>
        /// <param name="vkReadOnly"></param>
        /// <param name="isFromWeb"></param>
        public static void OpenDocument(Model.ModelDocument.Document document, object vkReadOnly, bool isFromWeb)
        {
            if (document.DocumentType == MackkadoITFramework.Helper.Utils.DocumentType.WORD)
            {
                string filePathName =
                    Utils.getFilePathName(document.Location,
                                          document.Name);

                WordDocumentTasks.OpenDocument(filePathName, vkReadOnly, isFromWeb);
            }
        }
Esempio n. 3
0
File: Utils.cs Progetto: DR2010/FCM2
        ///// <summary>
        ///// Open document for Document type
        ///// </summary>
        ///// <param name="document"></param>
        //public static void OpenDocument(Document.Document document, object vkReadOnly)
        //{
        //    if (document.DocumentType == Utils.DocumentType.WORD)
        //    {
        //        string filePathName =
        //            Utils.getFilePathName(document.Location,
        //                                  document.Name );

        //        WordDocumentTasks.OpenDocument(filePathName, vkReadOnly);
        //    }

        //}

        // Open document for Location and Name
        //
        public static ResponseStatus OpenDocument(string Location, string Name, string Type, object vkReadOnly, bool isFromWeb)
        {
            if (Type == DocumentType.WORD)
            {
                string filePathName =
                    getFilePathName(Location,
                                    Name);

                var response = WordDocumentTasks.OpenDocument(filePathName, vkReadOnly, isFromWeb);

                if (response.ReturnCode < 1)
                {
                    return(response);
                }
            }

            if (Type == DocumentType.EXCEL)
            {
                string filePathName =
                    getFilePathName(Location,
                                    Name);

                var response = ExcelSpreadsheetTasks.OpenDocument(filePathName);
                if (response.ReturnCode < 1)
                {
                    return(response);
                }
            }
            if (Type == DocumentType.PDF)
            {
                string filePathName =
                    getFilePathName(Location,
                                    Name);
                Process proc  = new Process();
                var     adobe = CodeValue.GetCodeValueExtended(iCodeType: MakConstant.CodeTypeString.SYSTSET, iCodeValueID: "PDFEXEPATH");

                if (!File.Exists(adobe))
                {
                    MessageBox.Show("I can't find Adobe Reader. Please configure SYSTSET.PDFEXTPATH.");

                    var error = new ResponseStatus(MessageType.Error);
                    error.Message = "Adobe Reader can't be found. Please configure SYSTSET.PDFEXTPATH.";
                    return(error);
                }

                proc.StartInfo.FileName  = adobe;
                proc.StartInfo.Arguments = filePathName;
                proc.Start();
            }

            return(new ResponseStatus(MessageType.Informational));
        }
Esempio n. 4
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            string filePathName =
                Utils.getFilePathName(txtLocation.Text,
                                      txtFileName.Text);

            if (!File.Exists(filePathName))
            {
                MessageBox.Show("Document not generated. " + filePathName);
                return;
            }

            WordDocumentTasks.OpenDocument(filePathName, vkReadOnly: false);
        }
Esempio n. 5
0
        // Open document for Location and Name
        //
        public static void OpenDocument(string Location, string Name, string Type, object vkReadOnly, bool isFromWeb = false)
        {
            if (Type == MackkadoITFramework.Helper.Utils.DocumentType.WORD)
            {
                string filePathName =
                    Utils.getFilePathName(Location,
                                          Name);

                WordDocumentTasks.OpenDocument(filePathName, vkReadOnly, isFromWeb);
            }

            if (Type == MackkadoITFramework.Helper.Utils.DocumentType.EXCEL)
            {
                string filePathName =
                    Utils.getFilePathName(Location,
                                          Name);

                var Response = ExcelSpreadsheetTasks.OpenDocument(filePathName);
                if (Response.ReturnCode < 1)
                {
                    MessageBox.Show(Response.Message);
                }
            }
            if (Type == MackkadoITFramework.Helper.Utils.DocumentType.PDF)
            {
                string filePathName =
                    Utils.getFilePathName(Location,
                                          Name);
                System.Diagnostics.Process proc = new System.Diagnostics.Process();
                var adobe = CodeValue.GetCodeValueExtended(iCodeType: FCMConstant.CodeTypeString.SYSTSET, iCodeValueID: "PDFEXEPATH");

                if (!File.Exists(adobe))
                {
                    MessageBox.Show("I can't find Adobe Reader. Please configure SYSTSET.PDFEXTPATH.");
                    return;
                }

                proc.StartInfo.FileName  = adobe;
                proc.StartInfo.Arguments = filePathName;
                proc.Start();
            }
        }