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());
     }
 }
        private void AddresseeTB_Leave(object sender, EventArgs e)
        {
            string addressee = AddresseeTB.Text;

            XLDocument.UpdateBookmark("Addressee", addressee);
            XLDocument.UpdateBookmark("Addressee2", addressee);
        }
 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);
 }
 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 FAOBCheck_CheckedChanged(object sender, EventArgs e)
 {
     if (FAOBCheck.Checked)
     {
         XLDocument.UpdateBookmark("FAOBOML", "Milsted Langdon");
     }
     else
     {
         XLDocument.UpdateBookmark("FAOBOML", "");
     }
 }
 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 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");
            }
        }
Example #10
0
        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());
            }
        }
Example #11
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"));
            }
        }
Example #12
0
 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());
     }
 }
Example #13
0
        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());
            }
        }
Example #14
0
        private void UpdateRefBtn_Click(object sender, RibbonControlEventArgs e)
        {
            string fileID = XLDocument.GetFileID();

            if (fileID == DateTime.Now.ToString("yyyy-MM-dd"))
            {
                MessageBox.Show("Unable to find FileID.  If the document has not yet been placed in VC click First Index.");
            }
            else
            {
                string ourRef = XLDocument.ReadBookmark("OurRef");
                //check to see if bookmark exists, if not just insert date.
                if (String.IsNullOrEmpty(ourRef))
                {
                    XLDocument.InsertText(fileID);
                }
                else
                {
                    ourRef += @"/" + fileID;
                    XLDocument.UpdateBookmark("OurRef", ourRef);
                }
            }
        }
Example #15
0
        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());
            }
        }
Example #16
0
 private void FaxTB_Leave(object sender, EventArgs e)
 {
     XLDocument.UpdateBookmark("Fax", FaxTB.Text);
 }
Example #17
0
        private void GetAddressBtn_Click(object sender, EventArgs e)
        {
            try
            {
                ContForm myForm = new ContForm();
                myForm.ShowDialog();
                XLMain.Contact selectContact = myForm.selectedContact;
                if (selectContact != null)
                {
                    if (docType == "Letter")
                    {
                        if (selectContact.addresses != null)
                        {
                            allAddresses               = selectContact.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;
                        }
                    }

                    //Deal with salutations
                    if (selectContact.salutations != null)
                    {
                        SalDDL.DataSource    = selectContact.salutations;
                        SalDDL.DisplayMember = "Salutation";
                        SalDDL.ValueMember   = "Addressee";
                        sal = (XLMain.Salutation)SalDDL.SelectedItem;
                        if (sal != null)
                        {
                            AddresseeTB.Text  = sal.addressee;
                            SalutationTb.Text = sal.salutation;
                            SalutationTb_Leave(this, null);
                        }
                    }
                    else
                    {
                        SalDDL.DataSource    = null;
                        SalDDL.DisplayMember = "Salutation";
                        SalDDL.ValueMember   = "Addressee";
                        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 contact");
                XLtools.LogException("TaskPane-ContactBtn", ex.ToString());
            }
        }
Example #18
0
 private void DateTB_Leave(object sender, EventArgs e)
 {
     XLDocument.UpdateBookmark("Date", DateTB.Value.Date.ToString("d MMMM yyyy"));
 }
Example #19
0
 private void SubjectTB_Leave(object sender, EventArgs e)
 {
     XLDocument.UpdateBookmark("Subject", SubjectTB.Text);
 }
Example #20
0
 private void addTB_Leave(object sender, EventArgs e)
 {
     XLDocument.UpdateBookmark("Address", addTB.Text);
 }