コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        public DescForm(string senderUsername = "", string tempDesc = "")
        {
            InitializeComponent();
            this.CenterToParent();
            DescTB.Text = tempDesc;

            XLMain.Staff user = XLMain.Staff.StaffFromUser(senderUsername);
            //populate the ddl
            List <XLMain.Staff> users = new List <XLMain.Staff>();

            users = XLMain.Staff.AllStaff();
            //place the sender at the top of the list
            if (user != null)
            {
                users.Insert(0, user);
            }
            SenderDDL.DataSource    = users;
            SenderDDL.DisplayMember = "name";
            SenderDDL.ValueMember   = "crmID";
            SenderDDL.SelectedItem  = user;
        }
コード例 #4
0
        private void HarboursideSign_Click(object sender, RibbonControlEventArgs e)
        {
            //get current user
            XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName);
            bool         auth = AuthCheck(user);

            if (auth)
            {
                bool success = XLDocument.AddSignature("Harbourside");
                if (success)
                {
                    XLMain.Staff harb = new XLMain.Staff();
                    harb.username = "******";
                    harb.name     = "Harbourside LLP";
                    success       = XLDocument.AddSignatureMetaData(user, harb);
                }
            }
            else
            {
                MessageBox.Show("You do not have authority to use this feature");
            }
        }
コード例 #5
0
        private void MLsignature_Click(object sender, RibbonControlEventArgs e)
        {
            //get current user
            XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName);
            bool         auth = AuthCheck(user);

            if (auth)
            {
                bool success = XLDocument.AddSignature("MilstedLangdon");
                if (success)
                {
                    XLMain.Staff mL = new XLMain.Staff();
                    mL.username = "******";
                    mL.name     = "Milsted Langdon LLP";
                    success     = XLDocument.AddSignatureMetaData(user, mL);
                }
            }
            else
            {
                MessageBox.Show("You do not have authority to use this feature");
            }
        }
コード例 #6
0
        private void StaffSig_Click(object sender, RibbonControlEventArgs e)
        {
            //get current user
            XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName);
            bool         auth = AuthCheck(user);

            if (auth)
            {
                StaffForm myForm = new StaffForm();
                myForm.ShowDialog();
                XLMain.Staff contact = myForm.selectedContact;
                //get current user
                bool success = XLDocument.AddSignature(contact.username);
                if (success)
                {
                    success = XLDocument.AddSignatureMetaData(user, contact);
                }
            }
            else
            {
                MessageBox.Show("You do not have authority to use this feature");
            }
        }
コード例 #7
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());
            }
        }
コード例 #8
0
        public static bool AddSignatureMetaData(XLMain.Staff user, XLMain.Staff sig)
        {
            try
            {
                //Add the meta data
                //Build string and add to document
                string str = user.name + ";";
                str += user.grade + ";";
                str += DateTime.Now.ToString("d MMMM yyyy");
                str += ";" + sig.name;
                //insert into document properties

                for (int i = 0; i < 10; i++)
                {
                    string param = "Sign" + i;
                    string s     = XLDocument.ReadParameter(param);
                    if (String.IsNullOrEmpty(s))
                    {
                        XLDocument.UpdateParameter(param, str);
                        break;
                    }
                    if (i == 10)
                    {
                        MessageBox.Show("Signature fields full");
                        break;
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to add signature metadata");
                XLtools.LogException("AddSignature", ex.ToString());
                return(false);
            }
        }
コード例 #9
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());
            }
        }
コード例 #10
0
        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());
            }
        }
コード例 #11
0
        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());
            }
        }
コード例 #12
0
        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());
            }
        }
コード例 #13
0
 internal static void AddBio(XLMain.Staff staff)
 {
     throw new NotImplementedException();
 }
コード例 #14
0
 private void IndexBtn_Click(object sender, EventArgs e)
 {
     selectedStaff = (XLMain.Staff)ToBeActionDDL.SelectedItem;
     this.Close();
 }