private void IndexBtn_Click(object sender, EventArgs e) { string fullPath = docPath; string cabinet = XLVirtualCabinet.FileStore(client.manager.office, client.department); string clientStr = client.clientcode + " - " + client.name; XLMain.Staff toBe = (XLMain.Staff)ToBeActionDDL.SelectedItem; string desc = DescTB.Text; string section = ""; if (client.department != "INS") { section = "Correspondence"; } else { section = FileSectionDDL.SelectedItem.ToString(); } //Launch the index process and collect the result XLVirtualCabinet.BondResult outcome = XLVirtualCabinet.IndexDocument(fullPath, cabinet, clientStr, status, toBe.name, section, desc); if (outcome.ExitCode == 0) { XLDocument.EndDocument(); } else { MessageBox.Show("Unable to index document, please index manually. Error code: " + outcome.ExitCode.ToString() + "-" + outcome.StandardOutput.ToString()); } //close the dialog in any event. this.Close(); }
private void ClientAddressBtn_Click(object sender, RibbonControlEventArgs e) { try { ClientForm myForm = new ClientForm(); myForm.ShowDialog(); XLMain.Client client = myForm.selectedClient; //Add the name and address at the cursor location string str = ""; if (client.addresses.Count > 0) { if (client.salutations.Count > 0) { str += client.salutations[0].addressee + Environment.NewLine; if (client.name != client.salutations[0].addressee) { str += client.name + Environment.NewLine; } } else { str += client.name + Environment.NewLine; } str += client.addresses[0].addressBlock; XLDocument.InsertText(str); //Add any parameters we can for later indexing string fileStore = XLVirtualCabinet.FileStore(client.office, client.department); XLDocument.UpdateParameter("CRMid", client.crmID); XLDocument.UpdateParameter("Cabinet", fileStore); XLDocument.UpdateParameter("ClientStr", client.clientcode + " - " + client.name); //insert the status text box; //XLDocument.AddStatusBox(); //XLDocument.ChangeStatus("Draft"); } else { MessageBox.Show(client.name + " does not have an address in the system."); } } catch (Exception ex) { MessageBox.Show("Unable to client address"); XLtools.LogException("ClientAddressBtn", ex.ToString()); } }
public static void IndexPDFCopy(string filestring, string origFileID) { try { //get the info of the original file XLVirtualCabinet.FileInfo fileInfo = XLVirtualCabinet.FileIndex(origFileID); XLVirtualCabinet.BondResult result = XLVirtualCabinet.IndexDocument(filestring, fileInfo); if (result.ExitCode != 0) { MessageBox.Show("Unable to index pdf, please index manually. Error code: " + result.ExitCode.ToString() + "-" + result.StandardOutput.ToString()); } } catch (Exception e) { MessageBox.Show("Unable to index pdf document" + filestring); XLtools.LogException("IndexPDFCopy", e.ToString()); } }
public XLTaskPane() { try { InitializeComponent(); string str = XLDocument.ReadParameter("CRMid"); docType = XLDocument.ReadParameter("DocType"); client = XLMain.Client.FetchClient(str); //ClientIDLabel.Text = client.crmID; user = XLMain.Staff.StaffFromUser(Environment.UserName); users = XLtools.StaffList(user, client, false, true); SenderDDL.DataSource = users; SenderDDL.DisplayMember = "name"; SenderDDL.ValueMember = "crmID"; SenderDDL.SelectedItem = user; sender = user; XLDocument.UpdateParameter("Sender", sender.username); if (client != null) { //set basic client info string clientStr = client.clientcode + " - " + client.name; ClientLbl.Text = clientStr; SubjectTB.Text = client.name; string fileStore = XLVirtualCabinet.FileStore(client.manager.office, client.department); XLDocument.UpdateParameter("Cabinet", fileStore); XLDocument.UpdateParameter("ClientStr", clientStr); //Deal with salutations if (client.salutations != null) { SalDDL.DataSource = client.salutations; SalDDL.DisplayMember = "Salutation"; SalDDL.ValueMember = "Addressee"; sal = (XLMain.Salutation)SalDDL.SelectedItem; if (sal != null) { AddresseeTB.Text = sal.addressee; SalutationTb.Text = sal.salutation; } } //Add the appropriate header XLDocument.Header clientHeader = XLDocument.MapHeader(client.office, client.department); //Set up depending on whether it is insolvency or not if (client.department == "INS") { //Deal with when calling ddl WhencallingDDL.DataSource = users; WhencallingDDL.DisplayMember = "name"; WhencallingDDL.ValueMember = "crmID"; WhenCallingCheck.Checked = true; SubjectTB.Text = XLInsol.GetSubject(client.crmID); } else { FAOBCheck.Checked = true; PandCCheck.Checked = true; WhenCallingCheck.Checked = false; } //Deal with addresses or fax no as appropriate if (docType == "Letter") { if (client.addresses != null) { allAddresses = client.addresses; addressesDDL.DataSource = allAddresses; addressesDDL.DisplayMember = "address1"; addressesDDL.ValueMember = "addressBlock"; add = (XLMain.Address)addressesDDL.SelectedItem; if (add != null) { if (client.IsIndividual) { addTB.Text = add.addressBlock; } else { addTB.Text = client.name + Environment.NewLine + add.addressBlock; } } } if (clientHeader != null) { try { XLDocument.DeployHeader(clientHeader); } catch { MessageBox.Show("Unable to map header automatically." + Environment.NewLine + "Please run the Header/Footer menu."); } } } else if (docType == "Fax") { XLMain.Number fax = XLMain.Number.GetNumber(client.crmID, "Fax"); if (fax != null) { FaxTB.Text = fax.number; } if (clientHeader != null) { try { XLDocument.DeployHeader(clientHeader); } catch { MessageBox.Show("Unable to map header automatically." + Environment.NewLine + "Please run the Header/Footer menu."); } } } //set status XLDocument.ChangeStatus("Draft"); //Alter fields dependant on doc type; SetVisibility(docType); if (client.department == "INS") { WhencallingDDL.Visible = true; IPSContactBtn.Visible = true; } //Update bookmarks dependant on doc type UpdateBookmarks(docType); } } catch (Exception ex) { MessageBox.Show("Unable to open taskpane"); XLtools.LogException("TaskPane", ex.ToString()); } }
private void ApproveBtn_Click(object sender, RibbonControlEventArgs e) { try { Microsoft.Office.Interop.Word._Application app = Globals.ThisAddIn.Application; XLDocument.ChangeStatus("Approved"); XLMain.Client client = null; string fileID = XLDocument.GetFileID(); if (String.IsNullOrEmpty(fileID)) { return; } if (XLDocument.ReadParameter("CRMid") != null) { client = XLMain.Client.FetchClient(XLDocument.ReadParameter("CRMid")); } else { //if the document param doesn't exist get the index data from VC client = XLVirtualCabinet.GetClientFromIndex(fileID); } XLMain.Staff writer = new XLMain.Staff(); string writerID = XLDocument.ReadParameter("Sender"); if (writerID == "") { writer = XLMain.Staff.StaffFromUser(Environment.UserName); } else { writer = XLMain.Staff.StaffFromUser(XLDocument.ReadParameter("Sender")); } StaffSelectForm myForm = new XLForms.StaffSelectForm(client, writer); myForm.ShowDialog(); XLMain.EntityCouplet staff = myForm.selectedStaff; if (myForm.DialogResult == DialogResult.OK) { if (staff == null) { //make blank if no staff selected staff.name = ""; } string commandfileloc = ""; if (XLDocument.ReadBookmark("Date") == "") { commandfileloc = XLVirtualCabinet.Reindex(fileID, staff.name, XLDocument.ReadParameter("VCStatus")); } else { string docDate = XLDocument.ReadBookmark("Date"); commandfileloc = XLVirtualCabinet.Reindex(fileID, staff.name, XLDocument.ReadParameter("VCStatus"), docDate); } XLVirtualCabinet.BondResult result = XLVirtualCabinet.LaunchCabi(commandfileloc, true); if (result.ExitCode != 0) { MessageBox.Show("Reindex failed please complete manually"); } else { app.ActiveDocument.Save(); app.ActiveWindow.Close(); } } } catch (Exception ex) { MessageBox.Show("Unable to approve document"); XLtools.LogException("ApproveBtn", ex.ToString()); } }
private void ForwardBtn_Click(object sender, RibbonControlEventArgs e) { try { XLMain.Client client = null; string fileID = XLDocument.GetFileID(); if (String.IsNullOrEmpty(fileID)) { return; } if (XLDocument.ReadParameter("CRMid") != null) { client = XLMain.Client.FetchClient(XLDocument.ReadParameter("CRMid")); } else { //if the document param doesn't exist get the index data from VC client = XLVirtualCabinet.GetClientFromIndex(fileID); } XLMain.Staff writer = new XLMain.Staff(); string writerID = XLDocument.ReadParameter("Sender"); if (writerID == "") { writer = XLMain.Staff.StaffFromUser(Environment.UserName); } else { writer = XLMain.Staff.StaffFromUser(XLDocument.ReadParameter("Sender")); } StaffSelectForm myForm = new StaffSelectForm(client, writer); myForm.ShowDialog(); XLMain.EntityCouplet staff = myForm.selectedStaff; string commandfileloc = ""; if (XLDocument.ReadBookmark("Date") == "") { commandfileloc = XLVirtualCabinet.Reindex(XLDocument.GetFileID(), staff.name); } else { string docDate = XLDocument.ReadBookmark("Date"); commandfileloc = XLVirtualCabinet.Reindex(XLDocument.GetFileID(), staff.name, docDate: docDate); } //MessageBox.Show(commandfileloc); XLVirtualCabinet.BondResult result = XLVirtualCabinet.LaunchCabi(commandfileloc, true); if (result.ExitCode != 0) { MessageBox.Show("Reindex failed please complete manually."); } else { XLDocument.EndDocument(); } } catch (Exception ex) { MessageBox.Show("Unable to forward document"); XLtools.LogException("ForwardBtn", ex.ToString()); } }