private void UpdateNextStateComboBox(string source_id, OfficeConnectorExtensionAddinRibbon MyRibbon) { Item Document = inn.applyAML(AddtoItem(Settings.Default.getStateName, "config_id", source_id)); if (Document.node != null) { string stateId = Document.getProperty("current_state"); Item CurrentUserIds = inn.applyAML(Settings.Default.getCurrentUserIDs); List <string> idslist = new List <string>(); for (int i = 0; i < CurrentUserIds.getItemCount(); i++) { Item id = CurrentUserIds.getItemByIndex(i); idslist.Add(id.getAttribute("id")); } Item NextStates = inn.applyAML(AddtoItem(Settings.Default.getNextStates, "from_state", stateId)); MyRibbon.NextStateComboBox.Items.Clear(); MyRibbon.NextStateComboBox.Text = ""; MyRibbon.PromoteButton.Enabled = !MyRibbon.PromoteButton.Enabled; for (int i = 0; i < NextStates.getItemCount(); i++) { Item nextstate = NextStates.getItemByIndex(i); string role = nextstate.getProperty("role"); if (idslist.Contains(role)) { RibbonDropDownItem rddi = MyRibbon.Factory.CreateRibbonDropDownItem(); rddi.Label = nextstate.getPropertyAttribute("to_state", "keyed_name"); MyRibbon.NextStateComboBox.Items.Add(rddi); } } } }
public void Updatelabels(Core.DocumentProperties properties, OfficeConnectorExtensionAddinRibbon MyRibbon) { UpdateLifeCycleRibbonName(properties[Settings.Default.ArasDocumentId].Value, MyRibbon.LifeCycleRibbonLabel); UpdateStateRibbonName(properties[Settings.Default.ArasDocumentId].Value, MyRibbon.StateNameRibbonLabel); UpdateNextStateComboBox(properties[Settings.Default.ArasDocumentId].Value, MyRibbon); UpdateWorkFlowRibbonName(properties[Settings.Default.arasPrimaryLinkItemId].Value, MyRibbon.WorkflowNameRibbonLabel); UpdateActivityRibbonName(properties[Settings.Default.arasPrimaryLinkItemId].Value, MyRibbon.ActivityRibbonLabel, MyRibbon.CompleteTaskButton); }
public void Application_close(string filename, OfficeConnectorExtensionAddinRibbon MyRibbon) { if (filename.Contains("mso_viablecopy")) // hack to get around office connector opening and closing document when doing a Save to Aras { MyRibbon.WorkflowNameRibbonLabel.Label = ""; MyRibbon.ActivityRibbonLabel.Label = ""; MyRibbon.CompleteTaskButton.Enabled = false; MyRibbon.PromoteButton.Enabled = false; } }
public Innovator Connect_to_Aras(OfficeConnectorExtensionAddinRibbon MyRibbon) { string url = ""; string db = ""; string windowauth = ""; string user = ""; string path = Environment.GetEnvironmentVariable("Appdata") + "\\OfficeConnector\\config.xml"; if (System.IO.File.Exists(path)) { XmlReader config = XmlReader.Create(path); config.ReadToDescendant("innovator"); config.MoveToAttribute("innovatorServerName"); url = config.Value; config.MoveToAttribute("innovatorDatabaseName"); db = config.Value; config.MoveToAttribute("innovatorUserName"); user = config.Value; config.MoveToAttribute("isWindowsAuthenticated"); windowauth = config.Value; if (windowauth == "True") { WinAuthHttpServerConnection winnconn = IomFactory.CreateWinAuthHttpServerConnection(url, db); Item login_result = winnconn.Login(); if (login_result.isError()) { System.Windows.Forms.MessageBox.Show("Login failed. Check configfile for login information ", "Login Failed"); return(null); } return(IomFactory.CreateInnovator(winnconn)); } else //Office connector set up but windowauth not set up so use login information from tab. { Common.LoginForm loginform = new LoginForm(); loginform.URLTextBox.Text = url; loginform.DBsComboBox.Text = db; loginform.LoginTextBox.Text = user; loginform.ShowDialog(); return(loginform.Inn); } } else //Office Connector not set up so use the add-in tab information { Common.LoginForm loginform = new LoginForm(); loginform.ShowDialog(); return(loginform.Inn); } }
public void Complete_Activity(Core.DocumentProperties properties, OfficeConnectorExtensionAddinRibbon MyRibbon) { List <Core.DocumentProperty> propertylist = properties.Cast <Core.DocumentProperty>().ToList(); bool PrimaryLinkItemIdexist = propertylist.Where(x => x.Name == Settings.Default.arasPrimaryLinkItemId).Any(); if (PrimaryLinkItemIdexist) { if ((inn = Connect_to_Aras(MyRibbon)) != null) { ActivityForm AF = new ActivityForm() { inn = inn, primarylinkedid = properties[Settings.Default.arasPrimaryLinkItemId].Value }; AF.ShowDialog(); Updatelabels(properties, MyRibbon); MyRibbon.CompleteTaskButton.Enabled = !String.IsNullOrEmpty(MyRibbon.WorkflowNameRibbonLabel.Label); } } }
public void Complete_Promote(Core.DocumentProperties properties, OfficeConnectorExtensionAddinRibbon MyRibbon) { //execute the AML to promote if ((inn = Connect_to_Aras(MyRibbon)) != null) { Item result = inn.applyAML(AddtoItem(Settings.Default.promoteAML.Replace("document.id=", "document.id='" + properties[Settings.Default.ArasDocumentId].Value + "'\">"), "state", MyRibbon.NextStateComboBox.Text)); XmlReader readerresult = XmlReader.Create(new StringReader(result.ToString())); if (readerresult.ReadToDescendant("faultcode")) { readerresult.Read(); string error = readerresult.Value; if (error.Contains("IsLocked")) { System.Windows.Forms.MessageBox.Show("Document needs to be locked before promoting"); } else { System.Windows.Forms.MessageBox.Show(error); } } //Updatelabels(properties, MyRibbon); } }
public void Refresh_ribbon(Core.DocumentProperties properties, OfficeConnectorExtensionAddinRibbon MyRibbon) { if ((inn = Connect_to_Aras(MyRibbon)) != null) { List <Core.DocumentProperty> propertylist = properties.Cast <Core.DocumentProperty>().ToList(); bool PrimaryLinkItemIdexist = propertylist.Where(x => x.Name == Settings.Default.arasPrimaryLinkItemId).Any(); if (PrimaryLinkItemIdexist) { UpdateWorkFlowRibbonName(properties[Settings.Default.arasPrimaryLinkItemId].Value, MyRibbon.WorkflowNameRibbonLabel); UpdateActivityRibbonName(properties[Settings.Default.arasPrimaryLinkItemId].Value, MyRibbon.ActivityRibbonLabel, MyRibbon.CompleteTaskButton); } bool DocumentIdexist = propertylist.Where(x => x.Name == Settings.Default.ArasDocumentId).Any(); if (DocumentIdexist) { UpdateLifeCycleRibbonName(properties[Settings.Default.ArasDocumentId].Value, MyRibbon.LifeCycleRibbonLabel); UpdateStateRibbonName(properties[Settings.Default.ArasDocumentId].Value, MyRibbon.StateNameRibbonLabel); UpdateNextStateComboBox(properties[Settings.Default.ArasDocumentId].Value, MyRibbon); } MyRibbon.PromoteButton.Enabled = !String.IsNullOrEmpty(MyRibbon.NextStateComboBox.Text); //MyRibbon.CompleteTaskButton.Enabled = !MyRibbon.WorkflowNameRibbonLabel.Label.Contains("Not Assigned"); } }