Пример #1
0
 private void GetFromFXB()
 {
     var messageBusEventArgs = new MessageBusEventArgs("FetchXML Builder");
     var fXBMessageBusArgument = new FXBMessageBusArgument(FXBMessageBusRequest.FetchXML)
     {
         FetchXML = fetchXml
     };
     messageBusEventArgs.TargetArgument = fXBMessageBusArgument;
     OnOutgoingMessage(this, messageBusEventArgs);
 }
 private void tsbFxbEdit_Click(object sender, EventArgs e)
 {
     var selectedAttribute = lvAttributes.SelectedItems[0];
     var attributeSchemaName = selectedAttribute.Tag.ToString();
     var entityName = selectedAttribute.SubItems[3].Text;
     var fetchXml = string.Format(@"
             <fetch count='500' >
                 <entity name='{0}' >
                 <attribute name='{1}' />
                 <filter>
                     <condition attribute='statecode' operator='eq' value='0' />
                 </filter>
                 </entity>
             </fetch>", entityName, attributeSchemaName);
     var messageBusEventArgs = new MessageBusEventArgs("FetchXML Builder");
     var fXBMessageBusArgument = new FXBMessageBusArgument(FXBMessageBusRequest.FetchXML)
     {
         FetchXML = fetchXml
     };
     messageBusEventArgs.TargetArgument = fXBMessageBusArgument;
     OnOutgoingMessage(this, messageBusEventArgs);
 }
Пример #3
0
 private void tsbEditFetch_Click(object sender, EventArgs e)
 {
     if (this.Service == null)
     {
         MessageBox.Show("Please connect to CRM.", "Edit query", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     Entity view = ViewEditor != null ? ViewEditor.ToEntity() : null;
     if (view == null || string.IsNullOrEmpty(view.LogicalName))
     {
         MessageBox.Show("First select a view to design.", "Edit query", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     var messageBusEventArgs = new MessageBusEventArgs("FetchXML Builder");
     var fXBMessageBusArgument = new FXBMessageBusArgument(FXBMessageBusRequest.FetchXML);
     if (ViewEditor != null && ViewEditor.FetchXml != null && ViewEditor.FetchXml.OuterXml != null)
     {
         fXBMessageBusArgument.FetchXML = ViewEditor.FetchXml.OuterXml;
     }
     messageBusEventArgs.TargetArgument = fXBMessageBusArgument;
     try
     {
         OnOutgoingMessage(this, messageBusEventArgs);
     }
     catch (System.IO.FileNotFoundException)
     {
         if (MessageBox.Show("FetchXML Builder is not installed.\nDownload latest version from\n\nhttp://fxb.xrmtoolbox.com", "FetchXML Builder",
             MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
         {
             DownloadFXB();
         }
     }
     catch (PluginNotFoundException)
     {
         var xtbver = ((System.Windows.Forms.Control)(((System.Windows.Forms.ContainerControl)(this)).ParentForm)).ProductVersion;
         if (xtbver == "1.2015.7.6")
         {
             MessageBox.Show("XrmToolBox version " + xtbver + " has a minor problem integrating plugins.\nHang in there - new version will be released soon!", "Launching FetchXML Builder",
                 MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else if (MessageBox.Show("FetchXML Builder was not found.\nDownload latest version from\n\nhttp://fxb.xrmtoolbox.com", "FetchXML Builder",
             MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
         {
             DownloadFXB();
         }
     }
 }