/// <summary>
        /// Function <code>ssCheckRegisteredRole</code> that represents the Service Studio function
        ///  <code>CheckRegisteredRole</code> <p> Description: </p>
        /// </summary>

        public static bool ssCheckRegisteredRole(HeContext heContext, int inParamUserId)
        {
            bool outParamHasRole;

            ExtendedActions.CheckRegisteredRole(heContext, inParamUserId, out outParamHasRole);
            return(outParamHasRole);
        }
        /// <summary>
        /// Action <code>ActionAddress_CreateOrUpdate</code> that represents the Service Studio user action
        ///  <code>Address_CreateOrUpdate</code> <p> Description: This action creates or updates the give
        /// n address.</p>
        /// </summary>
        public static void ActionAddress_CreateOrUpdate(HeContext heContext, ENAddressEntityRecord inParamAddressR, out long outParamAddressId)
        {
            lcoAddress_CreateOrUpdate result    = new lcoAddress_CreateOrUpdate();
            lcvAddress_CreateOrUpdate localVars = new lcvAddress_CreateOrUpdate(inParamAddressR);

            try {
                // new address?
                if (((localVars.inParamAddressR.ssId == Convert.ToInt64(BuiltInFunction.NullIdentifier()))))
                {
                    // creation info
                    // AddressR.Active = True
                    localVars.inParamAddressR.ssActive = true;
                    // AddressR.CreatedDate = CurrDateTime
                    localVars.inParamAddressR.ssCreatedDate = BuiltInFunction.CurrDateTime();
                    // AddressR.CreatedBy = GetUserId
                    localVars.inParamAddressR.ssCreatedBy = BuiltInFunction.GetUserId();
                }

                // update info
                // AddressR.LastUpdatedDate = CurrDateTime
                localVars.inParamAddressR.ssLastUpdatedDate = BuiltInFunction.CurrDateTime();
                // AddressR.LastUpdatedBy = GetUserId
                localVars.inParamAddressR.ssLastUpdatedBy = BuiltInFunction.GetUserId();
                // CreateOrUpdateAddress
                ExtendedActions.CreateOrUpdateAddress(heContext, localVars.inParamAddressR.ChangedAttributes, (((RCAddressRecord)localVars.inParamAddressR)), out localVars.resCreateOrUpdateAddress_outParamId);

                // AddressId = CreateOrUpdateAddress.Id
                result.outParamAddressId = localVars.resCreateOrUpdateAddress_outParamId;
            }             // try

            finally {
                outParamAddressId = result.outParamAddressId;
            }
        }
        /// <summary>
        /// Function <code>ssGetCountry</code> that represents the Service Studio function
        ///  <code>GetCountry</code> <p> Description: </p>
        /// </summary>

        public static RCCountryRecord ssGetCountry(HeContext heContext, long inParamId)
        {
            RCCountryRecord.EnsureInitialized();
            RCCountryRecord outParamRecord;

            ExtendedActions.GetCountry(heContext, inParamId, out outParamRecord);
            return(outParamRecord);
        }
        /// <summary>
        /// Function <code>ssGetUser</code> that represents the Service Studio function <code>GetUser</code>
        ///  <p> Description: </p>
        /// </summary>

        public static RCUserRecord ssGetUser(HeContext heContext, int inParamId)
        {
            RCUserRecord.EnsureInitialized();
            RCUserRecord outParamRecord;

            ExtendedActions.GetUser(heContext, inParamId, out outParamRecord);
            return(outParamRecord);
        }
        /// <summary>
        /// Function <code>ssGetAddressType</code> that represents the Service Studio function
        ///  <code>GetAddressType</code> <p> Description: </p>
        /// </summary>

        public static RCAddressTypeRecord ssGetAddressType(HeContext heContext, long inParamId)
        {
            RCAddressTypeRecord.EnsureInitialized();
            RCAddressTypeRecord outParamRecord;

            ExtendedActions.GetAddressType(heContext, inParamId, out outParamRecord);
            return(outParamRecord);
        }
Beispiel #6
0
        /// <summary>
        /// Action <code>ActionAddressType_GetOrCreateByLabel</code> that represents the Service Studio user
        ///  action <code>AddressType_GetOrCreateByLabel</code> <p> Description: Gets or creates the addres
        /// s type for that label.</p>
        /// </summary>
        public static void ActionAddressType_GetOrCreateByLabel(HeContext heContext, string inParamLabel, out long outParamAddressTypeId)
        {
            lcoAddressType_GetOrCreateByLabel result    = new lcoAddressType_GetOrCreateByLabel();
            lcvAddressType_GetOrCreateByLabel localVars = new lcvAddressType_GetOrCreateByLabel(inParamLabel);

            try {
                // Query datasetGetAddressTypesByLabel
                int datasetGetAddressTypesByLabel_maxRecords = 0;
                localVars.queryResGetAddressTypesByLabel_outParamList = FuncActionAddressType_GetOrCreateByLabel.datasetGetAddressTypesByLabel(heContext, datasetGetAddressTypesByLabel_maxRecords, IterationMultiplicity.Never, out localVars.queryResGetAddressTypesByLabel_outParamCount, localVars.inParamLabel
                                                                                                                                               );

                // exists?
                if (((!localVars.queryResGetAddressTypesByLabel_outParamList.Empty)))
                {
                    // AddressTypeId = GetAddressTypesByLabel.List.Current.AddressType.Id
                    result.outParamAddressTypeId = localVars.queryResGetAddressTypesByLabel_outParamList.CurrentRec.ssENAddressType.ssId;
                }
                else
                {
                    // set AddressType
                    // GetAddressTypesByLabel.List.Current.AddressType.Label = Label
                    localVars.queryResGetAddressTypesByLabel_outParamList.CurrentRec.ssENAddressType.ssLabel = localVars.inParamLabel;
                    // GetAddressTypesByLabel.List.Current.AddressType.Active = True
                    localVars.queryResGetAddressTypesByLabel_outParamList.CurrentRec.ssENAddressType.ssActive = true;
                    // GetAddressTypesByLabel.List.Current.AddressType.CreatedDate = CurrDateTime
                    localVars.queryResGetAddressTypesByLabel_outParamList.CurrentRec.ssENAddressType.ssCreatedDate = BuiltInFunction.CurrDateTime();
                    // GetAddressTypesByLabel.List.Current.AddressType.CreatedBy = GetUserId
                    localVars.queryResGetAddressTypesByLabel_outParamList.CurrentRec.ssENAddressType.ssCreatedBy = BuiltInFunction.GetUserId();
                    // GetAddressTypesByLabel.List.Current.AddressType.LastUpdatedDate = CurrDateTime
                    localVars.queryResGetAddressTypesByLabel_outParamList.CurrentRec.ssENAddressType.ssLastUpdatedDate = BuiltInFunction.CurrDateTime();
                    // GetAddressTypesByLabel.List.Current.AddressType.LastUpdatedBy = GetUserId
                    localVars.queryResGetAddressTypesByLabel_outParamList.CurrentRec.ssENAddressType.ssLastUpdatedBy = BuiltInFunction.GetUserId();
                    // CreateAddressType
                    ExtendedActions.CreateAddressType(heContext, (((RCAddressTypeRecord)localVars.queryResGetAddressTypesByLabel_outParamList.CurrentRec.ssENAddressType)), out localVars.resCreateAddressType_outParamId);

                    // AddressTypeId = CreateAddressType.Id
                    result.outParamAddressTypeId = localVars.resCreateAddressType_outParamId;
                }
            }             // try

            finally {
                outParamAddressTypeId = result.outParamAddressTypeId;
            }
        }
        protected void Application_AcquireRequestState(Object sender, EventArgs e)
        {
            Context.Items["osCurrentPTAName"]     = RequestPtaName;
            Context.Items["osCurrentPTAUserName"] = RequestPtaUserName;
            Context.Items["osIsLoadingScreen"]    = false;
            RunningInfo.InitializeRunningInfo();
            RunningInfo.ESpaceHash         = ConfigurationManager.AppSettings["OutSystems.HubEdition.EspaceCompilationHash"];
            RunningInfo.ESpaceVersionToken = ConfigurationManager.AppSettings["OutSystems.HubEdition.EspaceVersionToken"];
            RunningInfo.ESpaceVersionId    = int.Parse(ConfigurationManager.AppSettings["OutSystems.HubEdition.EspaceVersionID"]);
            RunningInfo.DebugMode          = false;
            // Skips internal pages
            if (Request.FilePath.ToLowerInvariant().EndsWith("/_ping.aspx") || Request.FilePath.ToLowerInvariant().EndsWith("/_queriescoverage.aspx") || Request.FilePath.ToLower().EndsWith("/_debugger.asmx") || Request.FilePath.ToLower().EndsWith("/_debuggerevents.ashx"))
            {
                return;
            }

            if (App == null)
            {
                // Try again
                Application_Start(sender, e);
                if (Application["ApplicationStartError"] != null)
                {
                    ApplicationStartErrorRedirect();
                }
            }

            if (App.Tenant.PhoneConfigException != null)
            {
                Application["ApplicationStartError"] = App.Tenant.PhoneConfigException;
                ApplicationStartErrorRedirect();
            }

            // Session Start
            HeContext heContext = Global.App.OsContext;

            heContext.InitSession();

            var sessionCookieKey = Response.Cookies.AllKeys.FirstIfSingleOrDefault(c => c == CookieActions.GetSessionCookieName());

            if (sessionCookieKey != null)
            {
                var sessionCookie = Response.Cookies.Get(sessionCookieKey);
                if (sessionCookie != null && Settings.GetBool(Settings.Configs.EnforceSessionCookiesSecure))
                {
                    sessionCookie.Secure = true;
                }
            }

            if (Context.Session == null || heContext.Session.NeedsSessionStart(App.eSpaceName))
            {
                if (Request.Path.ToLowerInvariant().EndsWith("_SmsHandler.aspx"))
                {
                    Global.App.OsContext.Session["TerminalType"] = "SMS";
                    Global.App.OsContext.Session["MSISDN"]       = Global.App.OsContext.MOMsg.MSISDN;
                }
                else if (Request.Path.ToLowerInvariant().EndsWith("smshandler.asmx"))
                {
                    Global.App.OsContext.Session["TerminalType"] = "SMS";
                    Global.App.OsContext.Session["MSISDN"]       = Request.Headers["MSISDN"];
                }
                else
                {
                    Global.App.OsContext.Session["TerminalType"] = "WEB";
                    Global.App.OsContext.Session["MSISDN"]       = "";
                }

                if (Application["ApplicationStartError"] != null)
                {
                    // Try again
                    Application_Start(sender, e);
                }

                if (Application["ApplicationStartError"] != null)
                {
                    ApplicationStartErrorRedirect();
                }
                if (Context.Session != null)
                {
                    ExtendedActions.AutoLogin(App, App.OsContext.Session);
                    RunOnSessionStart();
                }
            }            /*
                          * else {
                          *
                          * } */

            // Process visit cookies
            if (RuntimePlatformUtils.ShouldCreateCookieForRequest())
            {
                if (Request.CurrentExecutionFilePath.ToLowerInvariant().EndsWith(".aspx"))
                {
                    var osVisitorCookie = Request.Cookies["osVisitor"];
                    var osVisitCookie   = Request.Cookies["osVisit"];

                    if (osVisitorCookie == null || !GuidUtils.IsGuid(osVisitorCookie.Value))
                    {
                        osVisitorCookie         = new HttpCookie("osVisitor", Guid.NewGuid().ToString());
                        osVisitorCookie.Expires = DateTime.Now.AddYears(100);                         // forever
                        SecureCookieUtils.setSecureCookie(osVisitorCookie, heContext.Context.Response);
                    }

                    if (osVisitCookie == null || !GuidUtils.IsGuid(osVisitCookie.Value))
                    {
                        osVisitCookie = new HttpCookie("osVisit", Guid.NewGuid().ToString());
                        heContext.Session["osIsNewVisit"] = true;
                    }
                    osVisitCookie.Expires = DateTime.Now.AddMinutes(30);
                    SecureCookieUtils.setSecureCookie(osVisitCookie, heContext.Context.Response);

                    Context.Items["osVisitor"] = osVisitorCookie.Value;
                    Context.Items["osVisit"]   = osVisitCookie.Value;
                }
            }

            App.OsContext.Session[GenericExtendedActions.ReqAuditCountSessionName] = 0;

            // Default Multilingual state
            if (!App.MultilingualEnabled)
            {
                GenericExtendedActions.SetCurrentLocale(heContext, "");
            }
            else
            {
                string localeHeader = heContext.OsISAPIFilter.GetLocale(Request);
                if (localeHeader != null)
                {
                    try {
                        GenericExtendedActions.SetCurrentLocale(heContext, localeHeader);
                    } catch {}
                }
            }
        }