Exemplo n.º 1
0
        public JsonResult LoadStaticData()
        {
            ms_oLog.Debug("Broker loading CRM details started...");

            BrokerStaticDataActionResult oResult;

            try {
                oResult = this.m_oServiceClient.Instance.BrokerLoadStaticData(
                    false,
                    UiCustomerOrigin.Get().CustomerOriginID
                    );
            } catch (Exception e) {
                ms_oLog.Alert(e, "Broker loading static data failed.");

                oResult = new BrokerStaticDataActionResult {
                    MaxPerNumber = 3,
                    MaxPerPage   = 10,
                    Files        = new FileDescription[0],
                    Terms        = "",
                    TermsID      = 0,
                };
            }             // try

            ms_oLog.Debug("Broker loading CRM details complete.");

            return(Json(new {
                success = true,
                data = oResult,
            }, JsonRequestBehavior.AllowGet));
        }         // LoadStaticData
Exemplo n.º 2
0
        private IEnumerable <FileDescription> Load(ServiceClient oServiceClient, int originID)
        {
            log.Debug("Loading broker marketing files...");

            BrokerStaticDataActionResult flar = null;

            try {
                flar = oServiceClient.Instance.BrokerLoadStaticData(true, originID);
            } catch (Exception e) {
                log.Alert(e, "Failed to load broker marketing files.");
            }             // try

            FileDescription[] oResult = (flar == null ? null : flar.Files) ?? new FileDescription[0];

            log.Debug("Loading broker marketing files complete, {0} file(s) loaded.", oResult.Length);

            return(oResult);
        }         // Load
Exemplo n.º 3
0
        }         // BrokerUpdatePassword

        public BrokerStaticDataActionResult BrokerLoadStaticData(bool bLoadFilesOnly, int originID)
        {
            var oResult = new BrokerStaticDataActionResult {
                MaxPerNumber = 3,
                MaxPerPage   = 10,
                Files        = new FileDescription[0],
                Terms        = "",
                TermsID      = 0,
            };

            try {
                BrokerLoadMarketingFiles oInstance;

                ActionMetaData oMetaData = ExecuteSync(out oInstance, null, null, originID);

                if (oMetaData.Status == ActionStatus.Done)
                {
                    oResult.Files = oInstance.Files.ToArray();
                }
            }
            catch (Exception e) {
                Log.Alert(e, "Failed to retrieve marketing files.");
            }             // try

            if (bLoadFilesOnly)
            {
                return(oResult);
            }

            try {
                BrokerLoadCurrentTerms oInstance;

                ActionMetaData oMetaData = ExecuteSync(out oInstance, null, null, originID);

                if (oMetaData.Status == ActionStatus.Done)
                {
                    oResult.Terms   = oInstance.Terms;
                    oResult.TermsID = oInstance.ID;
                }                 // if
            }
            catch (Exception e) {
                Log.Alert(e, "Failed to retrieve terms.");
            }             // try

            try {
                BrokerLoadSmsCount oInstance;

                ActionMetaData oMetaData = ExecuteSync(out oInstance, null, null);

                if (oMetaData.Status == ActionStatus.Done)
                {
                    oResult.MaxPerNumber = oInstance.MaxPerNumber;
                    oResult.MaxPerPage   = oInstance.MaxPerPage;
                }                 // if
            }
            catch (Exception e) {
                Log.Alert(e, "Failed to retrieve SMS counts.");
            }             // try

            try {
                CrmLoadLookups oInstance;

                ActionMetaData oMetaData = ExecuteSync(out oInstance, null, null);

                if (oMetaData.Status == ActionStatus.Done)
                {
                    oResult.Crm = new CrmStaticModel {
                        CrmActions  = oInstance.Actions,
                        CrmRanks    = oInstance.Ranks,
                        CrmStatuses = oInstance.Statuses.Where(s => !s.IsBroker.HasValue || !s.IsBroker.Value).ToList(),
                    };
                }                 // if
            }
            catch (Exception e) {
                Log.Alert(e, "Failed to retrieve SMS counts.");
            }             // try

            return(oResult);
        }         // BrokerLoadStaticData