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(); }
private void Search(string query) { //clear existing entries if any ContactListBox.Items.Clear(); //start a new search string searchStr = SearchTB.Text; ContactListBox.Items.Clear(); ContactListBox.DisplayMember = "Name"; ContactListBox.ValueMember = "crmid"; DataTable xlReader = null; xlReader = XLSQL.ReturnTable(query); if (xlReader.Rows.Count != 0) { foreach (DataRow row in xlReader.Rows) { XLMain.EntityCouplet newEntity = new XLMain.EntityCouplet(); newEntity.crmID = row["CRMId"].ToString(); newEntity.name = row["display"].ToString(); ContactListBox.Items.Add(newEntity); } } else { MessageBox.Show("No Records found"); } }
public ClientForm(string initialQuery = "", string param1 = null, string param2 = null, List <XLMain.Client> recentList = null) { InitializeComponent(); this.CenterToParent(); if (initialQuery != "") { Search(initialQuery, param1, param2); } if (recentList != null) { if (recentList.Count > 0) { //pass to local variable clientList = recentList; RecentClientListBox.DisplayMember = "Name"; RecentClientListBox.ValueMember = "crmid"; foreach (XLMain.Client client in clientList) { XLMain.EntityCouplet newEntity = new XLMain.EntityCouplet(); newEntity.crmID = client.crmID; newEntity.name = client.name; RecentClientListBox.Items.Add(newEntity); } } else { RecentClientListBox.Visible = false; } } }
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(); } }
private void WhencallingDDL_SelectedIndexChanged(object sender, EventArgs e) { //Collect the changed record XLMain.EntityCouplet temp = (XLMain.EntityCouplet)WhencallingDDL.SelectedItem; //Convert the entity couplet to a full blown user now we know which one we want XLMain.Staff whenCalling = XLMain.Staff.FetchStaff(temp.crmID); WhenCallingString(whenCalling); }
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 }
private void OKBtn_Click(object sender, EventArgs e) { foreach (object item in ContactListBox.SelectedItems) { XLMain.EntityCouplet couplet = (XLMain.EntityCouplet)item; List <SqlParameter> paramCollection = new List <SqlParameter>(); paramCollection.Add(new SqlParameter("ClientCRM", client.crmID)); paramCollection.Add(new SqlParameter("ContactCRM", couplet.crmID)); XLSQL.RunCommand("ConnectionCreation", paramCollection); } this.Close(); }
private void Search(string query = "", string param1 = null, string param2 = null) { //clear existing entries if any ClientListBox.Items.Clear(); //start a new search string searchStr = SearchTB.Text; Boolean IncLost = IncLostCheck.Checked; ClientListBox.DisplayMember = "Name"; ClientListBox.ValueMember = "crmid"; DataTable xlReader = null; if (query == "") { query = "Select clientcode + ' - ' + name as Name, crmID from Client where ((ClientCode like '%' + @param1 + '%') Or (Name Like '%' + @param1 + '%'))"; param1 = searchStr; if (!IncLost) { query += " and status in ('New', 'Active')"; } query += " order by name"; } xlReader = XLSQL.ReturnTable(query, param1, param2); if (xlReader != null) { if (xlReader.Rows.Count != 0) { foreach (DataRow row in xlReader.Rows) { XLMain.EntityCouplet newEntity = new XLMain.EntityCouplet(); newEntity.crmID = row["Crmid"].ToString(); newEntity.name = row["name"].ToString(); ClientListBox.Items.Add(newEntity); } } else { MessageBox.Show("No Records found"); } } else { MessageBox.Show("Unable to connect to the database."); } }
private void SenderDDL_SelectedIndexChanged(object sender, EventArgs e) { try { //Collect the changed record XLMain.EntityCouplet tempSend = (XLMain.EntityCouplet)SenderDDL.SelectedItem; //Convert the entity couplet to a full blown user now we know which one we want if (tempSend.crmID != "") { XLMain.Staff send = XLMain.Staff.FetchStaff(tempSend.crmID); DeploySignature(client, send, AddresseeTB.Text); XLDocument.UpdateParameter("Sender", send.username); //Build reference string ourRef = OurRef(client, send, user); XLDocument.UpdateBookmark("OurRef", ourRef, 0); } else { XLMain.Staff send = new XLMain.Staff(); send.crmID = ""; send.name = tempSend.name; send.initials = ""; DeploySignature(client, send, AddresseeTB.Text); XLDocument.UpdateParameter("Sender", ""); //Build reference string ourRef = OurRef(client, send, user); XLDocument.UpdateBookmark("OurRef", ourRef, 0); //For Milsted Langdon remove for and on behalf if (tempSend.name == "Milsted Langdon LLP") { if (FAOBCheck.Checked) { FAOBCheck.Checked = false; } } } } catch (Exception ex) { MessageBox.Show("Unable to change sender"); XLtools.LogException("TaskPane-SenderDDL", ex.ToString()); } }
private void IndexBtn_Click(object sender, EventArgs e) { string fullPath = docPath; string cabinet = XLVirtualCabinet.FileStore(client.manager.office, client.department); string clientStr = client.clientcode + " - " + client.name; string toBeActionedBy = null; if (ToBeActionDDL.SelectedValue == null) { toBeActionedBy = ""; } else { XLMain.EntityCouplet toBe = (XLMain.EntityCouplet)ToBeActionDDL.SelectedItem; toBeActionedBy = toBe.name; } //collect information from the two optional ddls use whether they are visible or not to acsertain whether //to include them - They may not be visible but still hold data. XLVirtualCabinet.IndexPair list1Data = new XLVirtualCabinet.IndexPair(); XLVirtualCabinet.IndexPair list2Data = new XLVirtualCabinet.IndexPair(); if (ListDDL1.Visible) { list1Data.index = list1.index; list1Data.value = ListDDL1.Text; } if (ListDDL2.Visible) { list2Data.index = list2.index; list2Data.value = ListDDL2.Text; } string desc = DescTB.Text; string section = ""; section = FileSectionDDL.SelectedItem.ToString(); //Launch the index process and collect the result outcome = XLVirtualCabinet.IndexDocument(fullPath, cabinet, clientStr, status, toBeActionedBy, section, desc, docDate, list1Data, list2Data); this.Close(); }
private void Search(string query = "", string param1 = null, string param2 = null) { //clear existing entries if any ContactListBox.Items.Clear(); //start a new search string searchStr = SearchTB.Text; ContactListBox.Items.Clear(); ContactListBox.DisplayMember = "Name"; ContactListBox.ValueMember = "crmid"; DataTable xlReader = null; if (query == "") { query = "select Fullname + ' - ' + Case when ISNULL(Organisations.Name,'') = '' then ISNULL(Occupation,'') else Organisations.Name end as display, contact.CRMid from Contact left outer join organisations on contact.organisationid=organisations.crmid where ((Fullname like '%' + @param1 + '%') or (Name like '%' + @param1 + '%')) order by last_name"; param1 = searchStr; } xlReader = XLSQL.ReturnTable(query, param1, param2); if (xlReader.Rows.Count != 0) { foreach (DataRow row in xlReader.Rows) { XLMain.EntityCouplet newEntity = new XLMain.EntityCouplet(); newEntity.crmID = row["CRMId"].ToString(); newEntity.name = row["display"].ToString(); ContactListBox.Items.Add(newEntity); } } else { MessageBox.Show("No Records found"); } }
private void Search(string query = "", string param1 = null, string param2 = null) { //clear existing entries if any ContactListBox.Items.Clear(); //start a new search string searchStr = SearchTB.Text; ContactListBox.Items.Clear(); ContactListBox.DisplayMember = "Name"; ContactListBox.ValueMember = "crmid"; DataTable xlReader = null; if (query == "") { query = "select Fullname + ' - ' + Department as display, CRMid from Staff where (Fullname like '%' + @param1 + '%') order by surname"; param1 = searchStr; } xlReader = XLSQL.ReturnTable(query, param1, param2); if (xlReader.Rows.Count != 0) { foreach (DataRow row in xlReader.Rows) { XLMain.EntityCouplet newEntity = new XLMain.EntityCouplet(); newEntity.crmID = row["CRMId"].ToString(); newEntity.name = row["display"].ToString(); ContactListBox.Items.Add(newEntity); } } else { MessageBox.Show("No Records found"); } }
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()); } }
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()); } }
private void ContactListBox_SelectedIndexChanged(object sender, EventArgs e) { XLMain.EntityCouplet selectedItem = (XLMain.EntityCouplet)ContactListBox.SelectedItem; selectedContact = XLInsol.Contact.FetchContact(selectedItem.crmID, client.crmID); this.Close(); }
private void IndexBtn_Click(object sender, EventArgs e) { selectedStaff = (XLMain.EntityCouplet)SelectDDL.SelectedItem; this.Close(); }