コード例 #1
0
        public static EntityReference getRateTable(EntityReference resRef, ContextWrapper contextWrapper)
        {
            EntityReference rateTableRef = null;
            ColumnSet       userCols     = new ColumnSet("fsip_ratetable");
            Entity          res          = contextWrapper.service.Retrieve(resRef.LogicalName, resRef.Id, userCols);

            if (res != null)
            {
                rateTableRef = RRUtils.getEntityReference(res, "fsip_ratetable");
            }
            return(rateTableRef);
        }
コード例 #2
0
        public static EntityCollection cloneEntityCollection(EntityCollection source)
        {
            EntityCollection ret = new EntityCollection();

            foreach (Entity sourceEntity in source.Entities)
            {
                EntityReference sourceParty = RRUtils.getEntityReference(sourceEntity, "partyid");
                Entity          newParty    = new Entity("activityparty");
                newParty["partyid"] = new EntityReference(sourceParty.LogicalName, sourceParty.Id);
                ret.Entities.Add(newParty);
            }

            return(ret);
        }
コード例 #3
0
        public Config(ContextWrapper contextWrapper)
        {
            string fetchXml = @"
            <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' no-lock='true'>
              <entity name='new_mapconfiguration'>
                <attribute name='fsip_approvesawhentimecardsapproved' />
                <attribute name='fsip_autogeneratebuildingid' />
                <attribute name='fsip_createprojectnumbers' />
                <attribute name='fsip_createtimecardswhensaismarkeddone' />
                <attribute name='fsip_defaultpaymentterm' />
                <attribute name='fsip_defaulttaxscheduleforaccounts' />
                <attribute name='fsip_defaulttaxscheduleforfreight' />
                <attribute name='fsip_enableinvoicetax' />
                <attribute name='fsip_enablequotetax' />
                <attribute name='fsip_enableworkordertax' />
                <attribute name='fsip_erpintegration' />
                <attribute name='fsip_externalbuildinglink' />
                <attribute name='fsip_mapsaactualtimestoscheduled' />
                <attribute name='fsip_overheadpercent' />
                <attribute name='fsip_retainageproduct' />
                <attribute name='fsip_syncsascheduledtimestoactual' />
                <attribute name='fsip_useoverridecostsinwototals' />
                <attribute name='new_googlekey' />
              </entity>
            </fetch>";

            EntityCollection collection = contextWrapper.service.RetrieveMultiple(new FetchExpression(fetchXml));

            // there must be one and only one config record
            switch (collection.Entities.Count)
            {
            case 0:
                throw new InvalidPluginExecutionException("There is no configuration record. Please set one up in the 'Settings' area.");

            case 1:
                Entity config = collection.Entities[0];

                _approvesawhentimecardsapproved    = RRUtils.getBoolValue(config, "fsip_approvesawhentimecardsapproved");
                _autogeneratebuildingid            = RRUtils.getBoolValue(config, "fsip_autogeneratebuildingid");
                _createProjectNumbers              = RRUtils.getBoolValue(config, "fsip_createprojectnumbers");
                _createtimecardswhensaismarkeddone = RRUtils.getBoolValue(config, "fsip_createtimecardswhensaismarkeddone");
                _defaultPaymentTerm            = RRUtils.getEntityReference(config, "fsip_defaultpaymentterm");
                _defaulttaxscheduleforaccounts = RRUtils.getEntityReference(config, "fsip_defaulttaxscheduleforaccounts");
                _defaulttaxscheduleforfreight  = RRUtils.getEntityReference(config, "fsip_defaulttaxscheduleforfreight");
                _enableinvoicetax            = RRUtils.getBoolValue(config, "fsip_enableinvoicetax");
                _enablequotetax              = RRUtils.getBoolValue(config, "fsip_enablequotetax");
                _enableworkordertax          = RRUtils.getBoolValue(config, "fsip_enableworkordertax");
                _erpIntegration              = RRUtils.getIntValue(config, "fsip_erpintegration");
                _externalBuildingLink        = RRUtils.getIntValue(config, "fsip_externalbuildinglink");
                _googleApiKey                = RRUtils.getStringValue(config, "new_googlekey");
                _mapsaactualtimestoscheduled = RRUtils.getBoolValue(config, "fsip_mapsaactualtimestoscheduled");
                _overheadPct                  = RRUtils.getDecimalValue(config, "fsip_overheadpercent");
                _retainageProduct             = RRUtils.getEntityReference(config, "fsip_retainageproduct");
                _syncsascheduledtimestoactual = RRUtils.getBoolValue(config, "fsip_syncsascheduledtimestoactual");
                _useoverridecostsinwototals   = RRUtils.getBoolValue(config, "fsip_useoverridecostsinwototals");;

                break;

            default:
                throw new InvalidPluginExecutionException("More than one configuration record found. Please ensure only one Config record exisits.");
            }
        }