Exemplo n.º 1
0
        void btnJoinComm_Click(object sender, EventArgs e)
        {
            LinkButton btn = sender as LinkButton;

            if (btn != null)
            {
                string[] commargs  = btn.CommandArgument.Split('§');
                Guid     ctyID     = new Guid(commargs[0]);
                Guid     msgId     = new Guid(commargs[1]);
                Guid     invitedBy = new Guid(commargs[2]);
                try
                {
                    HirelCommunityUserCur.Insert(ctyID, UserProfile.Current.UserId, false, 0, DateTime.Now, invitedBy);
                    SPs.HispDataObjectAddMemberCount(ctyID, 1).Execute();
                }
                catch
                {
                }
                Message.DeleteMessage(msgId, UserProfile.Current.UserId);
                Message.DeleteMessage(msgId, invitedBy);
            }
            this.Reload();
        }
Exemplo n.º 2
0
        protected void OnYesClick(object sender, EventArgs e)
        {
            Guid?communtyId = Request.QueryString["CTYID"].ToNullableGuid();

            if (communtyId.HasValue)
            {
                try
                {
                    UserDataContext udc = UserDataContext.GetUserDataContext();

                    HirelCommunityUserCur.Insert(communtyId.Value, UserProfile.Current.UserId, false, 0, DateTime.Now, Guid.Empty);
                    SPs.HispDataObjectAddMemberCount(communtyId, 1).Execute();
                    UserActivities.InsertMembership(udc, communtyId.Value);

                    _4screen.CSB.Extensions.Business.IncentivePointsManager.AddIncentivePointEvent("COMMUNITY_PARTICIPATE", udc, communtyId.ToString());
                    _4screen.CSB.Notification.Business.Event.ReportNewMember(UserProfile.Current.UserId, UserProfile.Current.UserId, communtyId);

                    try
                    {
                        Community community = new Community(communtyId.Value);
                        if (community.ProfileOrCommunity.ParentObjectID.HasValue) // Join parent community too
                        {
                            HirelCommunityUserCur.Insert(community.ProfileOrCommunity.ParentObjectID.Value, UserProfile.Current.UserId, false, 0, DateTime.Now, Guid.Empty);
                            SPs.HispDataObjectAddMemberCount(community.ProfileOrCommunity.ParentObjectID.Value, 1).Execute();
                            UserActivities.InsertMembership(udc, community.ProfileOrCommunity.ParentObjectID.Value);
                        }
                    }
                    catch
                    {
                    }
                }
                catch
                {
                }
            }
            LitScript.Text = "<script type=\"text/javascript\">$telerik.$(function() { RefreshParentPage();GetRadWindow().Close(); } );</script>";
        }
Exemplo n.º 3
0
        public override bool SaveStep(ref System.Collections.Specialized.NameValueCollection queryString)
        {
            if (Page.IsValid)
            {
                currDatatObjectCommunity.Title       = Common.Extensions.StripHTMLTags(this.TxtTitle.Text);
                currDatatObjectCommunity.VirtualURL  = this.txtCommName.Text;
                currDatatObjectCommunity.Description = this.RadEditor1.Content;
                currDatatObjectCommunity.TagList     = Common.Extensions.StripHTMLTags(this.HFTagWords.Value);
                currDatatObjectCommunity.ShowState   = ObjectShowState.Published;
                currDatatObjectCommunity.Managed     = Convert.ToBoolean(Convert.ToInt32((string)this.HFManaged.Value));
                currDatatObjectCommunity.Status      = (ObjectStatus)Enum.Parse(typeof(ObjectStatus), this.HFStatus.Value);
                currDatatObjectCommunity.Copyright   = int.Parse(this.HFCopyright.Value);
                double geoLat;
                if (double.TryParse(this.HFGeoLat.Value, out geoLat))
                {
                    currDatatObjectCommunity.Geo_Lat = geoLat;
                }
                double geoLong;
                if (double.TryParse(this.HFGeoLong.Value, out geoLong))
                {
                    currDatatObjectCommunity.Geo_Long = geoLong;
                }
                currDatatObjectCommunity.Zip         = this.HFZip.Value;
                currDatatObjectCommunity.City        = this.HFCity.Value;
                currDatatObjectCommunity.Street      = this.HFStreet.Value;
                currDatatObjectCommunity.CountryCode = this.HFCountry.Value;
                currComm.CtyVirtualUrl = currDatatObjectCommunity.VirtualURL;

                using (TransactionScope scope = new TransactionScope())
                {
                    currDatatObjectCommunity.Update(UserDataContext.GetUserDataContext());

                    if (currComm.CtyStatus == (int)CommunityStatus.Initializing)
                    {
                        var privatePage = PagesConfig.CreateNewPage(ObjectID.Value, "Community", "Private", "Dashboard");
                        var thePage     = PagesConfig.CreateNewPage(ObjectID.Value, "Community", "Start", "Home");
                        HirelCommunityUserCur.Insert(currComm.CtyId, udc.UserID, true, 0, DateTime.Now, Guid.Empty);
                        SPs.HispDataObjectAddMemberCount(currComm.CtyId, 1).Execute();
                        try
                        {
                            if (udc.UserID != Constants.ADMIN_USERID.ToGuid())
                            {
                                HirelCommunityUserCur.Insert(currComm.CtyId, new Guid(Constants.ADMIN_USERID), true, 0, DateTime.Now, Guid.Empty);
                                SPs.HispDataObjectAddMemberCount(currComm.CtyId, 1).Execute();
                            }
                        }
                        catch
                        {
                        }
                    }
                    currComm.CtyStatus = (int)CommunityStatus.Ready;
                    currComm.Save();
                    _4screen.CSB.Extensions.Business.IncentivePointsManager.AddIncentivePointEvent("COMMUNITY_UPLOAD", udc, ObjectID.Value.ToString());
                    scope.Complete();
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }