Ejemplo n.º 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.");
            }
        }