Пример #1
0
    public void SetDisabledAttribute()
    {
        if (Offer.FromTemplate)
        {
            DisabledAttribute = ((CurrentUser.UserPermissions.EditOffer && !couponReward.DisallowEdit) ? false : true);
        }
        else if (Offer.IsTemplate)
        {
            DisabledAttribute = CurrentUser.UserPermissions.EditTemplates ? false : true;
        }
        else
        {
            DisabledAttribute = CurrentUser.UserPermissions.EditOffer ? false : true;
        }

        //If disable is set to false, check Buyer conditions
        if (!DisabledAttribute)
        {
            if (m_CommonInc.LRTadoConn.State == ConnectionState.Closed)
            {
                m_CommonInc.Open_LogixRT();
            }
            DisabledAttribute = ((CurrentUser.UserPermissions.EditOffersRegardlessBuyer || m_CommonInc.IsOfferCreatedWithUserAssociatedBuyer(CurrentUser.AdminUser.ID, OfferID)) ? false : true);
            DisabledAttribute = m_OAWService.CheckIfOfferIsAwaitingApproval(OfferID).Result;
            m_CommonInc.Close_LogixRT();
            //Hide save button if Disable is true
            btnSave.Visible = !DisabledAttribute;
        }
    }
Пример #2
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();
        }
    }