/// <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); } }
/// <summary> /// Get Logo location for a client. /// </summary> /// <param name="clientUID"></param> /// <returns></returns> public static string GetImageUrl(string DocumentType, string curEnvironment = MackkadoITFramework.Helper.Utils.EnvironmentList.LOCAL) { string image = ""; string logoPath = ""; string logoName = ""; string logoPathName = ""; Utils.FCMenvironment = curEnvironment; switch (DocumentType) { case MackkadoITFramework.Helper.Utils.DocumentType.WORD: logoName = FCMConstant.ImageFileName.Document; break; case MackkadoITFramework.Helper.Utils.DocumentType.EXCEL: logoName = FCMConstant.ImageFileName.Excel; break; case MackkadoITFramework.Helper.Utils.DocumentType.FOLDER: logoName = FCMConstant.ImageFileName.Folder; break; case MackkadoITFramework.Helper.Utils.DocumentType.PDF: logoName = FCMConstant.ImageFileName.PDF; break; default: logoName = FCMConstant.ImageFileName.Document; break; } // Set no icon image if necessary // logoPath = FCMConstant.SYSFOLDER.LOGOFOLDER; logoName = logoName.Replace(FCMConstant.SYSFOLDER.LOGOFOLDER, string.Empty); logoPathName = Utils.getFilePathName(logoPath, logoName); return(logoPathName); }
// 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(); } }
private void locateInExplorerToolStripMenuItem_Click(object sender, EventArgs e) { // // Get selected document from tree // TreeNode docSelected = tvFileList.SelectedNode; var rm = new Document(); if (docSelected == null) { return; } rm = (Document)docSelected.Tag; // Cast // Show file dialog string filePathName = Utils.getFilePathName(rm.Location, rm.FileName); string filePath = Utils.GetPathName(rm.Location); openFileDialog1.FileName = rm.FileName; openFileDialog1.InitialDirectory = filePath; var file = openFileDialog1.ShowDialog(); }
private void btnAddNewClient_Click(object sender, EventArgs e) { txtABN.Text = ""; txtAddress.Text = ""; txtContactPerson.Text = ""; txtEmailAddress.Text = ""; txtFax.Text = ""; txtName.Text = ""; txtPhone.Text = ""; txtUID.Text = ""; cbxAssociateInitialSet.Checked = false; comboContractorSize.Text = ""; comboUserID.Text = ""; Bitmap MyImage; pbxLogo.SizeMode = PictureBoxSizeMode.StretchImage; string filePathName = Utils.getFilePathName(FCMConstant.SYSFOLDER.LOGOFOLDER, "imgNoImage.jpg"); MyImage = new Bitmap(filePathName); pbxLogo.Image = (Image)MyImage; Utils.ClientID = 0; }
private void sendEmailToolStripMenuItem_Click(object sender, EventArgs e) { var answer = MessageBox.Show("Would you like to send emails to impacted clients?", "Send email", MessageBoxButtons.YesNo); if (answer != DialogResult.Yes) { return; } Cursor.Current = Cursors.WaitCursor; List <Client> listOfClients = new List <Client>(); // Get file name // string filePathName = Utils.getFilePathName( document.Location, document.FileName); if (!File.Exists(filePathName)) { MessageBox.Show("File not found. " + filePathName); return; } // Select client to send email and show before send // var impacted = new ClientDocument(); // impacted.ListImpacted(document); BUSClientDocument.ListImpacted(impacted, document); foreach (var doco in impacted.clientDocSetDocLink) { var response = BUSClientContract.GetValidContractOnDate(doco.clientDocument.FKClientUID, System.DateTime.Today); if (response.ReturnCode == 0001 && response.ReasonCode == 0001) { //Client client = new Client(HeaderInfo.Instance); //client.UID = doco.clientDocument.FKClientUID; ClientReadRequest crr = new ClientReadRequest(); crr.clientUID = doco.clientDocument.FKClientUID; crr.headerInfo = HeaderInfo.Instance; var busClientResponse = BUSClient.ClientRead(crr); //var busClientResponse = client.Read(); listOfClients.Add(busClientResponse.client); } } if (listOfClients.Count <= 0) { return; } string subject = "Document updated"; string body = "The document " + document.Name + " has been updated."; var resp = SendEmailToGroup( clientList: listOfClients, iSubject: subject, iBody: body, Attachment: filePathName); MessageBox.Show(resp.Message); Cursor.Current = Cursors.Arrow; }