/// <summery>
    /// It will create Notification on Activities table
    ///
    /// <typeparam name=""></typeparam> integer userID
    /// <typeparam name=""></typeparam> integer senderID   (the man who creates this alert)
    /// <typeparam name=""></typeparam> string  actionType : one of action types (const defined for this class)
    /// <typeparam name=""></typeparam> integer actionID   : related trade offer,  feedback ID
    /// </summery>
    function createNotification(userID, senderID, actionType, actionID)
    {
        //Check if this user will get this notification. (it will be set by Notification setting page)
        tradeUserIns = new TradeUser();
        userData     = tradeUserIns.getUserByID(userID);

        flagEnabled = 0; // user checked that he didn"t want to have this notification

        switch (actionType)
        {
        case Activity.ACTION_TYPE_OFFER_ACCEPTED:
            notificationType = Activity.NOTIFICATION_TYPE_OFFER_ACCEPTED;
            flagEnabled      = userData["optOfferAccepted"];
            break;

        case Activity.ACTION_TYPE_OFFER_RECEIVED:
            notificationType = Activity.NOTIFICATION_TYPE_OFFER_RECEIVED;
            flagEnabled      = userData["optOfferReceived"];
            break;

        case Activity.ACTION_TYPE_OFFER_DECLINED:
            notificationType = Activity.NOTIFICATION_TYPE_OFFER_DECLINED;
            flagEnabled      = userData["optOfferDeclined"];
            break;

        case Activity.ACTION_TYPE_FEEDBACK:
            notificationType = Activity.NOTIFICATION_TYPE_OFFER_FEEDBACK;
            flagEnabled      = userData["optFeedbackReceived"];
            break;
        }

        if (flagEnabled == 1)
        {
            //Create Notification.
            activityIns = new Activity();
            activityId  = activityIns.addActivity(userID, senderID, this.objectType, actionType, actionID);

            activityIns.addNotification(userID, activityId, notificationType);
        }
    }
示例#2
0
    /// <summery>
    /// It will create Notification on Activities table
    ///
    /// <typeparam name=""></typeparam> integer userID
    /// <typeparam name=""></typeparam> integer senderID   (the man who creates this alert)
    /// <typeparam name=""></typeparam> string  actionType : one of action types (const defined for this class)
    /// <typeparam name=""></typeparam> integer actionID   : related shop order ID
    /// </summery>
    function createNotification(userID, senderID, actionType, actionID)
    {
        //Check if this user will get this notification. (it will be set by Notification setting page)
        userIns  = new TradeUser();
        userData = userIns.getUserByID(userID);

        flagEnabled = 0; // user checked that he didn"t want to have this notification

        switch (actionType)
        {
        case Activity.ACTION_TYPE_PRODUCT_SOLD:
            flagEnabled = userData["optProductSoldOnShop"];
            break;
        }

        if (flagEnabled == 1)
        {
            //Create Notification.
            activityIns = new Activity();
            activityId  = activityIns.addActivity(userID, senderID, this.objectType, actionType, actionID);

            activityIns.addNotification(userID, activityId, Activity.NOTIFICATION_TYPE_PRODUCT_SOLD);
        }
    }