Example #1
0
    public override bool LoadData(ActivityInfo ai)
    {
        if ((ai == null) || !ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY))
        {
            return(false);
        }

        switch (ai.ActivityType)
        {
        case PredefinedActivityType.JOIN_GROUP:
        case PredefinedActivityType.LEAVE_GROUP:
            break;

        default:
            return(false);
        }

        if (ai.ActivityItemID > 0)
        {
            BaseInfo binfo = ModuleCommands.CommunityGetGroupInfo(ai.ActivityItemID);
            if (binfo != null)
            {
                string groupDisplayName = binfo.GetStringValue("GroupDisplayName", GetString("general.na"));
                ucDetails.AddRow("om.activitydetails.groupname", groupDisplayName);
            }
        }

        return(true);
    }
Example #2
0
 private static void CopyDataFromContactToForm(
     BaseInfo contact,
     DataClassInfo classInfo,
     ISearchable formItem)
 {
     foreach (var field in new FormInfo(classInfo.ClassContactMapping).GetFields(true, true))
     {
         formItem.SetValue(field.MappedToField, contact.GetStringValue(field.Name, string.Empty));
     }
 }
Example #3
0
        private ObjectSelectorItem GetItem(BaseInfo info, bool useGuid)
        {
            var typeInfo = info.TypeInfo;

            return(useGuid
                ? new ObjectSelectorItem {
                ObjectGuid = Guid.Parse(info[typeInfo.GUIDColumn].ToString())
            }
                : new ObjectSelectorItem {
                ObjectCodeName = info.GetStringValue(typeInfo.CodeNameColumn, null)
            });
        }
    private DataClassInfo FindDataClass(BaseInfo item)
    {
        switch (item.TypeInfo.ObjectType)
        {
        case BizFormInfo.OBJECT_TYPE:
            var classId = item.GetIntegerValue("FormClassID", 0);
            return(DataClassInfoProvider.GetDataClassInfo(classId));

        case DocumentTypeInfo.OBJECT_TYPE_DOCUMENTTYPE:
        case CustomTableInfo.OBJECT_TYPE_CUSTOMTABLE:
            var className = item.GetStringValue("ClassName", string.Empty);
            return(DataClassInfoProvider.GetDataClassInfo(className));
        }

        return(null);
    }
    /// <summary>
    /// Returns true if the contact voted in the poll.
    /// </summary>
    /// <param name="contact">Contact which should be checked</param>
    /// <param name="pollName">Poll name</param>
    /// <param name="answer">Poll answer text</param>
    /// <param name="lastXDays">Constraint for last X days (if zero or negative value is given, no constraint is applied)</param>
    public static bool VotedInPoll(object contact, string pollName, string answer, int lastXDays)
    {
        int pollId = ValidationHelper.GetInteger(CMSMacroMethods.GetObjectID(PredefinedObjectType.POLL, pollName, CMSContext.CurrentSiteName, true), 0);

        if (!string.IsNullOrEmpty(answer))
        {
            ContactInfo ci = contact as ContactInfo;
            if (ci == null)
            {
                return(false);
            }

            string where = GetActivityWhere(PredefinedActivityType.POLL_VOTING, null, lastXDays, "ActivityItemID = " + pollId, ci.ContactID);
            DataSet ds = ActivityInfoProvider.GetActivities(where, null, 0, "ActivityValue");
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string[] answers = ValidationHelper.GetString(dr[0], "").Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string a in answers)
                    {
                        BaseInfo pollAnswer = CMSObjectHelper.GetObjectById("polls.pollanswer", ValidationHelper.GetInteger(a, 0));
                        if (pollAnswer != null)
                        {
                            if (pollAnswer.GetStringValue("AnswerText", "").EqualsCSafe(answer, true))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
        else
        {
            return(DidActivity(contact, PredefinedActivityType.POLL_VOTING, null, lastXDays, "ActivityItemID = " + pollId));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ActivityHelper.AuthorizedReadActivity(SiteContext.CurrentSiteID, true))
        {
            if (!QueryHelper.ValidateHash("hash"))
            {
                return;
            }

            if (!ModuleManager.IsModuleLoaded(ModuleName.ECOMMERCE))
            {
                return;
            }

            int orderId = QueryHelper.GetInteger("orderid", 0);

            // Get order object
            BaseInfo order = BaseAbstractInfoProvider.GetInfoById(PredefinedObjectType.ORDER, orderId);
            if (order != null)
            {
                ltl.Text = order.GetStringValue("OrderInvoice", "");
            }
        }
    }