Exemple #1
0
 private void RecentClientListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     XLMain.EntityCouplet selectedItem = (XLMain.EntityCouplet)RecentClientListBox.SelectedItem;
     //to avoid another call to the database, pull from the list instead
     selectedClient = clientList.Where(c => c.crmID == selectedItem.crmID).First();
     this.Close();
 }
Exemple #2
0
        private void ApproveBtn_Click(object sender, RibbonControlEventArgs e)
        {
            Outlook.MailItem email = ThisEmail();
            email.Save();
            XLMain.Client client = XLMain.Client.FetchClient(XLOutlook.ReadParameter("CrmID", email));
            XLMain.Staff  writer = XLMain.Staff.StaffFromUser(Environment.UserName);
            if (XLantRibbon.staff.Count == 0)
            {
                XLantRibbon.staff = XLMain.Staff.AllStaff();
            }
            StaffSelectForm myForm = new StaffSelectForm(client, writer, XLantRibbon.staff);

            myForm.ShowDialog();
            XLMain.EntityCouplet staff = myForm.selectedStaff;

            string commandfileloc = "";

            string fileId = XLOutlook.ReadParameter("VCFileID", email);

            commandfileloc = XLVirtualCabinet.Reindex(fileId, staff.name, status: "Approved", docDate: DateTime.Now.ToString("dd/MM/yyyy"));

            XLVirtualCabinet.BondResult result = XLVirtualCabinet.LaunchCabi(commandfileloc, true);
            if (result.ExitCode != 0)
            {
                MessageBox.Show("Reindex failed please complete manually.");
            }
            else
            {
                // Close the email in Outlook to prevent further changes that won't be saved to VC
                email.Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olSave);
                // Delete the email from the Drafts folder in Outlook
//                email.Delete();
            }
        }
        public static XLMain.Client GetClient(Outlook.MailItem email)
        {
            XLMain.Client selectClient    = new XLMain.Client();
            string        strippedemails  = EmailAddressesStr(email).ToString();
            string        strippedSubject = "";

            if (email.Subject != null)
            {
                strippedSubject = email.Subject;
                string[] embargoWords = { "Milsted Langdon", "Limited", "PLC", "Mr", "Mrs", "Miss", "the", "and", "A", "of", "Partnership", "LLP", "Liquidation", "Administration", "Bankruptcy", "individual", "voluntary arrangement", "accounts", "audit", "tax" };
                foreach (string word in embargoWords)
                {
                    strippedSubject = strippedSubject.Replace(word, "");
                }
            }

            string query = "SELECT clientcrmid as crmid, display as name FROM [XLant].[dbo].[FuzzyClientSearch] (@param1,@param2) order by score desc";

            ClientForm myForm = new ClientForm(query, strippedemails, strippedSubject, XLantRibbon.recentClients);

            myForm.ShowDialog();
            selectClient = myForm.selectedClient;

            return(selectClient);
        }
Exemple #4
0
        private void ClientListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            EntityCouplet selectedItem = (EntityCouplet)ClientListBox.SelectedItem;

            selectedClient = XLMain.Client.FetchClient(selectedItem.crmID);
            this.Close();
        }
        public static void MultiQuickIndex(Outlook.MailItem email, string folder)
        {
            try
            {
                XLant.XLVirtualCabinet.BondResult outcome = IndexEmail(email, folder);
                // As the filing has been successfull, get the FileId returned from Bond via the Standard Output
                if (outcome.ExitCode == 0)
                {
                    string fileid = Regex.Match(outcome.StandardOutput, @"\d+").ToString();
                    XLVirtualCabinet.FileInfo info = XLVirtualCabinet.FileIndex(fileid);
                    DialogResult result            = MessageBox.Show("Do you want to index another copy", "Index", MessageBoxButtons.YesNo);
                    while (result == DialogResult.Yes)
                    {
                        XLForms.ClientForm myForm = new ClientForm();
                        myForm.ShowDialog();
                        XLMain.Client client = myForm.selectedClient;
                        //update the cabinet based on the new client
                        string cabinet = XLVirtualCabinet.FileStore(client.manager.office, client.department);
                        info.Cabinet = cabinet;
                        //update the client field
                        foreach (XLVirtualCabinet.IndexPair pair in info.Indexes)
                        {
                            if (pair.index == "INDEX02")
                            {
                                pair.value = client.clientcode + " - " + client.name;
                            }
                        }
                        outcome = XLVirtualCabinet.IndexDocument(outcome.DocPath, info);

                        if (outcome.ExitCode == 0)
                        {
                            result = MessageBox.Show("Do you want to index another copy", "Index", MessageBoxButtons.YesNo);
                            continue;
                        }
                        else
                        {
                            MessageBox.Show("Unable to index document, please index manually.  Error code: " + outcome.ExitCode.ToString() + "-" + outcome.StandardOutput.ToString());
                            break;
                        }
                    }
                    //update the tick box and category
                    UpdateVCTick(email);
                    //delete email from temp directory
                    if (File.Exists(outcome.DocPath))
                    {
                        File.Delete(outcome.DocPath);
                    }
                }
                else
                {
                    Exception e = new Exception("Unable to index");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to index email");
                XLtools.LogException("MultiQuickIndex", ex.ToString());
            }
        }
 public SelectForm(List <XLMain.EntityCouplet> ContList, XLMain.Client passedClient)
 {
     InitializeComponent();
     this.CenterToParent();
     client = passedClient;
     ContactListBox.DisplayMember = "value";
     ContactListBox.ValueMember   = "crmId";
     ContactListBox.DataSource    = ContList;
 }
        public VCForm(XLMain.Staff writer, XLMain.Client clientPass, string docPathPass, string desc = "", string statusPass = "******", string docDatePass = null, string todo = "user", List <XLMain.EntityCouplet> staffList = null)
        {
            InitializeComponent();
            this.CenterToParent();
            client  = clientPass;
            docPath = docPathPass;
            status  = statusPass;
            docDate = docDatePass ?? DateTime.Now.ToString("dd/MM/yyyy");
            XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName);

            //Set the list of sections for the cabinet
            List <string> sections = XLVirtualCabinet.SectionValues(client.manager.office, client.department);

            if (sections != null)
            {
                FileSectionDDL.DataSource = sections;
            }
            //if one of the items is correspondence use it otherwise just pick number one.
            try
            {
                FileSectionDDL.SelectedItem = "Correspondence";
            }
            catch
            {
                FileSectionDDL.SelectedIndex = 1;
            }

            DescTB.Text = desc;

            //populate the sender
            List <XLMain.EntityCouplet> users = XLtools.StaffList(user, client, true, userList: staffList);

            if (todo == "user")
            {
                if (writer != null)
                {
                    ToBeActionDDL.DataSource    = users;
                    ToBeActionDDL.DisplayMember = "name";
                    ToBeActionDDL.ValueMember   = "crmID";
                    ToBeActionDDL.SelectedItem  = writer.crmID;
                }
            }
            else
            {
                XLMain.EntityCouplet blank = new XLMain.EntityCouplet();
                blank.crmID = "";
                blank.name  = "";
                users.Insert(0, blank);
                ToBeActionDDL.DataSource    = users;
                ToBeActionDDL.DisplayMember = "name";
                ToBeActionDDL.ValueMember   = "crmID";
                ToBeActionDDL.SelectedItem  = blank;
            }

            //Check for any sub-section
        }
Exemple #8
0
        private void SearchBtn_Click_1(object sender, EventArgs e)
        {
            if (client == null || client.clientcode != CaseCodeTb.Text)
            {
                client = XLMain.Client.FetchClientFromCode(CaseCodeTb.Text);
            }
            string searchStr = SearchTB.Text;

            Search("select name + ' - ' + address1 as display, id as CRMid from IPSContact('" + client.crmID + "') where name like '%" + searchStr + "%'");
        }
        //private static System.Threading.Timer timer;

        public static XLant.XLVirtualCabinet.BondResult IndexEmail(Outlook.MailItem email, string folder)
        {
            try
            {
                XLMain.Client selectClient = new XLMain.Client();

                selectClient = GetClient(email);

                //Add CRMID to email for later use.
                UpdateParameter("CrmID", selectClient.crmID, email);
                //Collect data for indexing
                XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName);

                string docPath = TempSave(email);
                string docDate = DateTime.Now.ToString("dd/MM/yyyy");
                //take a guess at the status
                string status = "";
                string desc   = email.Subject;
                if (folder.Contains("Inbox"))
                {
                    status  = "External";
                    docDate = CheckDate(email.ReceivedTime);
                }
                else if (folder.Contains("Sent"))
                {
                    status  = "Sent";
                    docDate = CheckDate(email.SentOn);
                }
                else
                {
                    status  = "Draft";
                    docDate = CheckDate(DateTime.Now);
                }
                if (XLantRibbon.staff.Count == 0)
                {
                    XLantRibbon.staff = XLMain.Staff.AllStaff();
                }

                VCForm indexForm = new VCForm(user, selectClient, docPath, desc, status, docDate, "blank", XLantRibbon.staff);
                indexForm.ShowDialog();
                //collect result from form
                XLVirtualCabinet.BondResult outcome = indexForm.outcome;

                //add client to recent list
                AddClienttoRecent(selectClient);

                return(outcome);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to index e-mail");
                XLtools.LogException("IndexEmail", ex.ToString());
                return(null);
            }
        }
 private static void AddClienttoRecent(XLMain.Client client)
 {
     //add client to list
     XLantRibbon.recentClients.Insert(0, client);
     //If the this has created a duplicate delete it
     XLantRibbon.recentClients = XLantRibbon.recentClients.GroupBy(p => p.crmID).Select(g => g.First()).ToList();
     //if now more than ten remove last
     if (XLantRibbon.recentClients.Count > 10)
     {
         //remove the 11th item (NB 0 based index)
         XLantRibbon.recentClients.RemoveAt(10);
     }
 }
Exemple #11
0
        public IPSContForm(XLMain.Client passClient, string initialQuery = "")
        {
            InitializeComponent();
            this.CenterToParent();

            if (passClient != null)
            {
                client          = passClient;
                CaseCodeTb.Text = client.clientcode;
            }
            if (initialQuery != "")
            {
                Search(initialQuery);
            }
        }
Exemple #12
0
        public SelectStaffForm(XLMain.Client client, XLMain.Staff sender, List <XLMain.EntityCouplet> staffList = null)
        {
            InitializeComponent();
            this.CenterToParent();

            //populate the sender
            List <XLMain.EntityCouplet> users = new List <XLMain.EntityCouplet>();

            users = XLtools.StaffList(sender, client, true, userList: staffList);

            SelectDDL.DataSource    = users;
            SelectDDL.DisplayMember = "name";
            SelectDDL.ValueMember   = "crmID";
            if (sender != null)
            {
                SelectDDL.SelectedItem = sender.crmID;
            }
        }
Exemple #13
0
        public VCForm(XLMain.Client recClient, MailItem recEmail)
        {
            InitializeComponent();
            client = recClient;
            email  = recEmail;

            //Get the information you can
            //Collect data for filing
            string desc = email.SenderName + "re:" + email.Subject;

            DescTB.Text = desc;

            //populate To Be Actioned by
            XLMain.Staff staff = new XLMain.Staff();
            staff = XLMain.Staff.StaffFromUser(Environment.UserName);

            //populate the sender
            List <XLMain.Staff> users = new List <XLMain.Staff>();

            users = XLMain.Staff.AllStaff();
            int i = 0;

            //place current and connected users at the top of the list, could remove them elsewhere but seems no point
            if (staff != null)
            {
                users.Insert(i, staff);
                i += 1;
            }
            if (client.partner != null)
            {
                users.Insert(i, client.partner);
                i += 1;
            }
            if (client.manager != null)
            {
                users.Insert(i, client.manager);
                i += 1;
            }
            //add a blank in case there is no further action required
            users.Insert(i, new XLMain.Staff());

            //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;
            }

            if (client.department != "INS")
            {
                FileSectionDDL.Visible = false;
                FileSectionlbl.Visible = false;
            }
            else
            {
                FileSectionDDL.Visible = true;
                FileSectionlbl.Visible = true;
            }
        }
        public static void IndexAttachments(Outlook.MailItem email)
        {
            if (email.Attachments.Count > 0)
            {
                XLVirtualCabinet.BondResult outcome = new XLVirtualCabinet.BondResult();
                string fileid  = "";
                string docPath = "";
                XLVirtualCabinet.FileInfo info = new XLVirtualCabinet.FileInfo();
                for (int i = 1; i <= email.Attachments.Count; i++)
                {
                    string folder = XLtools.TempPath();
                    if (i == 1)
                    {
                        email.Attachments[i].SaveAsFile(folder + email.Attachments[i].FileName);
                        XLMain.Client selectClient = GetClient(email);
                        //Collect data for indexing
                        XLMain.Staff user = XLMain.Staff.StaffFromUser(Environment.UserName);
                        docPath = folder + email.Attachments[i].FileName;
                        string docDate = DateTime.Now.ToString("dd/MM/yyyy");
                        string status  = "External";
                        string desc    = email.Attachments[i].FileName;
                        if (XLantRibbon.staff.Count == 0)
                        {
                            XLantRibbon.staff = XLMain.Staff.AllStaff();
                        }
                        VCForm indexForm = new VCForm(user, selectClient, docPath, desc, status, docDate, "blank", XLantRibbon.staff);
                        indexForm.ShowDialog();
                        //collect result from form
                        outcome = indexForm.outcome;

                        //get the details of the file.
                        fileid = Regex.Match(outcome.StandardOutput, @"\d+").ToString();
                        info   = XLVirtualCabinet.FileIndex(fileid);

                        //add client to recent list
                        AddClienttoRecent(selectClient);
                    }
                    else
                    {
                        //save the next file
                        email.Attachments[i].SaveAsFile(folder + email.Attachments[i].FileName);
                        docPath = folder + email.Attachments[i].FileName;

                        foreach (XLVirtualCabinet.IndexPair pair in info.Indexes)
                        {
                            if (pair.index.ToUpper() == "INDEX03")
                            {
                                string d = email.Attachments[i].FileName;
                                //generate form for the description to be altered
                                SingleDataCaptureForm myForm = new SingleDataCaptureForm("Input Description", "Enter Description", d);
                                myForm.ShowDialog();
                                if (myForm.result == DialogResult.Cancel)
                                {
                                    continue;
                                }
                                else
                                {
                                    pair.value = myForm.data;
                                }
                            }
                        }
                        outcome = XLVirtualCabinet.IndexDocument(docPath, info);
                    }
                }
                MessageBox.Show("All Attachments Saved");
            }
        }