コード例 #1
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();
            }
        }
コード例 #2
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());
            }
        }