private void InsolAddressBtn_Click(object sender, RibbonControlEventArgs e) { try { ClientForm myClientForm = new ClientForm(); myClientForm.ShowDialog(); XLMain.Client client = myClientForm.selectedClient; IPSContForm myForm = new IPSContForm(client); myForm.ShowDialog(); XLInsol.Contact selectContact = myForm.selectedContact; if (selectContact != null) { string str = selectContact.name + Environment.NewLine; str += selectContact.addressBlock; XLDocument.InsertText(str); //XLDocument.AddStatusBox(); //XLDocument.ChangeStatus("Draft"); } else { MessageBox.Show("No contact selected."); } } catch (Exception ex) { MessageBox.Show("Unable to get insolvency address"); XLtools.LogException("InsolAddressBtn", ex.ToString()); } }
private void LaunchClientDoc(string docType) { try { ClientForm myForm = new ClientForm(); myForm.ShowDialog(); XLMain.Client selectedClient = myForm.selectedClient; if (selectedClient != null) { string crmId = selectedClient.crmID; XLDocument.openTemplate(docType); XLDocument.UpdateParameter("CRMid", crmId); XLDocument.UpdateParameter("DocType", docType); //this appears to work in 3.5 notwithstanding the reference to Globals xlTaskPane1 = new XLTaskPane(); CustomxlTaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(xlTaskPane1, "XLant Document Handler", Globals.ThisAddIn.Application.ActiveWindow); CustomxlTaskPane.Visible = true; CustomxlTaskPane.Width = 350; } } catch (Exception e) { MessageBox.Show("Unable to launch document"); XLtools.LogException("LaunchClientDoc", docType + " - " + e.ToString()); } }
private void ClientListBox_SelectedIndexChanged(object sender, EventArgs e) { EntityCouplet selectedItem = (EntityCouplet)ClientListBox.SelectedItem; selectedClient = XLMain.Client.FetchClient(selectedItem.crmID); this.Close(); }
public VCForm(XLMain.Staff writer, XLMain.Client client, string docPath, string desc = "", string status = "Draft") { InitializeComponent(); this.CenterToParent(); XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName); DescTB.Text = desc; //populate the sender List <XLMain.Staff> users = XLtools.StaffList(user, client, true); ToBeActionDDL.DataSource = users; ToBeActionDDL.DisplayMember = "name"; ToBeActionDDL.ValueMember = "crmID"; if (writer != null) { ToBeActionDDL.SelectedItem = writer; } if (client.department != "INS") { FileSectionDDL.Visible = false; FileSectionlbl.Visible = false; } else { FileSectionDDL.Visible = true; FileSectionlbl.Visible = true; } }
private void IndexBtn_Click(object sender, RibbonControlEventArgs e) { try { XLDocument.currentDoc.Save(); //populate description string desc = XLDocument.ReadParameter("DocType"); desc += " to "; desc += XLDocument.ReadBookmark("Addressee"); string str = XLDocument.ReadParameter("CRMid"); XLMain.Client client = new XLMain.Client(); if (str != "") { client = XLMain.Client.FetchClient(str); } else { ClientForm cForm = new ClientForm(); cForm.ShowDialog(); client = cForm.selectedClient; } 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")); } VCForm myForm = new VCForm(writer, client, XLDocument.currentDoc.FullName, desc, XLDocument.ReadParameter("VCStatus")); myForm.ShowDialog(); //collect result from form XLVirtualCabinet.BondResult outcome = myForm.outcome; if (outcome.ExitCode == 0) { XLDocument.EndDocument(); xlTaskPane1.Dispose(); } else { MessageBox.Show("Unable to index document, please index manually. Error code: " + outcome.ExitCode.ToString() + "-" + outcome.StandardOutput.ToString()); } //close the dialog in any event. } catch (Exception ex) { MessageBox.Show("Error calling the VC integration. Error code: " + ex.ToString()); XLtools.LogException("IndexBtn", ex.ToString()); } }
private void BioBtn_Click(object sender, RibbonControlEventArgs e) { XLForms.ClientForm selectForm = new ClientForm(); selectForm.ShowDialog(); XLMain.Client client = selectForm.selectedClient; MergeClient bioClient = new MergeClient(client); XLDocument.UpdateCurrentDoc(); Range range = XLDocument.currentDoc.Range(); XLDocument.UpdateFieldsFromRange(range, bioClient); }
private void InvoiceBtn_Click(object sender, RibbonControlEventArgs e) { XLForms.ClientForm clientForm = new XLForms.ClientForm(); clientForm.ShowDialog(); if (clientForm.selectedClient != null) { XLMain.Client client = clientForm.selectedClient; XLMain.FPIClient fpiClient = XLMain.FPIClient.GetFPIClientInvoice(client); List <XLMain.FPIClient> clientList = new List <XLMain.FPIClient>(); clientList.Add(fpiClient); XLDocument.MergeFPIData(clientList.OrderBy(c => c.office).ToList()); } }
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()); } }
private static string OurRef(XLMain.Client client, XLMain.Staff sender, XLMain.Staff user) { try { string ourRef = ""; ourRef = client.clientcode; if (client.partner != null) { ourRef += @"/" + client.partner.initials.ToUpper(); } if (client.manager != null) { ourRef += @"/" + client.manager.initials.ToUpper(); } if (sender.crmID == "") { if (sender.name != client.partner.name) { if (sender.name != client.manager.name) { ourRef += @"/" + sender.initials.ToUpper(); } } } if (user.name != client.partner.name) { if (user.name != client.manager.name) { if (user.name != sender.name) { ourRef += @"/" + user.initials.ToLower(); } } } return(ourRef); } catch (Exception ex) { MessageBox.Show("Unable to build reference"); XLtools.LogException("OurRef", ex.ToString()); return(null); } }
private void Merge4Btn_Click(object sender, RibbonControlEventArgs e) { XLForms.ClientForm clientForm = new XLForms.ClientForm(); clientForm.ShowDialog(); if (clientForm.selectedClient != null) { XLMain.Client client = clientForm.selectedClient; List <XLMain.FPIClient> clients = XLMain.FPIClient.GetFPIClients(client); if (clients.Count > 0) { XLDocument.MergeFPIData(clients.OrderBy(c => c.office).ToList()); } else { MessageBox.Show("No clients founds to merge."); } } }
public ForwardForm() { InitializeComponent(); this.CenterToParent(); XLMain.Client client = new XLMain.Client(); XLMain.Staff staff = new XLMain.Staff(); //populate To Be Actioned by staff = XLMain.Staff.StaffFromUser(XLDocument.ReadParameter("Sender")); string str = XLDocument.ReadParameter("CRMid"); client = XLMain.Client.FetchClient(str); //populate the sender List <XLMain.Staff> users = new List <XLMain.Staff>(); users = XLMain.Staff.AllStaff(); //place current and connected users at the top of the list, could remove them elsewhere but seems no point if (staff != null) { users.Insert(0, staff); } if (client.partner != null) { users.Insert(1, client.partner); } if (client.manager != null) { users.Insert(2, client.manager); } //users.Insert(3, client.other); Other not yet part of client ToBeActionDDL.DataSource = users; ToBeActionDDL.DisplayMember = "name"; ToBeActionDDL.ValueMember = "crmID"; if (staff != null) { ToBeActionDDL.SelectedItem = staff; } }
private static void DeploySignature(XLMain.Client client, XLMain.Staff sender, string salutation) { try { //set yours faithfully/Sincerely if (salutation == "" || salutation == "Sir" || salutation == "Madam" || salutation == "Sirs") { XLDocument.UpdateBookmark("FaithSincere", "Yours faithfully"); } else { XLDocument.UpdateBookmark("FaithSincere", "Yours sincerely"); } //dependant on department build and deploy signature block if (client.department == "INS") { if (sender.crmID == "") { XLDocument.UpdateBookmark("Sender", sender.name); XLDocument.UpdateBookmark("Sender2", sender.name); } else { XLInsol.KeyData data = XLInsol.KeyData.FetchKeyData(client.crmID); string str = sender.name; if (data.sign != null && data.sign != "" && data.sign != sender.name) { str += Environment.NewLine + "For " + data.sign; } XLDocument.UpdateBookmark("Sender", str); XLDocument.UpdateBookmark("Sender2", sender.name); if (data.sign != null && data.sign != "") { if (data.caseType == "IVA" || data.caseType == "CVA") { str = data.title + " to the voluntary arrangement of"; } else { str = data.title; } str += Environment.NewLine + client.name; XLDocument.UpdateBookmark("FAOBOML", str); } } } else { if (sender.crmID == "") { XLDocument.UpdateBookmark("Sender", sender.name); XLDocument.UpdateBookmark("Sender2", sender.name); } else { string title = XLMain.Staff.GetJobTitle(sender); string sndr = ""; sndr = sender.name; sndr += Environment.NewLine + title; XLDocument.UpdateBookmark("Sender", sndr); XLDocument.UpdateBookmark("Sender2", sender.name); //if (sender.emails != null) //{ // XLDocument.UpdateBookmark("SenderEmail", "email: " + sender.emails[0].email.ToLower(), bold: 1, styleName: "ML Main"); //} //else //{ // XLDocument.UpdateBookmark("SenderEmail", ""); //} } } } catch (Exception ex) { MessageBox.Show("Unable to deploy signature"); XLtools.LogException("DeploySignature", ex.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()); } }