コード例 #1
0
    /// <summary>
    /// Creates condition for DB query (if filter set via web part).
    /// </summary>
    private String CreateCondition()
    {
        string where = String.Empty;

        //Is approved
        switch (IsApproved.ToLower())
        {
        case "yes":
            where = SqlHelperClass.AddWhereCondition(where, "CommentApproved = 1");
            break;

        case "no":
            where = SqlHelperClass.AddWhereCondition(where, "(CommentApproved = 0 OR CommentApproved IS NULL )");
            break;
        }

        //Is spam
        switch (IsSpam.ToLower())
        {
        case "yes":
            where = SqlHelperClass.AddWhereCondition(where, "CommentIsSpam = 1");
            break;

        case "no":
            where = SqlHelperClass.AddWhereCondition(where, "(CommentIsSpam = 0 OR CommentIsSpam IS NULL )");
            break;
        }
        return(where);
    }
コード例 #2
0
    private void SaveDataKPayment()
    {
        string result = "IsApproved:" + IsApproved.ToString() + ", ";

        result += String.Format("RespCode:{0}, ", RespCode);
        result += String.Format("AuthCode:{0}, ", AuthCode);
        result += String.Format("UAID:{0}, ", UAID);
        result += String.Format("CardType:{0}", CardType);

        PaymentLog paymentLog = new PaymentLog();

        paymentLog.OrderID         = BankInvoiceID;
        paymentLog.PaymentResponse = result;
        paymentLog.PaymentGateway  = GetPaymentName();
        paymentLog.PaymentType     = String.Empty;
        DataAccessContext.PaymentLogRepository.Save(paymentLog);
        //PaymentLogAccess.Create( BankInvoiceID, result, GetPaymentName(), "" );

        OrderNotifyService order = new OrderNotifyService(BankInvoiceID);

        if (IsApproved)
        {
            order.SendOrderEmail();
            order.ProcessPaymentComplete();

            Response.Redirect(String.Format("~/CheckoutComplete.aspx?OrderID={0}&IsTransaction=True", BankInvoiceID));
        }
        else
        {
            order.ProcessPaymentFailed();

            Response.Redirect(String.Format("~/CheckoutNotComplete.aspx?OrderID={0}", BankInvoiceID));
        }
    }
コード例 #3
0
ファイル: Database.Tables.cs プロジェクト: Affixx/affixx
 public override int GetHashCode()
 {
     unchecked {
         const int randomPrime = 397;
         int       hashCode    = Id.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ (FullDocumentFileName != null ? FullDocumentFileName.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (FreeSnippetFileName != null ? FreeSnippetFileName.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (OriginalFileName != null ? OriginalFileName.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Title != null ? Title.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Degree != null ? Degree.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (CourseName != null ? CourseName.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (CourseCode != null ? CourseCode.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Year != null ? Year.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ UniversityId.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ UploadedBy.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ UploadedAt.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ (DeletedAt != null ? DeletedAt.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ IsFree.GetHashCode();
         hashCode = (hashCode * randomPrime) ^ (IsApproved != null ? IsApproved.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (Hash != null ? Hash.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ (MinHashSignature != null ? MinHashSignature.GetHashCode() : 0);
         hashCode = (hashCode * randomPrime) ^ CategoryId.GetHashCode();
         return(hashCode);
     }
 }
コード例 #4
0
        public override int GetHashCode()
        {
            int result = 1;

            result = (result * 397) ^ (Comment != null ? Comment.GetHashCode() : 0);
            result = (result * 397) ^ (Email != null ? Email.GetHashCode() : 0);
            result = (result * 397) ^ (FailedPasswordAttemptsCount != null ? FailedPasswordAttemptsCount.GetHashCode() : 0);
            result = (result * 397) ^ (FailedPasswordAttemptWindowStart != null ? FailedPasswordAttemptWindowStart.GetHashCode() : 0);
            result = (result * 397) ^ Id.GetHashCode();
            result = (result * 397) ^ IsApproved.GetHashCode();
            result = (result * 397) ^ IsFirstTimeUser.GetHashCode();
            result = (result * 397) ^ IsLockedOut.GetHashCode();
            result = (result * 397) ^ (LastActivityDate != null ? LastActivityDate.GetHashCode() : 0);
            result = (result * 397) ^ (LastLoginDate != null ? LastLoginDate.GetHashCode() : 0);
            result = (result * 397) ^ (LastPasswordChangeDate != null ? LastPasswordChangeDate.GetHashCode() : 0);
            result = (result * 397) ^ (Password != null ? Password.GetHashCode() : 0);
            result = (result * 397) ^ (PasswordKey != null ? PasswordKey.GetHashCode() : 0);
            result = (result * 397) ^ (Username != null ? Username.GetHashCode() : 0);
            result = (result * 397) ^ UserType.GetHashCode();
            return(result);
        }
コード例 #5
0
    /// <summary>
    /// Creates where condition reflecting filter settings.
    /// </summary>
    private string GetFilterWhereCondition()
    {
        string where = String.Empty;

        // Sites dropdown list
        if (SelectedSiteID > 0)
        {
            where = SqlHelper.AddWhereCondition(where, "BoardSiteID = " + SelectedSiteID);
        }

        // Approved dropdown list
        switch (IsApproved.ToLowerCSafe())
        {
        case "yes":
            where = SqlHelper.AddWhereCondition(where, "MessageApproved = 1");
            break;

        case "no":
            where = SqlHelper.AddWhereCondition(where, "MessageApproved = 0");
            break;
        }

        // Spam dropdown list
        switch (IsSpam.ToLowerCSafe())
        {
        case "yes":
            where = SqlHelper.AddWhereCondition(where, "MessageIsSpam = 1");
            break;

        case "no":
            where = SqlHelper.AddWhereCondition(where, "MessageIsSpam = 0");
            break;
        }

        if (BoardID > 0)
        {
            where = SqlHelper.AddWhereCondition(where, "MessageBoardID = " + BoardID.ToString());
        }
        else
        {
            // Board dropdown list
            if (SelectedBoardID > 0)
            {
                where = SqlHelper.AddWhereCondition(where, "MessageBoardID = " + SelectedBoardID);
            }
            else if (GroupID > 0)
            {
                where = SqlHelper.AddWhereCondition(where, "BoardGroupID =" + GroupID);
            }
            else
            {
                where = SqlHelper.AddWhereCondition(where, "BoardGroupID IS NULL");
            }
        }

        if (txtUserName.Text.Trim() != "")
        {
            where = SqlHelper.AddWhereCondition(where, "MessageUserName LIKE '%" + txtUserName.Text.Trim().Replace("'", "''") + "%'");
        }

        if (txtMessage.Text.Trim() != "")
        {
            where = SqlHelper.AddWhereCondition(where, "MessageText LIKE '%" + txtMessage.Text.Trim().Replace("'", "''") + "%'");
        }

        return(where);
    }
コード例 #6
0
 public string GetStatus()
 {
     return(IsApproved.GetStatus());
 }
コード例 #7
0
        /// <summary>
        /// Determines whether the specified Object is equal to the current Object.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLCredential)obj;

            //reference types
            if (!Object.Equals(LogOnToken, other.LogOnToken))
            {
                return(false);
            }
            if (!Object.Equals(PswdToken, other.PswdToken))
            {
                return(false);
            }
            if (!Object.Equals(PswdSalt, other.PswdSalt))
            {
                return(false);
            }
            if (!Object.Equals(PswdQuestion, other.PswdQuestion))
            {
                return(false);
            }
            if (!Object.Equals(PswdAnswer, other.PswdAnswer))
            {
                return(false);
            }
            if (!Object.Equals(Comment, other.Comment))
            {
                return(false);
            }
            //value types
            if (!CredentialId.Equals(other.CredentialId))
            {
                return(false);
            }
            if (!Principal.Equals(other.Principal))
            {
                return(false);
            }
            if (!PrincipalType.Equals(other.PrincipalType))
            {
                return(false);
            }
            if (!PswdFormat.Equals(other.PswdFormat))
            {
                return(false);
            }
            if (!IsApproved.Equals(other.IsApproved))
            {
                return(false);
            }
            if (!IsLockedOut.Equals(other.IsLockedOut))
            {
                return(false);
            }
            if (!LastLoginDate.Equals(other.LastLoginDate))
            {
                return(false);
            }
            if (!LastPasswordChangedDate.Equals(other.LastPasswordChangedDate))
            {
                return(false);
            }
            if (!LastLockoutDate.Equals(other.LastLockoutDate))
            {
                return(false);
            }
            if (!FailedPasswordAttemptCount.Equals(other.FailedPasswordAttemptCount))
            {
                return(false);
            }
            if (!FailedPasswordAttemptWindowStart.Equals(other.FailedPasswordAttemptWindowStart))
            {
                return(false);
            }
            if (!FailedPasswordAnswerAttemptCount.Equals(other.FailedPasswordAnswerAttemptCount))
            {
                return(false);
            }
            if (!FailedPasswordAnswerAttemptWindowStart.Equals(other.FailedPasswordAnswerAttemptWindowStart))
            {
                return(false);
            }

            return(true);
        }
コード例 #8
0
    /// <summary>
    /// Initializes the controls.
    /// </summary>
    private void SetupControls()
    {
        btnFilter.Text = GetString("general.show");
        btnOk.Text     = GetString("general.ok");

        // Mass actions
        this.gridElem.GridOptions.ShowSelection = this.AllowMassActions;
        this.rowActions.Visible = this.AllowMassActions;

        lblSiteName.AssociatedControlClientID  = siteSelector.DropDownSingleSelect.ClientID;
        lblBoardName.AssociatedControlClientID = boardSelector.DropDownSingleSelect.ClientID;

        gridElem.IsLiveSite           = this.IsLiveSite;
        gridElem.OnAction            += new OnActionEventHandler(gridElem_OnAction);
        gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound);
        gridElem.ZeroRowsText         = GetString("general.nodatafound");

        this.btnOk.OnClientClick += "return MassConfirm('" + this.drpActions.ClientID + "'," + ScriptHelper.GetString(GetString("General.ConfirmGlobalDelete")) + ");";

        ScriptHelper.RegisterDialogScript(this.Page);

        if (this.GroupID == 0)
        {
            this.GroupID = QueryHelper.GetInteger("groupid", 0);
        }

        ReloadFilter();

        if (!RequestHelper.IsPostBack())
        {
            // Preselect filter data
            PreselectFilter(";;" + this.GroupID + ";;;NO;;");
        }

        if (this.GroupID > 0)
        {
            // Hide site selection
            this.plcSite.Visible = false;
        }

        if (this.BoardID > 0)
        {
            // Hide board selection
            this.plcBoard.Visible = false;

            // Hide site selection
            this.plcSite.Visible = false;

            if ((this.GroupID > 0) && this.IsLiveSite)
            {
                InitializeGroupNewMessage();
            }
        }

        siteSelector.UniSelector.OnSelectionChanged += new EventHandler(UniSelector_OnSelectionChanged);

        // Reload message list script
        string board        = (this.BoardID > 0 ? this.BoardID.ToString() : this.boardSelector.Value.ToString());
        string group        = this.GroupID.ToString();
        string user         = HTMLHelper.HTMLEncode(this.txtUserName.Text);
        string message      = HTMLHelper.HTMLEncode(this.txtMessage.Text);
        string approved     = this.drpApproved.SelectedItem.Value;
        string spam         = this.drpSpam.SelectedItem.Value;
        bool   changemaster = QueryHelper.GetBoolean("changemaster", false);

        // Set site selector
        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.AllowAll   = true;
        siteSelector.IsLiveSite = this.IsLiveSite;

        boardSelector.IsLiveSite = this.IsLiveSite;
        boardSelector.GroupID    = this.GroupID;

        if (!ShowFilter)
        {
            SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteName);
            if (si != null)
            {
                siteId = si.SiteID;
            }
            if (SiteName == TreeProvider.ALL_SITES)
            {
                siteId = -1;
            }
        }
        else
        {
            siteId     = ValidationHelper.GetInteger(siteSelector.Value, 0);
            IsApproved = drpApproved.SelectedValue.ToLower();
            IsSpam     = drpSpam.SelectedValue.ToLower();
        }


        if (siteId == 0)
        {
            siteId             = CMSContext.CurrentSiteID;
            siteSelector.Value = siteId;
        }

        string cmdArg = siteId + ";" + board + ";" + group + ";" + user.Replace(";", "#sc#") + ";" +
                        message.Replace(";", "#sc#") + ";" + approved + ";" + spam + ";" + changemaster;

        this.btnRefreshHdn.CommandArgument = cmdArg;
        this.mPostBackRefference           = ControlsHelper.GetPostBackEventReference(this.btnRefreshHdn, null);
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "RefreshBoardList", ScriptHelper.GetScript("function RefreshBoardList(){" +
                                                                                                                mPostBackRefference + "}"));

        this.siteSelector.OnlyRunningSites = this.IsLiveSite;

        string where = "";

        // Sites dropdownlist
        if (siteId > 0)
        {
            where += "BoardSiteID = " + siteId + " AND";
        }

        // Approved dropdownlist
        switch (IsApproved.ToLower())
        {
        case "yes":
            where += " MessageApproved = 1 AND";
            break;

        case "no":
            where += " MessageApproved = 0 AND";
            break;
        }

        // Spam dropdownlist
        switch (IsSpam.ToLower())
        {
        case "yes":
            where += " MessageIsSpam = 1 AND";
            break;

        case "no":
            where += " MessageIsSpam = 0 AND";
            break;
        }

        int selectedBoardId = 0;

        if (mBoardId > 0)
        {
            where          += " MessageBoardID = " + mBoardId.ToString() + " AND";
            selectedBoardId = mBoardId;
        }
        else
        {
            // Board dropdownlist
            selectedBoardId = ValidationHelper.GetInteger(boardSelector.Value, 0);
            if (selectedBoardId > 0)
            {
                where += " MessageBoardID = " + selectedBoardId + " AND";
            }
        }

        if (txtUserName.Text.Trim() != "")
        {
            where += " MessageUserName LIKE '%" + txtUserName.Text.Trim().Replace("'", "''") + "%' AND";
        }

        if (txtMessage.Text.Trim() != "")
        {
            where += " MessageText LIKE '%" + txtMessage.Text.Trim().Replace("'", "''") + "%' AND";
        }

        bool isAuthorized = false;

        if (selectedBoardId > 0)
        {
            BoardInfo selectedBoard = BoardInfoProvider.GetBoardInfo(selectedBoardId);
            if (selectedBoard != null)
            {
                isAuthorized = BoardInfoProvider.IsUserAuthorizedToManageMessages(selectedBoard);
            }
        }

        // Show messages to boards only where user is moderator
        if (!isAuthorized && (!(CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.MessageBoards", "Modify") || CMSContext.CurrentUser.IsGroupAdministrator(this.mGroupId))))
        {
            where += " BoardID IN (SELECT BoardID FROM Board_Moderator WHERE Board_Moderator.UserID = " + CMSContext.CurrentUser.UserID + " ) AND ";
        }

        if (this.mGroupId > 0)
        {
            where += " BoardGroupID =" + this.mGroupId;
        }
        else
        {
            where += "(BoardGroupID =0 OR BoardGroupID IS NULL)";
        }

        gridElem.WhereCondition = where;

        if ((!RequestHelper.IsPostBack()) && (!string.IsNullOrEmpty(ItemsPerPage)))
        {
            gridElem.Pager.DefaultPageSize = ValidationHelper.GetInteger(ItemsPerPage, -1);
        }

        if (!String.IsNullOrEmpty(OrderBy))
        {
            gridElem.OrderBy = OrderBy;
        }
    }