/// <summary> /// Retrieve Entity from ICrmservice /// </summary> /// <param name="iservice">ICrmService</param> /// <param name="entityName">Entity Name</param> /// <param name="entityGuid">Entity Guid(Guid)</param> /// <param name="retrieveAllColumns">True to retrieve all columns </param> /// <returns></returns> public static DynamicEntity RetriveDynamicEntity(this ICrmService iservice, String entityName, Guid entityGuid, Boolean retrieveAllColumns) { // Create/Set the Target object. TargetRetrieveDynamic targetRetrieve = new TargetRetrieveDynamic { EntityName = entityName, EntityId = (entityGuid) }; // Create/Set the Retrieve object. RetrieveRequest retrieve = new RetrieveRequest(); retrieve.Target = targetRetrieve; if (retrieveAllColumns == true) { retrieve.ColumnSet = new AllColumns(); } //// Indicate to retrieve all columns retrieve.ReturnDynamicEntities = true; // Indicate that the BusinessEntity should be retrieved as a DynamicEntity. // Execute the request. RetrieveResponse retrieved = (RetrieveResponse)iservice.Execute(retrieve); // Extract the DynamicEntity from the request. DynamicEntity retriveEntity = (DynamicEntity)retrieved.BusinessEntity; return(retriveEntity); }
public ActivitySyncService(ILog log, RetrieverSettings settings, ICrmService crmService, IAnytimeCollectService anytimeCollectService) { _log = log; _settings = settings; _crmService = crmService; _anytimeCollectService = anytimeCollectService; }
public CustomerWithCRMService( ICustomerService customerService, ICrmService crmService) : base(customerService) { //crm servis call _crmServices = crmService; }
public bool ExportPagesFromOrders( IEnumerable <Order> orders, ICrmService crmService, ILocationService locationService) { IEnumerable <PageXml> pages = GetPagesFromOrders(orders, crmService, locationService); foreach (var pageXml in pages) { string customerName = pageXml.Customer.Name; string fileName = string.Format("CustomerOrders-{0}-{1}.xml", customerName, DateTime.Now); string filePath = Path.Combine(exportFolder, fileName); if (!overwrite && File.Exists(filePath)) { return(false); } XmlSerializer serializer = new XmlSerializer(typeof(PageXml)); using (StreamWriter sw = File.CreateText(filePath)) { serializer.Serialize(sw, pageXml); } } return(true); }
public ExportDataProvider(IRepository repository, ICrmService crmService) { this.repository = repository; this.crmService = crmService; Settings = ExportSettings.Default; }
public void EnrichWithExternalData(PageXml content, PageData externalData, IRepository repository, ICrmService crmService, int salesOrders, bool addCustomerDetails, ILocationService locationService) { // enrich with externalData other than customer if (externalData.CustomerData != null) { // enrich with externalData.CustomerData } else { CustomerInfo customerData = crmService.GetCustomerInfo(content.Customer.Name); } if (salesOrders > 0) { var orders = repository.GetEntities <Order>() .Where(o => o.Customer.CompanyName == content.Customer.Name) .OrderBy(o => o.OrderDate) .Take(salesOrders); //enrich with orders } }
public async Task <CrmEntityCollection> ExecuteAsync(ICrmService crmService, string entityName, XDocument document, Guid?userId = null) { try { var userInfo = ContextContainer.GetValue <UserInfo>(ContextExtensionTypes.CurrentUserInfo); var dicHead = new Dictionary <string, IEnumerable <string> >(); dicHead.Add("Prefer", new List <string>() { "odata.include-annotations=\"*\"" }); var fetchRequest = new CrmRetrieveMultipleFetchRequestMessage() { EntityName = entityName, FetchXml = document, ProxyUserId = userInfo?.systemuserid }; fetchRequest.Headers.Add("Prefer", dicHead["Prefer"]); var crmResponseMessage = await crmService.Execute(fetchRequest); var resultsList = crmResponseMessage as CrmRetrieveMultipleFetchResponseMessage; return(resultsList.Value); } catch (Exception ex) { return(new CrmEntityCollection()); } }
private void MapRelationshipAttributesToEntity(Entity source, ICrmService crm, OrganizationServiceContext context) { foreach (var property in GetProperties(this)) { var attribute = EntityRelationshipAttribute(property); var value = property.GetValue(this); if (attribute == null || value == null) { continue; } foreach (var relatedModel in EnumerableRelationshipModels(value)) { var shouldMap = ShouldMapRelationship(property.Name, relatedModel, crm); if (!shouldMap) { continue; } var target = relatedModel.ToEntity(crm, context); crm.AddLink(source, new Relationship(attribute.Name), target, context); } } }
public CrmController(ICrmService crmService, ICrmTypeService crmTypeService, ICrmStatusService crmStatusService, ICrmPriorityService crmPriorityService, ICustomerSourceService customerSourceService, IProductGroupService productGroupService, ICustomerGroupService customerGroupService, ICustomerVipService customerVipService, IProvinceService provinceService, IUserService userService, IMapper mapper, ILogger <CrmController> logger) : base(logger) { _crmService = crmService; _crmTypeService = crmTypeService; _crmStatusService = crmStatusService; _crmPriorityService = crmPriorityService; _customerSourceService = customerSourceService; _productGroupService = productGroupService; _customerGroupService = customerGroupService; _customerVipService = customerVipService; _provinceService = provinceService; _userService = userService; _mapper = mapper; }
public void ExecuteDeleteSteps(ICrmService crmService) { var requestsQueue = new Queue <OrganizationRequest>(deleteStageSteps); while (requestsQueue.Count > 0) { var request = requestsQueue.Dequeue(); try { var res = crmService.ExecuteRequest(request); } catch (Exception e) { string message = e.Message; if (request is DeleteRequest deleteRequest) { var target = deleteRequest.Target; message = $"Error while trying to delete {target.LogicalName}/{target.Id}: {message}"; } Log.Error(message, e); Debugger.Break(); } } }
public PageXml GetPageForOrders(IEnumerable <Order> orders, ICrmService crmService, ILocationService locationService) { string customerName = GetCustomerNameFromFirstOrder(); PageXml content = new PageXml { Customer = new CustomerXml { Name = customerName } }; if (crmService != null) { CustomerInfo customerData = crmService.GetCustomerInfo(content.Customer.Name); //enrich with data from crm } //enrich content with orders if (locationService != null) { foreach (var address in content.Customer.Addresses) { Coordinates coordinates = locationService.GetCoordinates(address.City, address.Street, address.Number); if (coordinates != null) { address.Coordinates = string.Format("{0},{1}", coordinates.Latitude, coordinates.Longitude); } } } return(content); }
public string ProcessSurvey(string surveyData, ICrmService crmService) { var failedSurveys = string.Empty; if (string.IsNullOrWhiteSpace(surveyData)) { throw new ArgumentNullException(Constants.Parameters.DataJson); } if (crmService == null) { throw new ArgumentNullException(Constants.Parameters.CrmService); } try { var response = crmService.ExecuteActionForSurveyCreate(surveyData); if (response == null) { throw new InvalidOperationException(Constants.Messages.ResponseNull); } failedSurveys = ProcessResponse(response); } catch (Exception ex) { Trace.TraceError("Unexpected error occured at ProcessSurvey::Message:{0}||Trace:{1}", ex.Message, ex.StackTrace.ToString()); return(Constants.General.Error); } return(failedSurveys); }
public HubService(ICrmService crmService, IHubIntegration crmIntegration, ILogger <HubService> logger, IHostingEnvironment env) { _env = env; _logger = logger; _crmService = crmService; _crmIntegration = crmIntegration; }
public MainDialog(IDialogFactory dialogFactory, ICrmService crmService, string personId, DebugOptions debugOptions = DebugOptions.None) { this.dialogFactory = dialogFactory; this.crmService = crmService; this.personId = personId; this.debugOptions = debugOptions; }
public AccountQueries(ICrmService crmService) { if (crmService == null) { throw new ArgumentNullException(nameof(crmService)); } _crmService = crmService; }
public PortalService(CrmServiceContext organizationServiceContext, ICrmService crmService) : base(organizationServiceContext) { Logger.Trace(CultureInfo.InvariantCulture, TraceMessageHelper.EnteredMethod, SystemTypeName, MethodBase.GetCurrentMethod().Name); CrmService = crmService ?? throw new ArgumentNullException(nameof(crmService)); Logger.Trace(CultureInfo.InvariantCulture, TraceMessageHelper.ExitingMethod, SystemTypeName, MethodBase.GetCurrentMethod().Name); }
public TeachingEventUpsertOperationValidator(ICrmService crm) { _crm = crm; RuleFor(operation => operation.ReadableId) .Must((te, _) => BeUniqueReadableId(te)) .WithMessage("Must be unique"); }
public CrmFileBlocksStream(string entityName, Guid entityID, string fileAttributeName, long fileSize, ICrmService crmService, Guid?proxyUserId) { _entityID = entityID; _fileAttributeName = fileAttributeName; _entityID = entityID; _fileSize = fileSize; _crmService = crmService; _proxyUserId = proxyUserId; }
public async Task <IServiceproxyService> Create() { _crmService = StartupHelper.CreateCrmService(); return(await Task <IServiceproxyService> .Run(() => { _serviceproxyService = new ServiceproxyService(_crmService); return _serviceproxyService; })); }
public CandidatesController( ICandidateAccessTokenService accessTokenService, INotifyService notifyService, ICrmService crm) { _accessTokenService = accessTokenService; _notifyService = notifyService; _crm = crm; }
public BaseModel(Entity entity, ICrmService crm, IValidatorFactory vaidatorFactory) : this() { Id = entity.Id; MapFieldAttributesFromEntity(entity); MapRelationshipAttributesFromEntity(entity, crm, vaidatorFactory); NullifyInvalidFieldAttributes(vaidatorFactory); }
public CandidatesController( ICandidateAccessTokenService tokenService, ICrmService crm, IBackgroundJobClient jobClient) { _crm = crm; _tokenService = tokenService; _jobClient = jobClient; }
public async Task <ICustomerService> Create() { _crmService = StartupHelper.CreateCrmService(); return(await Task <ICustomerService> .Run(() => { _customerService = new CustomerService(_crmService); return _customerService; })); }
public async Task <ISysConfigService> Create() { _crmService = StartupHelper.CreateCrmService(); return(await Task <IStoreService> .Run(() => { _sysConfigService = new SysConfigService(_crmService); return _sysConfigService; })); }
public CrmHelper(ICrmService crmService, ILogging logging, ICrmResourceStrings crmResourceStrings) { if (crmService == null) throw new ArgumentNullException("crmService"); if (logging == null) throw new ArgumentNullException("logging"); _crmService = crmService; _logging = logging; _crmResourceStrings = crmResourceStrings; _logging.Write(GetString("LoggingCrmHelperCreated", "Created CrmHelper")); }
public CrmCommonController(ICrmService crmService, ICrmOrganizationService organizationService, ILeadService <Lead> leadService, IMapper mapper) { _crmService = crmService; _organizationService = organizationService; _leadService = leadService; _mapper = mapper; }
public CrmServiceTests() { var mockValidatorFactory = new Mock <IValidatorFactory>(); mockValidatorFactory.Setup(m => m.GetValidator(It.IsAny <Type>())).Returns <IValidator>(null); _mockService = new Mock <IOrganizationServiceAdapter>(); _context = new OrganizationServiceContext(new Mock <IOrganizationService>().Object); _mockService.Setup(mock => mock.Context()).Returns(_context); _crm = new CrmService(_mockService.Object, mockValidatorFactory.Object); }
protected override bool ShouldMap(ICrmService crm) { var alreadyRegistered = !crm.CandidateYetToRegisterForTeachingEvent(CandidateId, EventId); if (alreadyRegistered) { return(false); } return(base.ShouldMap(crm)); }
public AppointmentInfoService(CrmService crmService, IAppointmentInfoRepository appointmentInfoRepository) { _crmService = crmService; _appointmentInfoRepository = appointmentInfoRepository; dicHeadKey = "Prefer"; dicHead = new Dictionary <string, IEnumerable <string> >(); dicHead.Add(dicHeadKey, new List <string>() { "odata.include-annotations=\"*\"" }); }
public CandidatesController( ICandidateAccessTokenService accessTokenService, INotifyService notifyService, ICrmService crm, IAppSettings appSettings) { _accessTokenService = accessTokenService; _notifyService = notifyService; _crm = crm; _appSettings = appSettings; }
public CustomerService(ICrmService crmService) { _crmService = crmService; dicHeadKey = "Prefer"; dicHead = new Dictionary <string, IEnumerable <string> >(); dicHead.Add(dicHeadKey, new List <string>() { "odata.include-annotations=\"*\"" }); pageCount = 10; }
public ViewModelBase() { _settings = SettingsService.Instance; _helper = ActivityTrackerHelper.Instance; if (_settings.CrmVersion != null) { if (_settings.CrmVersion.Major == 8) crmservice = new CrmWebAPIService(); else crmservice = new CrmSoapService(); } }
public CrmEmailProvider() { crmService = DependencyResolver.Current.GetService<ICrmService>(); mailSenderService = DependencyResolver.Current.GetService<IMailSenderService>(); initLists(); }
private void CreateNote(ICrmService crmService, string entityName, Guid entityId, string subject, string body) { // Create the Note object and set the parent object. var note = new annotation { objectid = new Lookup(entityName, entityId), objecttypecode = new EntityNameReference(entityName), subject = subject, notetext = body }; // Set the note text and subject // Create the note crmService.Create(note); }
public MailingController(ICrmService _crmService, IMailSenderService _service, IAlertsProvider _alerts, IArticleService _articleService, IMailAccountsService _mailAccountsService, IAllEmailProvidersService _allEmailProvidersService, ISettingsProvider _settingsProvider, IUsersService _userService, IMailSendingUtilsService _mailSendingUtils) { this.crmService = _crmService; this.settingsProvider = _settingsProvider; this._userService = _userService; this._mailSendingUtils = _mailSendingUtils; service = _service; alerts = _alerts; articleService = _articleService; mailAccountsService = _mailAccountsService; allEmailProvidersService = _allEmailProvidersService; }
public NewsController(ICrmService _crmService, ISettingsProvider _settingsProvider, ITranslationsService _translations) { settingsProvider = _settingsProvider; this.translations = _translations; crmService = _crmService; }