示例#1
0
        public ActionResult GetInspectionData(string address)
        {
            address = "%" + address + "%";
            StringBuilder linkFetch = new StringBuilder();

            linkFetch.Append("<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"true\">");
            linkFetch.Append("  <entity name=\"blu_inspectiondetail\">");
            linkFetch.Append("      <attribute name=\"blu_inspectiondetailid\"/>");
            linkFetch.Append("      <attribute name=\"blu_productid\"/>");
            linkFetch.Append("      <attribute name=\"blu_inspectionid\"/>");
            linkFetch.Append("      <link-entity name=\"blu_inspection\" from=\"blu_inspectionid\" to=\"blu_inspectionid\" link-type=\"inner\" alias=\"aa\">");
            linkFetch.Append("          <attribute name=\"blu_inspectionaddress\"/>");
            linkFetch.Append("          <filter type=\"and\">");
            linkFetch.Append("              <condition attribute=\"blu_inspectionaddress\" operator=\"like\" value=\"" + address + "\"/>");
            linkFetch.Append("          </filter>");
            linkFetch.Append("      </link-entity>");
            linkFetch.Append("  </entity>");
            linkFetch.Append("</fetch>");

            // Build fetch request and obtain results.
            RetrieveMultipleRequest efr = new RetrieveMultipleRequest()
            {
                Query = new FetchExpression(linkFetch.ToString())
            };
            EntityCollection entityResults = ((RetrieveMultipleResponse)CrmConnect.GetService().Execute(efr)).EntityCollection;

            return(Json(entityResults.Entities, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult GetPriceListsProductsInspections()
        {
            StringBuilder linkFetch = new StringBuilder();

            linkFetch.Append("<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"true\">");
            linkFetch.Append("  <entity name=\"productpricelevel\">");
            linkFetch.Append("      <attribute name=\"productid\"/>");
            linkFetch.Append("      <attribute name=\"amount\"/>");
            linkFetch.Append("      <attribute name=\"uomid\"/>");
            linkFetch.Append("      <link-entity name=\"product\" from=\"productid\" to=\"productid\" link-type=\"outer\" alias=\"pp\">");
            linkFetch.Append("          <attribute name=\"parentproductid\"/>");
            linkFetch.Append("          <attribute name=\"name\"/>");
            linkFetch.Append("      </link-entity>");
            linkFetch.Append("      <link-entity name=\"pricelevel\" from=\"pricelevelid\" to=\"pricelevelid\" link-type=\"outer\" alias=\"pl\">");
            linkFetch.Append("          <attribute name=\"pricelevelid\"/>");
            linkFetch.Append("          <attribute name=\"name\"/>");
            linkFetch.Append("      </link-entity>");
            linkFetch.Append("  </entity>");
            linkFetch.Append("</fetch>");

            // Build fetch request and obtain results.
            RetrieveMultipleRequest efr = new RetrieveMultipleRequest()
            {
                Query = new FetchExpression(linkFetch.ToString())
            };
            EntityCollection entityResults = ((RetrieveMultipleResponse)CrmConnect.GetService().Execute(efr)).EntityCollection;

            return(Json(entityResults.Entities, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        private static void Main(string[] args)
        {
            var service = CrmConnect.GetService();

            var entity = new Entity
            {
                ["name"]          = "Test Account",
                ["emailaddress1"] = "*****@*****.**",
                ["telephone1"]    = "0113452255",
            };

            service.Create(entity);


            Console.WriteLine("Done");
            Console.Read();
        }
示例#4
0
        public ActionResult GetInspectionDetailByInspectionId(Guid inspectionId)
        {
            StringBuilder linkFetch = new StringBuilder();

            linkFetch.Append("<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"true\">");
            linkFetch.Append("  <entity name=\"blu_inspectiondetail\">");
            linkFetch.Append("      <attribute name=\"blu_inspectiondetailid\"/>");
            linkFetch.Append("      <attribute name=\"blu_name\"/>");
            linkFetch.Append("      <attribute name=\"blu_productid\"/>");
            linkFetch.Append("      <attribute name=\"blu_inspectionid\"/>");
            linkFetch.Append("      <filter type=\"blu_inspection\">");
            linkFetch.Append("          <attribute name=\"blu_inspectionid\" operator=\"eq\" value=\"" + inspectionId + "\"/>");
            linkFetch.Append("      </filter>");
            linkFetch.Append("  </entity>");
            linkFetch.Append("</fetch>");
            // Build fetch request and obtain results.
            RetrieveMultipleRequest efr = new RetrieveMultipleRequest()
            {
                Query = new FetchExpression(linkFetch.ToString())
            };
            EntityCollection entityResults = ((RetrieveMultipleResponse)CrmConnect.GetService().Execute(efr)).EntityCollection;

            return(Json(entityResults.Entities, JsonRequestBehavior.AllowGet));
        }
示例#5
0
 public HttpClient GetHttpClient()
 {
     return(CrmConnect.GetHttpClient());
 }
示例#6
0
 public OrganizationServiceProxy GetService()
 {
     return(CrmConnect.GetService());
 }