Exemple #1
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());
     }
 }
Exemple #2
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());
     }
 }
Exemple #3
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"));
            }
        }
Exemple #4
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());
     }
 }
Exemple #5
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);
                }
            }
        }
Exemple #6
0
        private void button2_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                //get current user
                XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName);
                //Build string and add to document
                string str = user.name + ";";
                str += user.grade + ";";
                str += DateTime.Now.ToString("d MMMM yyyy");
                XLDocument.InsertText(str.Replace(";", Environment.NewLine));

                //insert into document properties with added field
                str += ";" + user.name;
                for (int i = 0; i < 10; i++)
                {
                    string param = "Sign" + i;
                    string s     = XLDocument.ReadParameter(param);
                    if (s == "")
                    {
                        XLDocument.UpdateParameter(param, str);
                        break;
                    }
                    if (i == 10)
                    {
                        MessageBox.Show("Signature fields full");
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to add signature");
                XLtools.LogException("AddSignature", ex.ToString());
            }
        }
Exemple #7
0
 private void docRefButton_Click(object sender, RibbonControlEventArgs e)
 {
     XLDocument.InsertText("DOCREF: " + XLDocument.currentDoc.FullName);
 }