public CRMEntityOwnership CRMChangeOwner(CRMEntityOwnership crmEntityOwnership) { OrganizationServiceProxy _serviceProxy; IOrganizationService _service; //res = ""; using (_serviceProxy = GetCRMConnection()) { // This statement is required to enable early-bound type support. _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior()); _service = (IOrganizationService)_serviceProxy; Microsoft.Crm.Sdk.Messages.AssignRequest req = new Microsoft.Crm.Sdk.Messages.AssignRequest(); req.Assignee = new EntityReference(crmEntityOwnership.Assignee, new Guid(crmEntityOwnership.AssigneeId)); req.Target = new EntityReference(crmEntityOwnership.Target, new Guid(crmEntityOwnership.TargetId)); try { Microsoft.Crm.Sdk.Messages.AssignResponse resp = (Microsoft.Crm.Sdk.Messages.AssignResponse)_service.Execute(req); //res = resp.ResponseName; } catch (Exception ex) { throw; } } return crmEntityOwnership; }
public CRMEntityOwnership CRMChangeOwner(CRMEntityOwnership crmEntityOwnership) { OrganizationServiceProxy _serviceProxy; IOrganizationService _service; //res = ""; using (_serviceProxy = GetCRMConnection()) { // This statement is required to enable early-bound type support. _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior()); _service = (IOrganizationService)_serviceProxy; Microsoft.Crm.Sdk.Messages.AssignRequest req = new Microsoft.Crm.Sdk.Messages.AssignRequest(); req.Assignee = new EntityReference(crmEntityOwnership.Assignee, new Guid(crmEntityOwnership.AssigneeId)); req.Target = new EntityReference(crmEntityOwnership.Target, new Guid(crmEntityOwnership.TargetId)); try { Microsoft.Crm.Sdk.Messages.AssignResponse resp = (Microsoft.Crm.Sdk.Messages.AssignResponse)_service.Execute(req); //res = resp.ResponseName; } catch (Exception ex) { throw; } } return(crmEntityOwnership); }
public void AtribuirEquipeParaPedido(Guid Equipe, Guid Pedido) { Microsoft.Crm.Sdk.Messages.AssignRequest assignRequest = new Microsoft.Crm.Sdk.Messages.AssignRequest() { Assignee = new Microsoft.Xrm.Sdk.EntityReference { LogicalName = "team", Id = Equipe }, Target = new Microsoft.Xrm.Sdk.EntityReference("salesorder", Pedido) }; this.Execute(assignRequest); }
public bool MudarProprietarioRegistro(string tipoProprietario, Guid idProprietarioNovo, string entidadeDestino, Guid idEntidadeDestino) { Microsoft.Crm.Sdk.Messages.AssignRequest assignRequest = new Microsoft.Crm.Sdk.Messages.AssignRequest() { Assignee = new Microsoft.Xrm.Sdk.EntityReference { LogicalName = tipoProprietario, //team ou systemuser Id = idProprietarioNovo }, Target = new Microsoft.Xrm.Sdk.EntityReference(entidadeDestino, idEntidadeDestino) }; if (this.Execute(assignRequest).Results.Any()) { return(false); } else { return(true); } }
/// <summary> /// Mudar Proprietário do registro /// </summary> /// <param name="ObjInstanciado">Um objeto instanciado da classe</param> /// <param name="proprietario">Novo Proprietário</param> /// <param name="TipoProprietario">Novo Tipo de Proprietário</param> /// <returns></returns> public bool MudarProprietarioRegistro(T objProprietario, Guid idProprietarioNovo, T entidadeDestino, Guid idEntidadeDestino) { Microsoft.Crm.Sdk.Messages.AssignRequest assignRequest = new Microsoft.Crm.Sdk.Messages.AssignRequest() { Assignee = new Microsoft.Xrm.Sdk.EntityReference { LogicalName = this.ObterNomeEntidade(objProprietario), Id = idProprietarioNovo }, Target = new Microsoft.Xrm.Sdk.EntityReference(this.ObterNomeEntidade(entidadeDestino), idEntidadeDestino) }; if (this.Execute(assignRequest).Results.Any()) { return(false); } else { return(true); } }
public bool AlterarProprietario(Guid proprietario, string TipoProprietario, Guid invoicedetail) { Microsoft.Crm.Sdk.Messages.AssignRequest assignRequest = new Microsoft.Crm.Sdk.Messages.AssignRequest() { Assignee = new Microsoft.Xrm.Sdk.EntityReference { LogicalName = TipoProprietario, Id = proprietario }, Target = new Microsoft.Xrm.Sdk.EntityReference("invoicedetail", invoicedetail) }; if (this.Execute(assignRequest).Results.Count > 0) { return(true); } else { return(false); } }
public bool MudarProprietario(Guid proprietario, string TipoProprietario) { Microsoft.Crm.Sdk.Messages.AssignRequest assignRequest = new Microsoft.Crm.Sdk.Messages.AssignRequest() { Assignee = new Microsoft.Xrm.Sdk.EntityReference { LogicalName = TipoProprietario, Id = proprietario }, Target = new Microsoft.Xrm.Sdk.EntityReference("itbc_acessosextranetcontatos", proprietario) }; if (this.Execute(assignRequest).Results.Any()) { return(true); } else { return(false); } }