Beispiel #1
0
        public async Task <D365ServiceResponse> GetClientUpcomingAppointments(string RecordId)
        {
            D365CrudService service = new D365CrudService();
            QueryFilter     filter  = new QueryFilter();

            filter.AddCriteria(D365Appointment.STATUS_FIELD, ComparisonOperators.Equal, D365Appointment.CONFIRMED_STATUS);
            filter.AddCriteria(D365Appointment.CLIENT_ID_FIELD, ComparisonOperators.Equal, RecordId);
            filter.AddCriteria(D365Appointment.START_DATE_FIELD, ComparisonOperators.GreaterThan, DateTime.Now.Date);
            RelatedEntity branch = new RelatedEntity()
            {
                IdField = D365Appointment.BRANCH_ID_FIELD,
                Fields  = new SelectFieldsList(Branch.FIELDS)
            };
            RelatedEntity advisor = new RelatedEntity()
            {
                IdField = D365Appointment.ADVISOR_ID_NAV_FIELD,
                Fields  = new SelectFieldsList(SystemUser.FIELDS)
            };

            RetreiveMultipleRequest request = new RetreiveMultipleRequest()
            {
                EntityName      = D365Appointment.ENTITY_NAME,
                Fields          = new SelectFieldsList(D365Appointment.FIELDS),
                Filter          = filter,
                RelatedEntities = new RelatedEntity[2] {
                    branch, advisor
                }
            };
            D365ServiceResponse response = await service.RetreiveMultiple(request);

            return(response);
        }
Beispiel #2
0
        public async Task <D365ServiceResponse> GetAppointmentTypes()
        {
            //DataServiceResponse<List<EntityStatus>> response = await GetData<List<EntityStatus>>(SERVICE_URL);
            //if (response.Success)
            //{
            //    AppointmentTypes = response.Data;
            //    return true;
            //}
            D365CrudService service = new D365CrudService();
            QueryFilter     filter  = new QueryFilter();

            filter.AddCriteria(AppointmentReason.STATE_FIELD, ComparisonOperators.Equal, 1);
            RetreiveMultipleRequest request = new RetreiveMultipleRequest()
            {
                EntityName = AppointmentReason.ENTITY_NAME,
                Filter     = filter,
                Fields     = new SelectFieldsList(AppointmentReason.FIELDS)
            };
            D365ServiceResponse response = await service.RetreiveMultiple(request);

            return(response);
        }
        public async Task <D365ServiceResponse> GetClientByClientNumber(string ClientNumber)
        {
            D365CrudService service       = new D365CrudService();
            RelatedEntity   relatedBranch = new RelatedEntity()
            {
                IdField = Client.BRANCH_ID_FIELD,
                Fields  = new SelectFieldsList(Branch.FIELDS)
            };
            RetreiveRequest request = new RetreiveRequest()
            {
                EntityName      = Client.ENTITY_NAME,
                Fields          = new SelectFieldsList(Client.FIELDS),
                IsAlternateKey  = true,
                IdValue         = ClientNumber,
                KeyFieldName    = Client.ALT_KEY,
                RelatedEntities = new RelatedEntity[1] {
                    relatedBranch
                }
            };

            D365ServiceResponse response = await service.GetRecordById(request);

            return(response);
        }