Beispiel #1
0
    private void Shutdown()
    {
        if (m_common.LXS_Connection_State() != ConnectionState.Closed)
        {
            m_common.Close_LogixXS();
        }
        if (m_common.LRT_Connection_State() != ConnectionState.Closed)
        {
            m_common.Close_LogixRT();
        }

        m_connectorInc = null;
        m_common       = null;
        m_logger       = null;
        m_errHandler   = null;
        m_phraseLib    = null;
        m_buyerRole    = null;
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool bConnectionOpened = false;

        try
        {
            ResolveDependencies();

            if (!IsPostBack)
            {
                if (MyCommon.LRTadoConn.State == ConnectionState.Closed)
                {
                    MyCommon.Open_LogixRT();
                    bConnectionOpened = true;
                }
                hdnPath.Value = Request.Url.LocalPath + "?offerid=" + OfferID;
                bEnableRestrictedAccessToUEOfferBuilder = m_common.Fetch_SystemOption(249) == "1" ? true : false;
                isTranslatedOffer = MyCommon.IsTranslatedUEOffer(Convert.ToInt32(OfferID), MyCommon);
                bEnableAdditionalLockoutRestrictionsOnOffers = m_common.Fetch_SystemOption(260) == "1" ? true : false;
                bOfferEditable = MyCommon.IsOfferEditablePastLockOutPeriod(Logix.UserRoles.EditOfferPastLockoutPeriod, MyCommon, Convert.ToInt32(OfferID));
                LocalizeControl();
                LoadEligibilityConditions();
                LoadConditionTypes();
                btnAdd.Attributes.Add("onclick", "return OpenConditionWindow(0,-1);");
                if (objOffer != null && objOffer.IsOptable)
                {
                    panelEligibilityCondition.Visible = true;
                    chkOptIn.Attributes.Add("onclick", "javascript:OptOutWindow();");
                    chkOptIn.Checked = true;
                }
                else
                {
                    chkOptIn.Checked = false;
                }
                if (!chkOptIn.Checked)
                {
                    btnAdd.Enabled             = false;
                    ddlOptInConditions.Enabled = false;
                }
                if (objOffer.IsTemplate == true)
                {
                    spanChkLocked.Visible  = true;
                    chkOptInLocked.Checked = IsOptInBlockLocked;
                }
                BindConditionRepeters();
                if (objOffer.FromTemplate == true && IsOptInBlockLocked == true)
                {
                    spanChkLocked.Visible = false;
                    //panelEligibilityCondition.Enabled = false;
                    panelOptIn.Enabled = false;
                }
                if (IsOptInDisabled == true)
                {
                    panelOptIn.Enabled = false;
                }
            }
            //Disable controls
            foreach (RepeaterItem item in repPointConditions.Items)
            {
                var delBtn = (Button)item.FindControl("btnPointsDelete");
                if (delBtn != null)
                {
                    delBtn.Enabled = Disable;
                }
                if (objOffer.EligiblePointsProgramConditions[item.ItemIndex].DisallowEdit == true)
                {
                    delBtn.Enabled = false;
                }
                if ((bEnableRestrictedAccessToUEOfferBuilder && isTranslatedOffer) || (bEnableAdditionalLockoutRestrictionsOnOffers && !bOfferEditable) || m_OAWService.CheckIfOfferIsAwaitingApproval(OfferID).Result)
                {
                    delBtn.Visible = false;
                }
            }
            foreach (RepeaterItem item in repSvConditions.Items)
            {
                var delBtn = (Button)item.FindControl("btnSVDelete");
                if (delBtn != null)
                {
                    delBtn.Enabled = Disable;
                }
                if (objOffer.EligibleSVProgramConditions[item.ItemIndex].DisallowEdit == true)
                {
                    delBtn.Enabled = false;
                }
                if ((bEnableRestrictedAccessToUEOfferBuilder && isTranslatedOffer) || (bEnableAdditionalLockoutRestrictionsOnOffers && !bOfferEditable) || m_OAWService.CheckIfOfferIsAwaitingApproval(OfferID).Result)
                {
                    delBtn.Visible = false;
                }
            }

            btnAdd.Enabled = (Disable && chkOptIn.Checked);
            if ((bEnableRestrictedAccessToUEOfferBuilder && isTranslatedOffer) || (bEnableAdditionalLockoutRestrictionsOnOffers && !bOfferEditable) || m_OAWService.CheckIfOfferIsAwaitingApproval(OfferID).Result)
            {
                btnAdd.Visible = false;
            }
            //panelOptIn.Enabled = true;
            //chkOptIn.Checked = true;

            //}
            //AllowAccess();
            //DeleteBtnEnabled = true;
        }
        catch (Exception excp)
        {
            infobar.Visible = true;
            lblError.Text   = m_ErrorHandler.ProcessError(excp);
        }
        finally
        {
            m_common.Close_LogixRT();
            if (bConnectionOpened)
            {
                MyCommon.Close_LogixRT();
            }
        }
    }
Beispiel #3
0
    private void AuthenticateUser()
    {
        common = CurrentRequest.Resolver.Resolve <CMS.AMS.Common>();
        int AdminUserID;

        if (common.LRT_Connection_State() != System.Data.ConnectionState.Open)
        {
            common.Open_LogixRT();
        }

        if (myCommon.LRTadoConn.State != System.Data.ConnectionState.Open)
        {
            myCommon.Open_LogixRT();
        }
        string TransferKey = string.Empty;
        string Authtoken   = "";
        string MyURI       = string.Empty;


        //1st, check the transferkey and see if the user is being transfered into AMS from another product (PrefMan)
        if (!string.IsNullOrEmpty(GetFormValue("transferkey")))
        {
            Logger.WriteDebug("AppName=" + AppName + " - Checking the TransferKey (" + GetFormValue("transferkey") + ")", "auth.txt");

            TransferKey = GetFormValue("transferkey");
            AdminUserID = authLib.Auth_TransferKey_Verify(TransferKey);

            Logger.WriteDebug("AppName=" + AppName + " - After TransferKey_Verify AdminUserID=" + AdminUserID, "auth.txt");
            if (AdminUserID != 0)
            {
                Response.Cookies["AuthToken"].Value = Authtoken;
                CurrentUser = GetUser(AdminUserID);
                return;
            }
        }

        Authtoken = "";
        if (Request.Cookies["AuthToken"] != null) //if allready validated
        {
            Authtoken = Request.Cookies["AuthToken"].Value;
        }
        Logger.WriteDebug("AppName=" + AppName + " - AuthToken='" + Authtoken + "'   Transferkey='" + GetFormValue("transferkey") + "'", "auth.txt");
        AdminUserID = 0;
        AdminUserID = authLib.Auth_Token_Verify(Authtoken);
        Logger.WriteDebug("AppName=" + AppName + " - After checking AuthToken, AdminUserID=" + AdminUserID, "auth.txt");

        if (AdminUserID == 0)
        {
            MyURI = System.Web.HttpUtility.UrlEncode(Request.Url.AbsoluteUri);
            Response.Redirect("/logix/login.aspx?mode=invalid&bounceback=" + MyURI);
        }
        else
        {
            if (CurrentUser == null || (CurrentUser != null && CurrentUser.AdminUser.ID != AdminUserID))
            {
                CurrentUser = GetUser(AdminUserID);
            }
            authLib.Fetch_User(CurrentUser);
            System.Threading.Thread.CurrentThread.CurrentCulture   = CurrentUser.AdminUser.Culture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = CurrentUser.AdminUser.Culture;
            LanguageID = CurrentUser.AdminUser.LanguageID;
        }
        if (common.LRT_Connection_State() == System.Data.ConnectionState.Open)
        {
            common.Close_LogixRT();
        }
        if (myCommon.LRTadoConn.State == System.Data.ConnectionState.Open)
        {
            myCommon.Close_LogixRT();
        }
    }