Exemple #1
0
        private void Merge3Btn_Click(object sender, RibbonControlEventArgs e)
        {
            XLForms.StaffSelectForm staffForm = new XLForms.StaffSelectForm();
            staffForm.ShowDialog();
            Document currentDoc             = XLDocument.GetCurrentDoc();
            long     startPosition          = currentDoc.Content.Start;
            long     endPosition            = currentDoc.Content.End;
            string   templateXML            = XLDocument.CopyRangeToWordXML(currentDoc.Range());
            List <XLMain.FPIClient> clients = XLMain.FPIClient.GetFPIClients(staffForm.selectedStaff.crmID, "where direct_debit = 0 and Last_year = 1");

            if (clients.Count > 0)
            {
                XLDocument.MergeFPIData(clients.OrderBy(c => c.office).ToList(), templateXML);
            }
            else
            {
                MessageBox.Show("No clients founds to merge.");
            }
            clients = XLMain.FPIClient.GetFPIClients(staffForm.selectedStaff.crmID, "where direct_debit = 0 and Last_year = 1", false);
            if (clients.Count > 0)
            {
                XLDocument.MergeFPIData(clients.OrderBy(c => c.office).ToList(), templateXML);
            }
            else
            {
                MessageBox.Show("No foreign clients founds to merge.");
            }
        }
Exemple #2
0
 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 AddresseeTB_Leave(object sender, EventArgs e)
        {
            string addressee = AddresseeTB.Text;

            XLDocument.UpdateBookmark("Addressee", addressee);
            XLDocument.UpdateBookmark("Addressee2", addressee);
        }
Exemple #4
0
 private void StaffAddressBtn_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         StaffForm myForm = new StaffForm();
         myForm.ShowDialog();
         XLMain.Staff contact = myForm.selectedContact;
         string       str     = "";
         if (contact.addresses[0].addressBlock != null)
         {
             if (contact.salutations.Count > 0)
             {
                 str += contact.salutations[0].addressee + Environment.NewLine;
             }
             str += contact.addresses[0].addressBlock;
             XLDocument.InsertText(str);
             //insert the status text box;
             //XLDocument.AddStatusBox();
             //XLDocument.ChangeStatus("Draft");
         }
         else
         {
             MessageBox.Show(contact.name + " does not have an address in the system.");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Unable to get staff address");
         XLtools.LogException("StaffAddressBtn", ex.ToString());
     }
 }
        public static string GetFileID()
        {
            try
            {
                XLDocument.UpdateCurrentDoc();
                string fileID = "";

                //Check whether the parameter has already been set
                fileID = ReadParameter("FileID");

                fileID = currentDoc.Name;
                if (fileID.IndexOf("-") > -1)
                {
                    int len = fileID.IndexOf("-");     //get the index of the version identifier
                    fileID = fileID.Substring(0, len); //ignore everything after and including the -
                    if (String.IsNullOrEmpty(fileID) || !int.TryParse(fileID, out int i))
                    {
                        throw new ArgumentException("Document doesn't appear to be in VC");
                    }
                    UpdateParameter("FileID", fileID); //add the parameter for next time.

                    return(fileID);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Unable to discover file ID");
                XLtools.LogException("GetFileID", e.ToString());
                return(null);
            }
        }
Exemple #6
0
        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 static void WhenCallingString(XLMain.Staff wcStaff)
 {
     try
     {
         if (wcStaff == null)
         {
             XLDocument.UpdateBookmark("Whencalling", "");
             XLDocument.UpdateBookmark("Calling", "");
             XLDocument.UpdateBookmark("WcEmail", "");
             XLDocument.UpdateBookmark("WcEmailAddress", "");
         }
         else
         {
             XLDocument.UpdateBookmark("Whencalling", "When calling please ask for: ", 1);
             XLDocument.UpdateBookmark("Calling", wcStaff.name);
             if (wcStaff.emails != null)
             {
                 XLDocument.UpdateBookmark("WcEmail", "e-mail: ", 1);
                 XLDocument.UpdateBookmark("WcEmailAddress", wcStaff.emails[0].email);
             }
             else
             {
                 XLDocument.UpdateBookmark("WcEmail", "");
                 XLDocument.UpdateBookmark("WcEmailAddress", "");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Unable to build when calling for");
         XLtools.LogException("WhenCallingString", ex.ToString());
     }
 }
 public static void EndDocument()
 {
     try
     {
         XLDocument.UpdateCurrentDoc();
         //close panel if open
         if (XLantWordRibbon.xlTaskPane1 != null)
         {
             XLantWordRibbon.xlTaskPane1.Visible = false;
             XLantWordRibbon.xlTaskPane1.Dispose();
             //remove the task pane
             Globals.ThisAddIn.CustomTaskPanes.Remove(XLantWordRibbon.CustomxlTaskPane);
         }
         string str = currentDoc.FullName;
         //close document
         ((_Document)currentDoc).Close(SaveChanges: WdSaveOptions.wdDoNotSaveChanges);
         //no longer necessary to delete file if it is a VC doc as it does it itself
         //File.Delete(str);
     }
     catch (Exception e)
     {
         MessageBox.Show("Unable to close document and exit");
         XLtools.LogException("EndDocument", e.ToString());
     }
 }
 public static void AddStatusBox()
 {
     try
     {
         XLDocument.UpdateCurrentDoc();
         Microsoft.Office.Interop.Word.Shape textBox;
         //Check whether the bookmark already exists and only if it doesn't add it
         if (!currentDoc.Bookmarks.Exists("Status"))
         {
             textBox = currentDoc.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 400, 50, 100, 50);
             textBox.Line.Visible                    = MsoTriState.msoFalse;
             textBox.Name                            = "MLStatus";
             textBox.TextFrame.TextRange.Text        = "Status";
             textBox.TextFrame.TextRange.Font.Hidden = 1;
             textBox.TextFrame.TextRange.Font.Italic = 1;
             textBox.TextFrame.TextRange.Font.Name   = "Calibri";
             textBox.TextFrame.TextRange.Font.Size   = 16;
             textBox.TextFrame.TextRange.Bookmarks.Add("Status");
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Unable to add the status box");
         XLtools.LogException("AddStatusBox", e.ToString());
     }
 }
 public static void UpdateBookmark(string bName, string bValue, int bold = 2, string styleName = "")
 {
     try
     {
         XLDocument.UpdateCurrentDoc();
         if (currentDoc.Bookmarks.Exists(bName))
         {
             Range bRange = currentDoc.Bookmarks.get_Item(bName).Range;
             bRange.Text = bValue;
             //apply style first so that the bold can override if necessary
             if (styleName != "")
             {
                 bRange.set_Style(currentDoc.Styles[styleName]);
             }
             //bold is not specified make no changes so it stickes with the style in the document
             if (bold < 2)
             {
                 bRange.Bold = bold;
             }
             currentDoc.Bookmarks.Add(bName, bRange);
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Unable to update bookmark");
         XLtools.LogException("UpdateBookmark", e.ToString());
     }
 }
Exemple #11
0
        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 SalDDL_SelectedIndexChanged(object sender, EventArgs e)
 {
     sal = (XLMain.Salutation)SalDDL.SelectedItem;
     AddresseeTB.Text  = sal.addressee;
     SalutationTb.Text = sal.salutation;
     XLDocument.UpdateBookmark("Salutation", SalutationTb.Text);
     XLDocument.UpdateBookmark("Addressee", AddresseeTB.Text);
     XLDocument.UpdateBookmark("Addressee2", AddresseeTB.Text);
 }
Exemple #13
0
        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());
            }
        }
Exemple #14
0
        private void MySigBtn_Click(object sender, RibbonControlEventArgs e)
        {
            //get current user
            XLMain.Staff user    = XLMain.Staff.StaffFromUser(Environment.UserName);
            bool         success = XLDocument.AddSignature(user.username);

            if (success)
            {
                success = XLDocument.AddSignatureMetaData(user, user);
            }
        }
 private void EncChk_CheckedChanged(object sender, EventArgs e)
 {
     if (EncChk.Checked)
     {
         XLDocument.UpdateBookmark("Enc", "Enc", bold: 0, styleName: "ML Main");
     }
     else
     {
         XLDocument.UpdateBookmark("Enc", "", bold: 0, styleName: "ML Main");
     }
 }
 private void RevertBtn_Click(object sender, EventArgs e)
 {
     try
     {
         //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;
             }
         }
         //Deal with addresses
         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)
                 {
                     addTB.Text = add.addressBlock;
                 }
             }
         }
         else if (docType == "Fax")
         {
             XLMain.Number fax = XLMain.Number.GetNumber(client.crmID, "Fax");
             if (fax != null)
             {
                 FaxTB.Text = fax.number;
             }
         }
         RevertBtn.Visible = false;
         XLDocument.UpdateBookmark("Salutation", SalutationTb.Text);
         XLDocument.UpdateBookmark("Addressee", AddresseeTB.Text);
         XLDocument.UpdateBookmark("Addressee2", AddresseeTB.Text);
         XLDocument.UpdateBookmark("Address", addTB.Text);
         XLDocument.UpdateBookmark("Fax", FaxTB.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Unable to revert");
         XLtools.LogException("RevertBtn", ex.ToString());
     }
 }
 private void PandCCheck_CheckedChanged(object sender, EventArgs e)
 {
     if (PandCCheck.Checked)
     {
         XLDocument.UpdateBookmark("PandC", "Private and Confidential");
     }
     else
     {
         XLDocument.UpdateBookmark("PandC", "");
     }
 }
 private void FAOBCheck_CheckedChanged(object sender, EventArgs e)
 {
     if (FAOBCheck.Checked)
     {
         XLDocument.UpdateBookmark("FAOBOML", "Milsted Langdon");
     }
     else
     {
         XLDocument.UpdateBookmark("FAOBOML", "");
     }
 }
Exemple #19
0
 public HeaderForm()
 {
     InitializeComponent();
     this.CenterToParent();
     OfficeDDL.DataSource    = XLDocument.GetList("Office");
     OfficeDDL.DisplayMember = "name";
     OfficeDDL.ValueMember   = "dbTag";
     DeptDDL.DataSource      = XLDocument.GetList("Footer");
     DeptDDL.DisplayMember   = "name";
     DeptDDL.ValueMember     = "dbTag";
 }
Exemple #20
0
        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 addressLB_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         string str = addressesDDL.SelectedValue.ToString();
         addTB.Text = str;
     }
     catch
     {
         addTB.Text = "";
     }
     XLDocument.UpdateBookmark("Address", addTB.Text);
 }
        private void SalutationTb_Leave(object sender, EventArgs e)
        {
            string salutation = SalutationTb.Text;

            XLDocument.UpdateBookmark("Salutation", salutation);
            if (salutation == "" || salutation == "Sir" || salutation == "Madam" || salutation == "Sirs" || salutation == "Mesdames")
            {
                XLDocument.UpdateBookmark("FaithSincere", "Yours faithfully");
            }
            else
            {
                XLDocument.UpdateBookmark("FaithSincere", "Yours sincerely");
            }
        }
Exemple #23
0
        private void OkBtn_Click(object sender, EventArgs e)
        {
            XLDocument.Header header = new XLDocument.Header();
            string            office = (string)OfficeDDL.SelectedValue;
            string            footer = (string)DeptDDL.SelectedValue;

            header = XLDocument.MapHeaderFooter(office, footer);
            if (header != null)
            {
                XLDocument.DeployHeader(header);
                XLDocument.UpdateParameter("HeaderDeployed", "true");
            }
            this.Close();
        }
Exemple #24
0
        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 IPSContactBtn_Click(object sender, EventArgs e)
        {
            try
            {
                IPSContForm myForm = new IPSContForm(client);
                myForm.ShowDialog();
                XLInsol.Contact selectContact = myForm.selectedContact;
                if (selectContact != null)
                {
                    if (docType == "Letter")
                    {
                        if (selectContact != null)
                        {
                            allAddresses            = null;
                            addressesDDL.DataSource = null;
                            string add = selectContact.name;
                            add       += Environment.NewLine + selectContact.addressBlock;
                            addTB.Text = add;
                        }
                    }
                    else if (docType == "Fax")
                    {
                        if (selectContact.fax != null)
                        {
                            FaxTB.Text = selectContact.fax;
                        }
                    }
                    SalDDL.DataSource = null;
                    AddresseeTB.Text  = "";
                    SalutationTb.Text = "";

                    RevertBtn.Visible = true;
                    XLDocument.UpdateBookmark("Salutation", SalutationTb.Text);
                    XLDocument.UpdateBookmark("Addressee", AddresseeTB.Text);
                    XLDocument.UpdateBookmark("Addressee2", AddresseeTB.Text);
                    XLDocument.UpdateBookmark("Address", addTB.Text);
                    XLDocument.UpdateBookmark("Fax", FaxTB.Text);
                }
                else
                {
                    MessageBox.Show("No address returned");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to fetch insolvency contact");
                XLtools.LogException("InsolContactBtn", ex.ToString());
            }
        }
Exemple #26
0
        private void UpdateDatebtn_Click(object sender, RibbonControlEventArgs e)
        {
            string date = XLDocument.ReadBookmark("Date");

            //check to see if bookmark exists, if not just insert date.
            if (String.IsNullOrEmpty(date))
            {
                XLDocument.InsertText(DateTime.Now.ToString("d MMMM yyyy"));
            }
            else
            {
                XLDocument.UpdateBookmark("Date", DateTime.Now.ToString("d MMMM yyyy"));
                XLDocument.UpdateBookmark("Date2", DateTime.Now.ToString("d MMMM yyyy"));
            }
        }
 private void UpdateBookmarks(string docType)
 {
     try
     {
         //Build reference
         string ourRef = OurRef(client, sender, user);
         if (docType == "Letter")
         {
             XLDocument.UpdateBookmark("Address", addTB.Text);
             XLDocument.UpdateBookmark("Salutation", SalutationTb.Text);
             XLDocument.UpdateBookmark("Subject", SubjectTB.Text);
             XLDocument.UpdateBookmark("Date", DateTB.Value.Date.ToString("d MMMM yyyy"));
             XLDocument.UpdateBookmark("Date2", DateTB.Value.Date.ToString("d MMMM yyyy"));
             XLDocument.UpdateBookmark("Addressee", AddresseeTB.Text);
             XLDocument.UpdateBookmark("Addressee2", AddresseeTB.Text);
             DeploySignature(client, sender, AddresseeTB.Text);
             XLDocument.UpdateBookmark("OurRef", ourRef, 0);
         }
         else if (docType == "Fax")
         {
             XLDocument.UpdateBookmark("Subject", SubjectTB.Text);
             XLDocument.UpdateBookmark("Client", client.name);
             XLDocument.UpdateBookmark("Date", DateTB.Value.Date.ToString("d MMMM yyyy"));
             XLDocument.UpdateBookmark("Date2", DateTB.Value.Date.ToString("d MMMM yyyy"));
             XLDocument.UpdateBookmark("Addressee", AddresseeTB.Text);
             XLDocument.UpdateBookmark("Addressee2", AddresseeTB.Text);
             DeploySignature(client, sender, AddresseeTB.Text);
             XLDocument.UpdateBookmark("Sender2", sender.name);
             XLDocument.UpdateBookmark("Fax", FaxTB.Text);
             XLDocument.UpdateBookmark("OurRef", ourRef, 0);
         }
         else if (docType == "FileNote")
         {
             XLDocument.UpdateBookmark("Subject", SubjectTB.Text, 1);
             XLDocument.UpdateBookmark("Date", DateTB.Value.Date.ToString("d MMMM yyyy"));
             XLDocument.UpdateBookmark("Date2", DateTB.Value.Date.ToString("d MMMM yyyy"));
             XLDocument.UpdateBookmark("Sender", sender.name, 1);
             XLDocument.UpdateBookmark("ClientStr", XLDocument.ReadParameter("ClientStr"));
             XLDocument.UpdateBookmark("OurRef", ourRef, 1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Unable to update bookmarks");
         XLtools.LogException("TaskPane-UpdateBookmarks", ex.ToString());
     }
 }
 public static void AddStyles()
 {
     try
     {
         XLDocument.UpdateCurrentDoc();
         string   path      = StandardLocation() + "Letter.dotx";
         Document sTemplate = OpenDoc(path, true, false, false);
         currentDoc.set_AttachedTemplate((object)sTemplate);
         sTemplate.Close(SaveChanges: false);
         currentDoc.UpdateStyles();
     }
     catch (Exception e)
     {
         MessageBox.Show("Unable to add styles" + e.ToString());
         XLtools.LogException("AddStyles", e.ToString());
     }
 }
        private void SenderDDL_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //Collect the changed record
                XLMain.EntityCouplet tempSend = (XLMain.EntityCouplet)SenderDDL.SelectedItem;
                //Convert the entity couplet to a full blown user now we know which one we want
                if (tempSend.crmID != "")
                {
                    XLMain.Staff send = XLMain.Staff.FetchStaff(tempSend.crmID);
                    DeploySignature(client, send, AddresseeTB.Text);
                    XLDocument.UpdateParameter("Sender", send.username);

                    //Build reference
                    string ourRef = OurRef(client, send, user);
                    XLDocument.UpdateBookmark("OurRef", ourRef, 0);
                }
                else
                {
                    XLMain.Staff send = new XLMain.Staff();
                    send.crmID    = "";
                    send.name     = tempSend.name;
                    send.initials = "";
                    DeploySignature(client, send, AddresseeTB.Text);
                    XLDocument.UpdateParameter("Sender", "");

                    //Build reference
                    string ourRef = OurRef(client, send, user);
                    XLDocument.UpdateBookmark("OurRef", ourRef, 0);

                    //For Milsted Langdon remove for and on behalf
                    if (tempSend.name == "Milsted Langdon LLP")
                    {
                        if (FAOBCheck.Checked)
                        {
                            FAOBCheck.Checked = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to change sender");
                XLtools.LogException("TaskPane-SenderDDL", ex.ToString());
            }
        }
Exemple #30
0
 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());
     }
 }