Example #1
0
 public void ReadFromPrivacyInfo(PrivacyInfo privacyInfo)
 {
     this._allowedDeniedCollection.Clear();
     this._inputPrivacyInfo = privacyInfo;
     this._privacyType      = privacyInfo.PrivacyType;
     this.GenerateAllowedDenied();
 }
Example #2
0
    private void GetFriendVideoRss(Member friendMember)
    {
        PrivacyType privacyType = PrivacyType.Public;

        bool IsFriend = Friend.IsFriend(member.MemberID, friendMember.MemberID);

        if (IsFriend)
        {
            privacyType = PrivacyType.Network;
        }

        List <Video> Videos = Video.GetMemberVideosWithJoinOrdered(friendMember.MemberID, privacyType, "Latest");

        for (int i = 0; i < Videos.Count; i++)
        {
            if (i >= 20)
            {
                break;
            }

            DataRow row = dt.NewRow();

            row["Title"]     = Videos[i].Title;
            row["Link"]      = "/video/" + RegexPatterns.FormatStringForURL(Videos[i].Title) + "/" + Videos[i].WebVideoID;
            row["DTCreated"] = Videos[i].DTCreated;

            row["Description"]  = "<a href=\"http://www.next2friends.com/video/" + RegexPatterns.FormatStringForURL(Videos[i].Title) + "/" + Videos[i].WebVideoID + "\"/>";
            row["Description"] += row["Description"] + "<img src=\"" + ParallelServer.Get(Videos[i].ThumbnailResourceFile.FullyQualifiedURL) +
                                  Videos[i].ThumbnailResourceFile.FullyQualifiedURL + "\"/>";

            row["ResourceFileThumb"] = ParallelServer.Get(Videos[i].ThumbnailResourceFile.FullyQualifiedURL) +
                                       Videos[i].ThumbnailResourceFile.FullyQualifiedURL;
            dt.Rows.Add(row);
        }
    }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("create"))
            {
                using (ErrorScope es = new ErrorScope())
                {
                    MessageDisplay md = CreateMessageDisplay();

                    int albumID = 0;

                    string albumName     = _Request.Get("albumname");
                    string description   = _Request.Get("description");
                    string albumPassword = _Request.Get("albumpassword");

                    PrivacyType privacyType = _Request.Get <PrivacyType>("albumprivacy", Method.Post, PrivacyType.AllVisible);

                    if (AlbumBO.Instance.CreateAlbum(MyUserID, albumName, description, null, privacyType, albumPassword, out albumID) == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            ShowError(error);
                        });
                    }
                    else
                    {
                        ShowSuccess("相册创建成功", new object());
                    }
                }
            }
        }
 public void ReadFromPrivacyInfo(PrivacyInfo privacyInfo)
 {
     ((Collection <Group <FriendHeader> >) this._allowedDeniedCollection).Clear();
     this._inputPrivacyInfo = privacyInfo;
     this._privacyType      = privacyInfo.PrivacyType;
     this.GenerateAllowedDenied();
 }
Example #5
0
 public EditPrivacyViewModel(EditPrivacyViewModel vm, Action <PrivacyInfo> saveCallback)
 {
     this.PrivacyQuestion   = vm.PrivacyQuestion;
     this._inputPrivacyInfo = new PrivacyInfo(vm._inputPrivacyInfo.ToString());
     this._key             = vm.Key;
     this._supportedValues = vm._supportedValues;
     this._privacyType     = this._inputPrivacyInfo.PrivacyType;
     this._saveCallback    = saveCallback;
     this.GenerateAllowedDenied();
     EventAggregator.Current.Subscribe((object)this);
 }
Example #6
0
        private static Dictionary <Guid, List <DefaultPermission> > _parse_default_permissions(ref IDataReader reader)
        {
            Dictionary <Guid, List <DefaultPermission> > ret = new Dictionary <Guid, List <DefaultPermission> >();

            while (reader.Read())
            {
                try
                {
                    Guid           id           = Guid.Empty;
                    PermissionType type         = PermissionType.None;
                    PrivacyType    defaultValue = PrivacyType.NotSet;


                    if (!string.IsNullOrEmpty(reader["ID"].ToString()))
                    {
                        id = (Guid)reader["ID"];
                    }

                    if (!string.IsNullOrEmpty(reader["Type"].ToString()) &&
                        !string.IsNullOrEmpty(reader["DefaultValue"].ToString()) &&
                        Enum.TryParse <PermissionType>((string)reader["Type"], out type) &&
                        Enum.TryParse <PrivacyType>((string)reader["DefaultValue"], out defaultValue) &&
                        id != Guid.Empty && type != PermissionType.None && defaultValue != PrivacyType.NotSet)
                    {
                        if (!ret.ContainsKey(id))
                        {
                            ret[id] = new List <DefaultPermission>();
                        }
                        if (!ret[id].Any(u => u.PermissionType == type))
                        {
                            ret[id].Add(new DefaultPermission()
                            {
                                PermissionType = type,
                                DefaultValue   = defaultValue
                            });
                        }
                    }
                }
                catch { }
            }

            if (!reader.IsClosed)
            {
                reader.Close();
            }

            return(ret);
        }
Example #7
0
        private string GetMetadata(string title)
        {
            object metadata = new
            {
                snippet = new
                {
                    title = title
                },
                status = new
                {
                    privacyStatus = PrivacyType.ToString()
                }
            };

            return(JsonConvert.SerializeObject(metadata));
        }
Example #8
0
        public override int CreateAlbum(int userID, PrivacyType privacyType, string name, string description, string cover, string password)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_Album_CreateAlbum";
                query.CommandType = CommandType.StoredProcedure;


                query.CreateParameter<int>("@UserID", userID, SqlDbType.Int);
                query.CreateParameter<PrivacyType>("@PrivacyType", privacyType, SqlDbType.TinyInt);
                query.CreateParameter<string>("@Name", name, SqlDbType.NVarChar, 50);
                query.CreateParameter<string>("@Description", description, SqlDbType.NVarChar, 100);
                query.CreateParameter<string>("@Cover", cover, SqlDbType.NVarChar, 200);
                query.CreateParameter<string>("@Password", password, SqlDbType.NVarChar, 50);


                return query.ExecuteScalar<int>();
            }
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int?albumID = _Request.Get <int>("albumid");

            if (albumID == null)
            {
                ShowError("缺少必要的页面参数");
            }

            m_Album = AlbumBO.Instance.GetAlbum(albumID.Value);

            if (m_Album == null)
            {
                ShowError("指定的相册不存在");
            }

            if (_Request.IsClick("update"))
            {
                using (ErrorScope es = new ErrorScope())
                {
                    MessageDisplay md = CreateMessageDisplay();

                    string albumName     = _Request.Get("albumname");
                    string description   = _Request.Get("description");
                    string albumPassword = _Request.Get("albumpassword");

                    PrivacyType privacyType = _Request.Get <PrivacyType>("albumprivacy", Method.Post, PrivacyType.AllVisible);

                    if (AlbumBO.Instance.UpdateAlbum(MyUserID, albumID.Value, albumName, description, privacyType, albumPassword) == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            ShowError(error);
                        });
                    }
                    else
                    {
                        ShowSuccess("相册信息修改成功");
                    }
                }
            }
        }
Example #10
0
        public override string ToString()
        {
            if (IsNull)
            {
                throw new System.ArgumentException("ToString failed, this is null or not loaded", "this");
            }
            else
            {
                string retStr = base.ToString();

                if (EventParent == null)
                {
                    retStr += mDelim + "0";
                }
                else
                {
                    retStr += mDelim + EventParent.UniqueID.ToString();
                }

                retStr += mDelim + EventChildren.Count.ToString();
                for (int i = 0; i < EventChildren.Count; i++)
                {
                    retStr += mDelim + EventChildren[i].UniqueID.ToString();
                }

                retStr += mDelim + ItemChildren.Count.ToString();
                for (int i = 0; i < ItemChildren.Count; i++)
                {
                    retStr += mDelim + ItemChildren[i].UniqueID.ToString();
                }

                retStr += mDelim + EventTimeInfo.ToString();

                retStr += mDelim + EventLocation.ToString();

                retStr += mDelim + IsPublic.ToString();

                retStr += mDelim + PrivacyType.ToString();

                return(retStr);
            }
        }
Example #11
0
        public static List <Video> GetVideosByMemberIDWithJoin(int MemberID, PrivacyType PrivacyFlag)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = null;

            dbCommand = db.GetStoredProcCommand("HG_GetVideosByMemberIDWithJoin");
            db.AddInParameter(dbCommand, "MemberID", DbType.Int32, MemberID);
            db.AddInParameter(dbCommand, "PrivacyFlag", DbType.Int32, PrivacyFlag);

            List <Video> Videos = null;

            //execute the stored procedure
            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                Videos = Video.PopulateObjectWithJoin(dr);
                dr.Close();
            }

            // Create the object array from the datareader
            return(Videos);
        }
        public static DefaultPermission fromJson(Dictionary <string, object> json)
        {
            DefaultPermission dp = new DefaultPermission();

            PermissionType pt = PermissionType.None;

            if (json.ContainsKey("PermissionType") && json["PermissionType"] != null &&
                Enum.TryParse <PermissionType>(json["PermissionType"].ToString(), out pt))
            {
                dp.PermissionType = pt;
            }

            PrivacyType dv = PrivacyType.NotSet;

            if (json.ContainsKey("DefaultValue") && json["DefaultValue"] != null &&
                Enum.TryParse <PrivacyType>(json["DefaultValue"].ToString(), out dv))
            {
                dp.DefaultValue = dv;
            }

            return(dp.PermissionType == PermissionType.None ? null : dp);
        }
Example #13
0
        private void EditAlbum()
        {
            using (new ErrorScope())
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();
                try
                {
                    int?        albumID     = _Request.Get <int>("albumid", Method.All);
                    string      albumName   = _Request.Get("albumname", Method.Post);
                    string      description = _Request.Get("description");
                    PrivacyType privacyType = _Request.Get <PrivacyType>("privacytype", Method.Post, PrivacyType.AllVisible);
                    string      password    = _Request.Get("password", Method.Post);

                    if (albumID == null)
                    {
                        msgDisplay.AddError(new InvalidParamError("albumID").Message);
                        return;
                    }

                    bool success = AlbumBO.Instance.UpdateAlbum(MyUserID, albumID.Value, albumName, description, privacyType, password);

                    if (!success)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }
            }
        }
Example #14
0
        protected PrivacyType GetPrivacyTypeForFeed(SpacePrivacyType spacePrivacyType, SpacePrivacyType appPrivacyType, PrivacyType dataPrivacyType)
        {
            if (spacePrivacyType == SpacePrivacyType.Friend || appPrivacyType == SpacePrivacyType.Friend || dataPrivacyType == PrivacyType.FriendVisible)
            {
                return(PrivacyType.FriendVisible);
            }

            if (spacePrivacyType == SpacePrivacyType.Self || appPrivacyType == SpacePrivacyType.Self || dataPrivacyType == PrivacyType.SelfVisible)
            {
                return(PrivacyType.SelfVisible);
            }

            return(dataPrivacyType);
        }
Example #15
0
		public async Task<PhotoAlbum> PhotosCreateAlbumAsync(
			 string title ,
			 string description = "",
			 uint? groupId = null,
			 PrivacyType? privacy = null,
			 PrivacyType? commentPrivacy = null
			){
			return (await Executor.ExecAsync(
				_reqapi.PhotosCreateAlbum(
											title,
											description,
											groupId,
											privacy,
											commentPrivacy
									)
			)).Data.FirstOrDefault();
		}
Example #16
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        member = (Member)Session["Member"];
        bool Update = false;

        if (member != null)
        {
            for (int i = 0; i < VideoRepeater.Items.Count; i++)
            {
                HiddenField HiddenFieldWebVideoID = (HiddenField)VideoRepeater.Items[i].FindControl("WebVideoID");
                string      WebVideoID            = HiddenFieldWebVideoID.Value;

                Video video = GetLocalVideoByWebVideoID(WebVideoID);

                if (video != null)
                {
                    if (video.MemberID == member.MemberID)
                    {
                        CheckBox chbPrivacy = (CheckBox)VideoRepeater.Items[i].FindControl("chbPrivacy");
                        CheckBox chbDelete  = (CheckBox)VideoRepeater.Items[i].FindControl("chbDelete");
                        bool     DoDelete   = chbDelete.Checked;

                        if (DoDelete)
                        {
                            video.Delete();
                        }
                        else
                        {
                            TextBox      txtTitle      = (TextBox)VideoRepeater.Items[i].FindControl("txtTitle");
                            TextBox      txtCaption    = (TextBox)VideoRepeater.Items[i].FindControl("txtCaption");
                            TextBox      txtTags       = (TextBox)VideoRepeater.Items[i].FindControl("txtTags");
                            DropDownList drpCategories = (DropDownList)VideoRepeater.Items[i].FindControl("drpCategories");

                            if (video.Category.ToString() != drpCategories.SelectedValue)
                            {
                                video.Category = Int32.Parse(drpCategories.SelectedValue);
                                Update         = true;
                            }


                            if (video.Tags != txtTags.Text)
                            {
                                video.Tags = txtTags.Text;
                                Update     = true;

                                video.UpdateTags();

                                txtTags.Text = video.Tags;
                            }

                            if (video.Title != txtTitle.Text)
                            {
                                video.Title = txtTitle.Text;
                                Update      = true;
                            }

                            if (video.Description != txtCaption.Text)
                            {
                                video.Description = txtCaption.Text;
                                Update            = true;
                            }

                            PrivacyType pt = PrivacyType.Public;
                            if (chbPrivacy.Checked)
                            {
                                pt = PrivacyType.Network;
                            }

                            if (video.PrivacyFlag != (int)pt)
                            {
                                video.PrivacyFlag = (int)pt;
                                Update            = true;
                            }

                            if (Update)
                            {
                                video.Save();
                            }
                        }
                    }
                }
            }
        }

        Bind(CurrentPageIndex);
    }
Example #17
0
    /// <summary>
    /// Concatonates the videos into HTML for the lister control
    /// </summary>
    private TabContents GetVideoLister(string WebMemberID, int Page)
    {
        PrivacyType privacyType = PrivacyType.Public;

        if (member != null)
        {
            if (
                ViewingMember.MemberID == member.MemberID ||
                Friend.IsFriend(member.MemberID, ViewingMember.MemberID))
            {
                privacyType = PrivacyType.Network;
            }
        }

        List <Next2Friends.Data.Video> videos = Next2Friends.Data.Video.GetTopVideosByMemberIDWithJoin(ViewingMember.MemberID, privacyType);

        NumberOfVideos = videos.Count;
        int DisplayNumberOfVideos = 6;
        int StartIndex            = Page * DisplayNumberOfVideos;
        int EndIndex = StartIndex + DisplayNumberOfVideos;

        StringBuilder sbHTML = new StringBuilder();

        for (int i = StartIndex; i < EndIndex; i++)
        {
            if (videos.Count <= i)
            {
                break;
            }

            object[] parameters = new object[8];

            parameters[0] = ParallelServer.Get(videos[i].ThumbnailResourceFile.FullyQualifiedURL) + videos[i].ThumbnailResourceFile.FullyQualifiedURL;
            parameters[1] = videos[i].Duration.ToString();
            parameters[2] = videos[i].VeryShortTitle;
            parameters[3] = TimeDistance.TimeAgo(videos[i].DTCreated);
            parameters[4] = videos[i].VeryShortDescription;
            parameters[5] = videos[i].NumberOfViews;
            parameters[6] = videos[i].WebVideoID;
            parameters[7] = videos[i].NumberOfComments;

            sbHTML.AppendFormat(@"<li>
								<div class='vid_thumb'> <a href='view?v={6}'><img src='{0}' width='124' height='91' alt='thumb' /></a></div>
								<div class='vid_info'>
									<h3><a href='view?v={6}'>{2}</a></h3>
									<p class='timestamp'>{3}</p>
									<p>{4}</p>
									<p class='metadata'>Views: {5} Comments: {7}</p>
								</div>
							</li>"                            , parameters);
        }

        TabContents tabContents = new TabContents();

        int PreviousPage = Page - 1;
        int NextPage     = Page + 1;

        tabContents.PagerHTML  = (Page > 0) ? @"<p class='view_all'><a href='javascript:ajaxGetListerContent(""" + WebMemberID + @""",1," + PreviousPage + @");' class='previous'>Previous</a>" : string.Empty;
        tabContents.PagerHTML += (videos.Count > (NextPage * DisplayNumberOfVideos)) ? @"<a href='javascript:ajaxGetListerContent(""" + WebMemberID + @""",1," + NextPage + @");' class='next'>Next</a></p>" : string.Empty;

        tabContents.HTML = sbHTML.ToString();

        return(tabContents);
    }
 public Category(JToken node) : base(node)
 {
     if (node["id"] != null)
     {
         this._Id = ParseInt(node["id"].Value <string>());
     }
     if (node["parentId"] != null)
     {
         this._ParentId = ParseInt(node["parentId"].Value <string>());
     }
     if (node["depth"] != null)
     {
         this._Depth = ParseInt(node["depth"].Value <string>());
     }
     if (node["partnerId"] != null)
     {
         this._PartnerId = ParseInt(node["partnerId"].Value <string>());
     }
     if (node["name"] != null)
     {
         this._Name = node["name"].Value <string>();
     }
     if (node["fullName"] != null)
     {
         this._FullName = node["fullName"].Value <string>();
     }
     if (node["fullIds"] != null)
     {
         this._FullIds = node["fullIds"].Value <string>();
     }
     if (node["entriesCount"] != null)
     {
         this._EntriesCount = ParseInt(node["entriesCount"].Value <string>());
     }
     if (node["createdAt"] != null)
     {
         this._CreatedAt = ParseInt(node["createdAt"].Value <string>());
     }
     if (node["updatedAt"] != null)
     {
         this._UpdatedAt = ParseInt(node["updatedAt"].Value <string>());
     }
     if (node["description"] != null)
     {
         this._Description = node["description"].Value <string>();
     }
     if (node["tags"] != null)
     {
         this._Tags = node["tags"].Value <string>();
     }
     if (node["appearInList"] != null)
     {
         this._AppearInList = (AppearInListType)ParseEnum(typeof(AppearInListType), node["appearInList"].Value <string>());
     }
     if (node["privacy"] != null)
     {
         this._Privacy = (PrivacyType)ParseEnum(typeof(PrivacyType), node["privacy"].Value <string>());
     }
     if (node["inheritanceType"] != null)
     {
         this._InheritanceType = (InheritanceType)ParseEnum(typeof(InheritanceType), node["inheritanceType"].Value <string>());
     }
     if (node["userJoinPolicy"] != null)
     {
         this._UserJoinPolicy = (UserJoinPolicyType)ParseEnum(typeof(UserJoinPolicyType), node["userJoinPolicy"].Value <string>());
     }
     if (node["defaultPermissionLevel"] != null)
     {
         this._DefaultPermissionLevel = (CategoryUserPermissionLevel)ParseEnum(typeof(CategoryUserPermissionLevel), node["defaultPermissionLevel"].Value <string>());
     }
     if (node["owner"] != null)
     {
         this._Owner = node["owner"].Value <string>();
     }
     if (node["directEntriesCount"] != null)
     {
         this._DirectEntriesCount = ParseInt(node["directEntriesCount"].Value <string>());
     }
     if (node["referenceId"] != null)
     {
         this._ReferenceId = node["referenceId"].Value <string>();
     }
     if (node["contributionPolicy"] != null)
     {
         this._ContributionPolicy = (ContributionPolicyType)ParseEnum(typeof(ContributionPolicyType), node["contributionPolicy"].Value <string>());
     }
     if (node["membersCount"] != null)
     {
         this._MembersCount = ParseInt(node["membersCount"].Value <string>());
     }
     if (node["pendingMembersCount"] != null)
     {
         this._PendingMembersCount = ParseInt(node["pendingMembersCount"].Value <string>());
     }
     if (node["privacyContext"] != null)
     {
         this._PrivacyContext = node["privacyContext"].Value <string>();
     }
     if (node["privacyContexts"] != null)
     {
         this._PrivacyContexts = node["privacyContexts"].Value <string>();
     }
     if (node["status"] != null)
     {
         this._Status = (CategoryStatus)ParseEnum(typeof(CategoryStatus), node["status"].Value <string>());
     }
     if (node["inheritedParentId"] != null)
     {
         this._InheritedParentId = ParseInt(node["inheritedParentId"].Value <string>());
     }
     if (node["partnerSortValue"] != null)
     {
         this._PartnerSortValue = ParseInt(node["partnerSortValue"].Value <string>());
     }
     if (node["partnerData"] != null)
     {
         this._PartnerData = node["partnerData"].Value <string>();
     }
     if (node["defaultOrderBy"] != null)
     {
         this._DefaultOrderBy = (CategoryOrderBy)StringEnum.Parse(typeof(CategoryOrderBy), node["defaultOrderBy"].Value <string>());
     }
     if (node["directSubCategoriesCount"] != null)
     {
         this._DirectSubCategoriesCount = ParseInt(node["directSubCategoriesCount"].Value <string>());
     }
     if (node["moderation"] != null)
     {
         this._Moderation = (NullableBoolean)ParseEnum(typeof(NullableBoolean), node["moderation"].Value <string>());
     }
     if (node["pendingEntriesCount"] != null)
     {
         this._PendingEntriesCount = ParseInt(node["pendingEntriesCount"].Value <string>());
     }
     if (node["isAggregationCategory"] != null)
     {
         this._IsAggregationCategory = (NullableBoolean)ParseEnum(typeof(NullableBoolean), node["isAggregationCategory"].Value <string>());
     }
     if (node["aggregationCategories"] != null)
     {
         this._AggregationCategories = node["aggregationCategories"].Value <string>();
     }
     if (node["adminTags"] != null)
     {
         this._AdminTags = node["adminTags"].Value <string>();
     }
 }
Example #19
0
 public void EditAlbumSync(
     long albumId , int? ownerId = null, string title = "", string description = "", PrivacyType? privacy = null,  PrivacyType? commentPrivacy = null
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Photos.EditAlbum(
                 albumId,ownerId,title,description,privacy,commentPrivacy
             )
         );
     task.Wait();
     
 }
Example #20
0
        private void Create(PrivacyType privacyType)
        {
            string validateCodeAction = "CreateShare";
            MessageDisplay msgDisplay = CreateMessageDisplay("description", "subject", GetValidateCodeInputName(validateCodeAction));

            if (CheckValidateCode(validateCodeAction, msgDisplay) == false)
            {
                return;
            }


            string description = _Request.Get("description", Method.Post, string.Empty);
            string content = _Request.Get("content", Method.Post, string.Empty, false).Replace(tempReplace_rn, "\r\n").Replace(tempReplace_n, "\n");
            string title = _Request.Get("title", Method.Post, string.Empty, false);
            string url = _Request.Get("url", Method.Post, string.Empty, false);
            string securityCode = _Request.Get("securityCode", Method.Post, string.Empty);
            //string securityCode2 = _Request.Get("securityCode2", Method.Post, string.Empty);
            string urlSecurityCode = _Request.Get("urlSecurityCode", Method.Post, string.Empty);
            int targetUserID = _Request.Get<int>("userid", Method.Post, 0);

            //int ptype = _Request.Get<int>("privacytype", Method.Post, 0);
            //if (ptype > 2 || ptype < 0)
            //    ptype = 0;

            //PrivacyType privacyType = (PrivacyType)ptype;

            ShareType? shareCatagory = _Request.Get<ShareType>("ShareType", Method.Post);
            
            if(shareCatagory == null)
            {
                ShowError(new InvalidShareContentError("ShareType").Message);
                return;
            }

            if (GetShareContentSafeSerial(BbsRouter.ReplaceUrlTag(content), targetUserID) != securityCode)
            {
                ShowError(new InvalidShareContentError("ShareContent").Message);
                return;
            }
            
            if (string.IsNullOrEmpty(title))
            {
                msgDisplay.AddError("subject", "标题不能为空");
                return;
            }

            if (GetShareContentSafeSerial(BbsRouter.ReplaceUrlTag(url), targetUserID) != urlSecurityCode)
            {
                ShowError(new InvalidShareContentError("ShareUrl").Message);
                return;
            }


            int refShareID = _Request.Get<int>("refshareid", 0);

            try
            {
                using (new ErrorScope())
                {
                    bool success;

                    if (refShareID == 0)
                    {
                        int targetID = _Request.Get<int>("targetID", Method.Get, 0);
                        int shareID;

                        if (shareCatagory.Value == ShareType.Video
                            || shareCatagory.Value == ShareType.URL
                            || shareCatagory.Value == ShareType.Music
                            || shareCatagory.Value == ShareType.Flash)
                        {
                            success = ShareBO.Instance.CreateShare(MyUserID, privacyType, url, title, description);
                        }
                        else
                        {
                            success = ShareBO.Instance.CreateShare(MyUserID, targetUserID, shareCatagory.Value, privacyType, url, title, content, description, targetID, out shareID);
                        }
                    }
                    else
                    {
                        success = ShareBO.Instance.ReShare(My, refShareID, privacyType, title, description);
                    }

                    if (!success)
                    {
                        CatchError<ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                        //msgDisplay.ShowInfo(this);
                        ShowSuccess(privacyType == PrivacyType.SelfVisible ? "收藏成功" : "分享成功", new object());
                    }
                }
            }
            catch(Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
Example #21
0
 public PhotoAlbum CreateAlbumSync(
     string title , string description = "", int? groupId = null, PrivacyType? privacy = null,  PrivacyType? commentPrivacy = null
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Photos.CreateAlbum(
                 title,description,groupId,privacy,commentPrivacy
             )
         );
     task.Wait();
     return task.Result.Response;
 }
Example #22
0
 public async Task  EditAlbum(
     long albumId , int? ownerId = null, string title = "", string description = "", PrivacyType? privacy = null,  PrivacyType? commentPrivacy = null
 ) {
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Photos.EditAlbum(
                 albumId,ownerId,title,description,privacy,commentPrivacy
             )
         ).ConfigureAwait(false)
     ;
 }
Example #23
0
 public async Task <PhotoAlbum> CreateAlbum(
     string title , string description = "", int? groupId = null, PrivacyType? privacy = null,  PrivacyType? commentPrivacy = null
 ) {
     return (
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Photos.CreateAlbum(
                 title,description,groupId,privacy,commentPrivacy
             )
         ).ConfigureAwait(false)
     ).Response;
 }
Example #24
0
 public abstract void ReShare(int userID, int shareID, PrivacyType privacyType, string subject, string description);
Example #25
0
        public static List<Video> GetVideosByMemberIDWithJoin(int MemberID, PrivacyType PrivacyFlag)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = null;

            dbCommand = db.GetStoredProcCommand("HG_GetVideosByMemberIDWithJoin");
            db.AddInParameter(dbCommand, "MemberID", DbType.Int32, MemberID);
            db.AddInParameter(dbCommand, "PrivacyFlag", DbType.Int32, PrivacyFlag);

            List<Video> Videos = null;

            //execute the stored procedure
            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                Videos = Video.PopulateObjectWithJoin(dr);
                dr.Close();
            }

            // Create the object array from the datareader
            return Videos;
        }
Example #26
0
        protected override void OnLoadComplete(EventArgs e)
        {
            if (AllSettings.Current.SpacePermissionSet.Can(My, SpacePermissionSet.Action.UseBlog) == false)
            {
                ShowError("您所在的用户组没有发表日志的权限");
            }

            if (My.Roles.IsInRole(Role.FullSiteBannedUsers))
            {
                ShowError("您已经被整站屏蔽不能发表日志");
            }

            if (_Request.IsClick("save"))
            {
                #region 页面提交时

                int id         = _Request.Get <int>("id", 0);
                int?categoryID = _Request.Get <int>("category");

                string subject   = _Request.Get("subject");
                string content   = _Request.Get("content", Method.Post, string.Empty, false);
                string password  = _Request.Get("password");
                string tagNames  = _Request.Get("tag", Method.Post, string.Empty);
                string currentIP = _Request.IpAddress;

                bool enableComment = _Request.IsChecked("enablecomment", Method.Post, true);

                PrivacyType privacyType = _Request.Get <PrivacyType>("privacytype", PrivacyType.SelfVisible);

                using (ErrorScope es = new ErrorScope())
                {
                    MessageDisplay md = CreateMessageDisplay(GetValidateCodeInputName("CreateBlogArticle"));

                    if (CheckValidateCode("CreateBlogArticle", md))
                    {
                        bool succeed = false;

                        bool useHtml = _Request.Get("format") == "html";
                        bool useUbb  = _Request.Get("format") == "ubb";

                        if (IsEditMode)
                        {
                            succeed = BlogBO.Instance.UpdateBlogArticle(MyUserID, currentIP, id, subject, content, categoryID, tagNames.Split(','), enableComment, privacyType, password, useHtml, useUbb);
                        }
                        else
                        {
                            succeed = BlogBO.Instance.CreateBlogArticle(MyUserID, currentIP, subject, content, categoryID, tagNames.Split(','), enableComment, privacyType, password, useHtml, useUbb, out id);
                        }

                        if (succeed)
                        {
                            ValidateCodeManager.CreateValidateCodeActionRecode("CreateBlogArticle");

                            BbsRouter.JumpTo("app/blog/index");
                        }
                        else
                        {
                            if (es.HasError)
                            {
                                es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                                {
                                    md.AddError(error);
                                });
                            }
                        }
                    }
                }

                #endregion
            }
            else if (_Request.IsClick("addcategory"))
            {
                AddCategory();
            }


            #region 正常页面加载

            if (IsEditMode)
            {
                using (ErrorScope es = new ErrorScope())
                {
                    int?articleID = _Request.Get <int>("id");

                    if (articleID.HasValue)
                    {
                        m_Article = BlogBO.Instance.GetBlogArticleForEdit(MyUserID, articleID.Value);

                        if (m_Article != null)
                        {
                            string[] tagNames = new string[m_Article.Tags.Count];

                            for (int i = 0; i < tagNames.Length; i++)
                            {
                                tagNames[i] = m_Article.Tags[i].Name;
                            }

                            m_ArticleTagList = StringUtil.Join(tagNames);

                            m_CategoryList = BlogBO.Instance.GetUserBlogCategories(m_Article.UserID);
                        }
                    }

                    if (m_Article == null)
                    {
                        ShowError("日志不存在");
                    }

                    if (es.HasUnCatchedError)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            ShowError(error);
                        });
                    }

                    base.OnLoadComplete(e);
                }

                AddNavigationItem(FunctionName, BbsRouter.GetUrl("app/blog/index"));
                AddNavigationItem("编辑日志");
            }
            else
            {
                m_Article = new BlogArticle();

                m_ArticleTagList = string.Empty;

                m_CategoryList = BlogBO.Instance.GetUserBlogCategories(MyUserID);

                AddNavigationItem(FunctionName, BbsRouter.GetUrl("app/blog/index"));
                AddNavigationItem("发表新日志");
            }


            m_ArticleList = BlogBO.Instance.GetUserBlogArticles(MyUserID, MyUserID, null, null, 1, 5);
            #endregion
        }
Example #27
0
    private void GetVideoLister(string WebMemberID, bool WrapInP)
    {
        PrivacyType privacyType = PrivacyType.Public;

        if (member != null)
        {
            if (
                ViewingMember.MemberID == member.MemberID ||
                Friend.IsFriend(member.MemberID, ViewingMember.MemberID))
            {
                privacyType = PrivacyType.Network;
            }
        }

        string OrderByClause = "";

        switch (CurrentTab)
        {
        case MemberOrderVideo.Latest:
            OrderByClause = "Latest";
            break;

        case MemberOrderVideo.NumberOfViews:
            OrderByClause = "NumberOfViews";
            break;

        case MemberOrderVideo.NumberOfComments:
            OrderByClause = "NumberOfComments";
            break;

        case MemberOrderVideo.TotalVoteScore:
            OrderByClause = "TotalVoteScore";
            break;
        }

        List <Next2Friends.Data.Video> Videos = Next2Friends.Data.Video.GetMemberVideosWithJoinOrdered(ViewingMember.MemberID, privacyType, OrderByClause);

        NumberOfVideos = Videos.Count;
        int DisplayNumberOfVideos = 28;
        int StartIndex            = PageTo * DisplayNumberOfVideos - DisplayNumberOfVideos;
        int EndIndex = StartIndex + DisplayNumberOfVideos;

        StringBuilder sbHTML = new StringBuilder();

        for (int i = StartIndex; i < EndIndex; i++)
        {
            if (Videos.Count <= i)
            {
                break;
            }

            object[] parameters = new object[14];

            parameters[0]  = ParallelServer.Get(Videos[i].ThumbnailResourceFile.FullyQualifiedURL) + Videos[i].ThumbnailResourceFile.FullyQualifiedURL;
            parameters[1]  = Videos[i].TimeAgo;
            parameters[2]  = Videos[i].VeryShortTitle;
            parameters[3]  = Videos[i].VeryShortDescription;
            parameters[4]  = Videos[i].NumberOfViews;
            parameters[5]  = Videos[i].NumberOfComments;
            parameters[6]  = Videos[i].Member.NickName;
            parameters[7]  = Videos[i].Category;
            parameters[8]  = Videos[i].WebVideoID;
            parameters[9]  = Videos[i].Duration;
            parameters[10] = Videos[i].TotalVoteScore;
            parameters[11] = Videos[i].Member.WebMemberID;
            parameters[12] = RegexPatterns.FormatStringForURL(Videos[i].Title);
            parameters[13] = Videos[i].Title;

//            sbHTML.AppendFormat(@"<li>
//							<div class='vid_thumb'> <a href='/video/{12}/{8}'><img src='{0}' width='124' height='91' alt='{13}' /></a></div>
//
//							<div class='vid_info'>
//
//								<p class='metadata'><a href='/video/{12}/{8}'>{2}</a></p>
//								<p class='timestamp'>{1}</p>
//								<div class='vote vote_condensed'><span class='vote_count'>{10}</span></div>
//								<p class='metadata'>Views: {4}<br />
//								Comments: <a href='#'>{5}</a><br />
//                                </p>
//							</div>
//						</li>", parameters);

            sbHTML.AppendFormat(@"<li style='width:140px;clear: none;margin-left:3px'>
								<div class='vid_thumb'> <a href='javascript:displayMiniVideo(""{8}"",""{13}"");'><img src='{0}' width='124' height='91' alt='{8}' /></a></div>
							</li>"                            , parameters);

//            object[] parameters = new object[10];

//            parameters[0] = ParallelServer.Get(videos[i].ThumbnailResourceFile.FullyQualifiedURL) + videos[i].ThumbnailResourceFile.FullyQualifiedURL;
//            parameters[1] = videos[i].Duration.ToString();
//            parameters[2] = videos[i].VeryShortTitle;
//            parameters[3] = TimeDistance.TimeAgo(videos[i].DTCreated);
//            parameters[4] = videos[i].VeryShortDescription;
//            parameters[5] = videos[i].NumberOfViews;
//            parameters[6] = videos[i].WebVideoID;
//            parameters[7] = videos[i].NumberOfComments;
//            parameters[8] = videos[i].Title;
//            parameters[9] = RegexPatterns.FormatStringForURL(videos[i].Title);

//            sbHTML.AppendFormat(@"<li>
//								<div class='vid_thumb'> <a href='/video/{9}/{6}'><img src='{0}' width='124' height='91' alt='{8}' /></a></div>
//								<div class='vid_info'>
//									<h3><a href='/video/{9}/{6}'>{2}</a></h3>
//									<p class='timestamp'>{3}</p>
//									<p>{4}</p>
//									<p class='metadata'>Views: {5} Comments: {7}</p>
//								</div>
//							</li>", parameters);
        }


        DefaultHTMLLister = (NumberOfVideos > 0) ? "<ul class='profile_vid_list2' style='padding: 15px 0pt 20px 14px;' id='ulContentLister'>" + sbHTML.ToString() + "</ul>" : "<p>Member currently has no Videos.</p>";

        string MiscPagerParams = string.Empty;

        if (CurrentTab != MemberOrderVideo.Latest)
        {
            MiscPagerParams = "&to=" + ((int)CurrentTab).ToString();
        }

        Pager pager = new Pager("/users/" + ViewingMember.NickName + "/videos/", MiscPagerParams, PageTo, NumberOfVideos);

        pager.PageSize = 20;

        DefaultHTMLPager = pager.ToString();
    }
Example #28
0
        public override void ReShare(int userID, int shareID, PrivacyType privacyType, string subject, string description)
        {
            using (SqlQuery db = new SqlQuery())
            {
                db.CommandText = "bx_Share_ReShare";
                db.CommandType = CommandType.StoredProcedure;

                db.CreateParameter<int>("@ShareID", shareID, SqlDbType.Int);
                db.CreateParameter<int>("@UserID", userID, SqlDbType.Int);
                db.CreateParameter<PrivacyType>("@PrivacyType", privacyType, SqlDbType.TinyInt);
                db.CreateParameter<string>("@Subject", subject, SqlDbType.NVarChar, 100);
                db.CreateParameter<string>("@Description", description, SqlDbType.NVarChar, 1000);

                db.ExecuteNonQuery();
            }
        }
Example #29
0
		public VKRequest<StructEntity<bool>> PhotosEditAlbum(
			 long albumId ,
			 int? ownerId = null,
			 string title = "",
			 string description = "",
			 PrivacyType? privacy = null,
			 PrivacyType? commentPrivacy = null
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "photos.editAlbum",
				Parameters = new Dictionary<string, string> {
					{ "album_id", albumId.ToNCString() },
			{ "owner_id", MiscTools.NullableString(ownerId) },
			{ "title", title },
			{ "description", description },
			{ "privacy", MiscTools.NullableString( (byte?)privacy ) },
			{ "comment_privacy", MiscTools.NullableString( (byte?)commentPrivacy ) }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
Example #30
0
        public CategoryBaseFilter(XmlElement node) : base(node)
        {
            foreach (XmlElement propertyNode in node.ChildNodes)
            {
                switch (propertyNode.Name)
                {
                case "idEqual":
                    this._IdEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "idIn":
                    this._IdIn = propertyNode.InnerText;
                    continue;

                case "idNotIn":
                    this._IdNotIn = propertyNode.InnerText;
                    continue;

                case "parentIdEqual":
                    this._ParentIdEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "parentIdIn":
                    this._ParentIdIn = propertyNode.InnerText;
                    continue;

                case "depthEqual":
                    this._DepthEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "fullNameEqual":
                    this._FullNameEqual = propertyNode.InnerText;
                    continue;

                case "fullNameStartsWith":
                    this._FullNameStartsWith = propertyNode.InnerText;
                    continue;

                case "fullNameIn":
                    this._FullNameIn = propertyNode.InnerText;
                    continue;

                case "fullIdsEqual":
                    this._FullIdsEqual = propertyNode.InnerText;
                    continue;

                case "fullIdsStartsWith":
                    this._FullIdsStartsWith = propertyNode.InnerText;
                    continue;

                case "fullIdsMatchOr":
                    this._FullIdsMatchOr = propertyNode.InnerText;
                    continue;

                case "createdAtGreaterThanOrEqual":
                    this._CreatedAtGreaterThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "createdAtLessThanOrEqual":
                    this._CreatedAtLessThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "updatedAtGreaterThanOrEqual":
                    this._UpdatedAtGreaterThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "updatedAtLessThanOrEqual":
                    this._UpdatedAtLessThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "tagsLike":
                    this._TagsLike = propertyNode.InnerText;
                    continue;

                case "tagsMultiLikeOr":
                    this._TagsMultiLikeOr = propertyNode.InnerText;
                    continue;

                case "tagsMultiLikeAnd":
                    this._TagsMultiLikeAnd = propertyNode.InnerText;
                    continue;

                case "appearInListEqual":
                    this._AppearInListEqual = (AppearInListType)ParseEnum(typeof(AppearInListType), propertyNode.InnerText);
                    continue;

                case "privacyEqual":
                    this._PrivacyEqual = (PrivacyType)ParseEnum(typeof(PrivacyType), propertyNode.InnerText);
                    continue;

                case "privacyIn":
                    this._PrivacyIn = propertyNode.InnerText;
                    continue;

                case "inheritanceTypeEqual":
                    this._InheritanceTypeEqual = (InheritanceType)ParseEnum(typeof(InheritanceType), propertyNode.InnerText);
                    continue;

                case "inheritanceTypeIn":
                    this._InheritanceTypeIn = propertyNode.InnerText;
                    continue;

                case "referenceIdEqual":
                    this._ReferenceIdEqual = propertyNode.InnerText;
                    continue;

                case "referenceIdEmpty":
                    this._ReferenceIdEmpty = (NullableBoolean)ParseEnum(typeof(NullableBoolean), propertyNode.InnerText);
                    continue;

                case "contributionPolicyEqual":
                    this._ContributionPolicyEqual = (ContributionPolicyType)ParseEnum(typeof(ContributionPolicyType), propertyNode.InnerText);
                    continue;

                case "membersCountGreaterThanOrEqual":
                    this._MembersCountGreaterThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "membersCountLessThanOrEqual":
                    this._MembersCountLessThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "pendingMembersCountGreaterThanOrEqual":
                    this._PendingMembersCountGreaterThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "pendingMembersCountLessThanOrEqual":
                    this._PendingMembersCountLessThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "privacyContextEqual":
                    this._PrivacyContextEqual = propertyNode.InnerText;
                    continue;

                case "statusEqual":
                    this._StatusEqual = (CategoryStatus)ParseEnum(typeof(CategoryStatus), propertyNode.InnerText);
                    continue;

                case "statusIn":
                    this._StatusIn = propertyNode.InnerText;
                    continue;

                case "inheritedParentIdEqual":
                    this._InheritedParentIdEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "inheritedParentIdIn":
                    this._InheritedParentIdIn = propertyNode.InnerText;
                    continue;

                case "partnerSortValueGreaterThanOrEqual":
                    this._PartnerSortValueGreaterThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "partnerSortValueLessThanOrEqual":
                    this._PartnerSortValueLessThanOrEqual = ParseInt(propertyNode.InnerText);
                    continue;

                case "aggregationCategoriesMultiLikeOr":
                    this._AggregationCategoriesMultiLikeOr = propertyNode.InnerText;
                    continue;

                case "aggregationCategoriesMultiLikeAnd":
                    this._AggregationCategoriesMultiLikeAnd = propertyNode.InnerText;
                    continue;
                }
            }
        }
Example #31
0
        public override bool UpdateAlbum(int albumID, string name, string description, PrivacyType privacyType, string password, int editUserID)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_Album_UpdateAlbum";
                query.CommandType = CommandType.StoredProcedure;

                query.CreateParameter<int>("@AlbumID", albumID, SqlDbType.Int);
                query.CreateParameter<string>("@Name", name, SqlDbType.NVarChar, 50);
                query.CreateParameter<string>("@Description", description, SqlDbType.NVarChar, 100);
                query.CreateParameter<PrivacyType>("@PrivacyType", privacyType, SqlDbType.TinyInt);
                query.CreateParameter<string>("@Password", password, SqlDbType.NVarChar, 50);
                query.CreateParameter<int>("@LastEditUserID", editUserID, SqlDbType.Int);

                query.ExecuteNonQuery();

                return true;
            }
        }
Example #32
0
		public VKRequest<PhotoAlbum> PhotosCreateAlbum(
			 string title ,
			 string description = "",
			 uint? groupId = null,
			 PrivacyType? privacy = null,
			 PrivacyType? commentPrivacy = null
			){
			var req = new VKRequest<PhotoAlbum>{
				MethodName = "photos.createAlbum",
				Parameters = new Dictionary<string, string> {
					{ "title", title },
			{ "description", description },
			{ "group_id", MiscTools.NullableString(groupId) },
			{ "privacy", MiscTools.NullableString( (byte?)privacy ) },
			{ "comment_privacy", MiscTools.NullableString( (byte?)commentPrivacy ) }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
Example #33
0
        public override int CreateShare(int userID, ShareType shareType, PrivacyType privacyType, string title, string url, string content, string description, string descriptionReverter, int targetID)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_CreateShare";
                query.CommandType = CommandType.StoredProcedure;

                query.CreateParameter<int>("@UserID", userID, SqlDbType.Int);
                query.CreateParameter<int>("@Type", (int)shareType, SqlDbType.TinyInt);
                query.CreateParameter<int>("@PrivacyType", (int)privacyType, SqlDbType.TinyInt);
                query.CreateParameter<string>("@Title", title, SqlDbType.NVarChar, 100);
                query.CreateParameter<string>("@Url", url, SqlDbType.NVarChar, 512);
                query.CreateParameter<string>("@Content", content, SqlDbType.NVarChar, 2800);
                query.CreateParameter<string>("@Description", description, SqlDbType.NVarChar, 1000);
                query.CreateParameter<long>("@SortOrder", DateTime.Now.Date.Ticks, SqlDbType.BigInt);
                query.CreateParameter<int>("@TargetID", targetID, SqlDbType.Int);

                return query.ExecuteScalar<int>();
            }

        }
 public CategoryBaseFilter(JToken node) : base(node)
 {
     if (node["idEqual"] != null)
     {
         this._IdEqual = ParseInt(node["idEqual"].Value <string>());
     }
     if (node["idIn"] != null)
     {
         this._IdIn = node["idIn"].Value <string>();
     }
     if (node["idNotIn"] != null)
     {
         this._IdNotIn = node["idNotIn"].Value <string>();
     }
     if (node["parentIdEqual"] != null)
     {
         this._ParentIdEqual = ParseInt(node["parentIdEqual"].Value <string>());
     }
     if (node["parentIdIn"] != null)
     {
         this._ParentIdIn = node["parentIdIn"].Value <string>();
     }
     if (node["depthEqual"] != null)
     {
         this._DepthEqual = ParseInt(node["depthEqual"].Value <string>());
     }
     if (node["fullNameEqual"] != null)
     {
         this._FullNameEqual = node["fullNameEqual"].Value <string>();
     }
     if (node["fullNameStartsWith"] != null)
     {
         this._FullNameStartsWith = node["fullNameStartsWith"].Value <string>();
     }
     if (node["fullNameIn"] != null)
     {
         this._FullNameIn = node["fullNameIn"].Value <string>();
     }
     if (node["fullIdsEqual"] != null)
     {
         this._FullIdsEqual = node["fullIdsEqual"].Value <string>();
     }
     if (node["fullIdsStartsWith"] != null)
     {
         this._FullIdsStartsWith = node["fullIdsStartsWith"].Value <string>();
     }
     if (node["fullIdsMatchOr"] != null)
     {
         this._FullIdsMatchOr = node["fullIdsMatchOr"].Value <string>();
     }
     if (node["createdAtGreaterThanOrEqual"] != null)
     {
         this._CreatedAtGreaterThanOrEqual = ParseInt(node["createdAtGreaterThanOrEqual"].Value <string>());
     }
     if (node["createdAtLessThanOrEqual"] != null)
     {
         this._CreatedAtLessThanOrEqual = ParseInt(node["createdAtLessThanOrEqual"].Value <string>());
     }
     if (node["updatedAtGreaterThanOrEqual"] != null)
     {
         this._UpdatedAtGreaterThanOrEqual = ParseInt(node["updatedAtGreaterThanOrEqual"].Value <string>());
     }
     if (node["updatedAtLessThanOrEqual"] != null)
     {
         this._UpdatedAtLessThanOrEqual = ParseInt(node["updatedAtLessThanOrEqual"].Value <string>());
     }
     if (node["tagsLike"] != null)
     {
         this._TagsLike = node["tagsLike"].Value <string>();
     }
     if (node["tagsMultiLikeOr"] != null)
     {
         this._TagsMultiLikeOr = node["tagsMultiLikeOr"].Value <string>();
     }
     if (node["tagsMultiLikeAnd"] != null)
     {
         this._TagsMultiLikeAnd = node["tagsMultiLikeAnd"].Value <string>();
     }
     if (node["appearInListEqual"] != null)
     {
         this._AppearInListEqual = (AppearInListType)ParseEnum(typeof(AppearInListType), node["appearInListEqual"].Value <string>());
     }
     if (node["privacyEqual"] != null)
     {
         this._PrivacyEqual = (PrivacyType)ParseEnum(typeof(PrivacyType), node["privacyEqual"].Value <string>());
     }
     if (node["privacyIn"] != null)
     {
         this._PrivacyIn = node["privacyIn"].Value <string>();
     }
     if (node["inheritanceTypeEqual"] != null)
     {
         this._InheritanceTypeEqual = (InheritanceType)ParseEnum(typeof(InheritanceType), node["inheritanceTypeEqual"].Value <string>());
     }
     if (node["inheritanceTypeIn"] != null)
     {
         this._InheritanceTypeIn = node["inheritanceTypeIn"].Value <string>();
     }
     if (node["referenceIdEqual"] != null)
     {
         this._ReferenceIdEqual = node["referenceIdEqual"].Value <string>();
     }
     if (node["referenceIdEmpty"] != null)
     {
         this._ReferenceIdEmpty = (NullableBoolean)ParseEnum(typeof(NullableBoolean), node["referenceIdEmpty"].Value <string>());
     }
     if (node["contributionPolicyEqual"] != null)
     {
         this._ContributionPolicyEqual = (ContributionPolicyType)ParseEnum(typeof(ContributionPolicyType), node["contributionPolicyEqual"].Value <string>());
     }
     if (node["membersCountGreaterThanOrEqual"] != null)
     {
         this._MembersCountGreaterThanOrEqual = ParseInt(node["membersCountGreaterThanOrEqual"].Value <string>());
     }
     if (node["membersCountLessThanOrEqual"] != null)
     {
         this._MembersCountLessThanOrEqual = ParseInt(node["membersCountLessThanOrEqual"].Value <string>());
     }
     if (node["pendingMembersCountGreaterThanOrEqual"] != null)
     {
         this._PendingMembersCountGreaterThanOrEqual = ParseInt(node["pendingMembersCountGreaterThanOrEqual"].Value <string>());
     }
     if (node["pendingMembersCountLessThanOrEqual"] != null)
     {
         this._PendingMembersCountLessThanOrEqual = ParseInt(node["pendingMembersCountLessThanOrEqual"].Value <string>());
     }
     if (node["privacyContextEqual"] != null)
     {
         this._PrivacyContextEqual = node["privacyContextEqual"].Value <string>();
     }
     if (node["statusEqual"] != null)
     {
         this._StatusEqual = (CategoryStatus)ParseEnum(typeof(CategoryStatus), node["statusEqual"].Value <string>());
     }
     if (node["statusIn"] != null)
     {
         this._StatusIn = node["statusIn"].Value <string>();
     }
     if (node["inheritedParentIdEqual"] != null)
     {
         this._InheritedParentIdEqual = ParseInt(node["inheritedParentIdEqual"].Value <string>());
     }
     if (node["inheritedParentIdIn"] != null)
     {
         this._InheritedParentIdIn = node["inheritedParentIdIn"].Value <string>();
     }
     if (node["partnerSortValueGreaterThanOrEqual"] != null)
     {
         this._PartnerSortValueGreaterThanOrEqual = ParseInt(node["partnerSortValueGreaterThanOrEqual"].Value <string>());
     }
     if (node["partnerSortValueLessThanOrEqual"] != null)
     {
         this._PartnerSortValueLessThanOrEqual = ParseInt(node["partnerSortValueLessThanOrEqual"].Value <string>());
     }
     if (node["aggregationCategoriesMultiLikeOr"] != null)
     {
         this._AggregationCategoriesMultiLikeOr = node["aggregationCategoriesMultiLikeOr"].Value <string>();
     }
     if (node["aggregationCategoriesMultiLikeAnd"] != null)
     {
         this._AggregationCategoriesMultiLikeAnd = node["aggregationCategoriesMultiLikeAnd"].Value <string>();
     }
 }
Example #35
0
 /// <summary>
 /// 新建相册
 /// </summary>
 /// <param name="userID">用户</param>
 /// <param name="privacyType">隐私类型</param>
 /// <param name="name">名称</param>
 /// <param name="cover">相册封面</param>
 /// <param name="password">隐私类型为需要密码时的密码</param>
 public abstract int CreateAlbum(int userID, PrivacyType privacyType, string name, string description, string cover, string password);
Example #36
0
		public async Task<string> PhotosCreateAlbumAsync(
			 string title ,
			 string description = "",
			 uint? groupId = null,
			 PrivacyType? privacy = null,
			 PrivacyType? commentPrivacy = null
			){
			return await Executor.ExecRawAsync(
				_reqapi.PhotosCreateAlbum(
											title,
											description,
											groupId,
											privacy,
											commentPrivacy
									)
			);
		}
Example #37
0
        public override void UpdateFeedPrivacyType(Guid appID, int actionType, int targetID, PrivacyType privacyType, List<int> visibleUserIDs)
        {
            string userIDs = StringUtil.Join(visibleUserIDs);
            //如果超出800 会被数据库截断  所以要处理
            if (userIDs.Length > 800)
            {
                userIDs = userIDs.Substring(0, 800);
                userIDs = userIDs.Substring(0, userIDs.LastIndexOf(','));
            }
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_UpdateFeedPrivacyType";
                query.CommandType = CommandType.StoredProcedure;

                query.CreateParameter<int>("@PrivacyType", (int)privacyType, SqlDbType.TinyInt);
                query.CreateParameter<int>("@ActionType", actionType, SqlDbType.TinyInt);
                query.CreateParameter<int>("@TargetID", targetID, SqlDbType.Int);
                query.CreateParameter<Guid>("@AppID", appID, SqlDbType.UniqueIdentifier);
                query.CreateParameter<string>("@VisibleUserIDs", userIDs, SqlDbType.VarChar, 800);


                query.ExecuteNonQuery();
            }
        }
Example #38
0
    public VideoGalleryItem SaveSingle(string WebVideoID, int CatgoryID, string txtTags, string txtTitle, string txtCaption, bool DoDelete, string strIndex, bool MakePrivate)
    {
        VideoGalleryItem galleryItem = new VideoGalleryItem();

        galleryItem.Index = strIndex;

        member = (Member)Session["Member"];
        bool Update = false;

        if (member != null)
        {
            Video video = Video.GetVideoByWebVideoIDWithJoin(WebVideoID);

            if (video != null)
            {
                if (video.MemberID == member.MemberID)
                {
                    if (DoDelete)
                    {
                        video.Delete();
                        galleryItem.IsRemoved = true;
                    }
                    else
                    {
                        if (video.Category != CatgoryID)
                        {
                            video.Category = CatgoryID;
                            Update         = true;
                        }

                        if (video.Tags != txtTags)
                        {
                            video.Tags = txtTags;
                            Update     = true;

                            video.UpdateTags();

                            galleryItem.Tags = video.Tags;
                        }

                        if (video.Title != txtTitle)
                        {
                            video.Title = txtTitle;
                            Update      = true;
                        }

                        if (video.Description != txtCaption)
                        {
                            video.Description = txtCaption;
                            Update            = true;
                        }

                        PrivacyType pt = PrivacyType.Public;
                        if (MakePrivate)
                        {
                            pt = PrivacyType.Network;
                        }

                        if (video.PrivacyFlag != (int)pt)
                        {
                            video.PrivacyFlag = (int)pt;
                            Update            = true;
                        }

                        if (Update)
                        {
                            video.Save();
                        }
                    }
                }
            }
        }

        return(galleryItem);
    }
Example #39
0
        ///// <summary>
        ///// 为需要更新的关键字填充恢复关键信息
        ///// </summary>
        ///// <param name="processlist">要处理的列表</param>
        //public abstract void FillShareReverters(TextRevertable2Collection processlist);

        ///// <summary>
        ///// 更新关键字
        ///// </summary>
        ///// <param name="processlist">要处理的列表</param>
        //public abstract void UpdateShareKeywords(TextRevertable2Collection processlist);

        /// <summary>
        /// 添加一个分享
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="shareType"></param>
        /// <param name="privacyType"></param>
        /// <param name="content">简要内容</param>
        /// <param name="description">评论</param>
        public abstract int CreateShare(int userID, ShareType shareType, PrivacyType privacyType, string title, string url, string content, string description, string descriptionReverter, int targetID);
Example #40
0
    /// <summary>
    /// Concatonates the videos into HTML for the lister control
    /// </summary>
    private TabContents GetVideoLister(string WebMemberID, int Page, bool WrapInP)
    {
        PrivacyType privacyType = PrivacyType.Public;

        if (member != null)
        {
            if (
                ViewingMember.MemberID == member.MemberID ||
                Friend.IsFriend(member.MemberID, ViewingMember.MemberID))
            {
                privacyType = PrivacyType.Network;
            }
        }

        List <Next2Friends.Data.Video> videos = Next2Friends.Data.Video.GetTopVideosByMemberIDWithJoin(ViewingMember.MemberID, privacyType);

        NumberOfVideos = videos.Count;
        int DisplayNumberOfVideos = 12;
        int StartIndex            = Page * DisplayNumberOfVideos;
        int EndIndex = StartIndex + DisplayNumberOfVideos;

        StringBuilder sbHTML = new StringBuilder();

        for (int i = StartIndex; i < EndIndex; i++)
        {
            if (videos.Count <= i)
            {
                break;
            }

            object[] parameters = new object[11];

            parameters[0] = ParallelServer.Get(videos[i].ThumbnailResourceFile.FullyQualifiedURL) + videos[i].ThumbnailResourceFile.FullyQualifiedURL;
            parameters[1] = videos[i].Duration.ToString();
            parameters[2] = videos[i].VeryShortTitle;
            parameters[3] = TimeDistance.TimeAgo(videos[i].DTCreated);
            parameters[4] = videos[i].VeryShortDescription;
            parameters[5] = videos[i].NumberOfViews;
            parameters[6] = videos[i].WebVideoID;
            parameters[7] = videos[i].NumberOfComments;
            parameters[8] = videos[i].Title;
            parameters[9] = RegexPatterns.FormatStringForURL(videos[i].Title);



//            sbHTML.AppendFormat(@"<li>
//								<div class='vid_thumb'> <a href='/video/{9}/{6}'><img src='{0}' width='124' height='91' alt='{8}' /></a></div>
//								<div class='vid_info'>
//									<h3><a href='/video/{9}/{6}'>{2}</a></h3>
//									<p class='timestamp'>{3}</p>
//									<p>{4}</p>
//									<p class='metadata'>Views: {5} Comments: {7}</p>
//								</div>
//							</li>", parameters);

            sbHTML.AppendFormat(@"<li style='width:145px;clear: none;margin-left:3px'>
								<div class='vid_thumb'> <a href='javascript:displayMiniVideo(""{6}"",""{8}"");'><img src='{0}' width='124' height='91' alt='{8}' /></a></div>
							</li>"                            , parameters);
        }

        TabContents tabContents = new TabContents();

        int PreviousPage = Page - 1;
        int NextPage     = Page + 1;

        tabContents.PagerHTML  = (WrapInP) ? "<p class='view_all' id='pPager'>" : string.Empty;
        tabContents.PagerHTML += (Page > 0) ? @"<p class='view_all'><a href='javascript:ajaxGetListerContent(""" + WebMemberID + @""",1," + PreviousPage + @");' class='previous'>Previous</a>" : string.Empty;
        tabContents.PagerHTML += (videos.Count > (NextPage * DisplayNumberOfVideos)) ? @"<a href='javascript:ajaxGetListerContent(""" + WebMemberID + @""",1," + NextPage + @");' class='next'>Next</a></p>" : string.Empty;
        tabContents.PagerHTML += (WrapInP) ? "</p>" : string.Empty;
        tabContents.HTML       = (NumberOfVideos > 0) ? "<ul class='profile_vid_list' id='ulContentLister'>" + sbHTML.ToString() + "</ul>" : "<p>Member currently has no Videos.</p>";

        // tabContents.HTML = sbHTML.ToString();

        return(tabContents);
    }
Example #41
0
 /// <summary>
 /// 更新日志
 /// </summary>
 /// <param name="operatorID">编辑者ID</param>
 /// <param name="operatorIP">编辑者IP</param>
 /// <param name="articleID">日志ID</param>
 /// <param name="subject">日志标题</param>
 /// <param name="content">日志内容</param>
 /// <param name="thumbnail">日志缩略图</param>
 /// <param name="categoryID">日志分类ID</param>
 /// <param name="enableComment">日志是否允许评论</param>
 /// <param name="privacyType">日志隐私设置</param>
 /// <param name="password">日志访问密码</param>
 /// <param name="isApproved">日志是否通过审核</param>
 /// <returns>操作是否成功</returns>
 public abstract bool UpdateBlogArticle(int operatorID, string operatorIP, int articleID, string subject, string content, string thumbnail, int?categoryID, bool enableComment, PrivacyType privacyType, string password, bool isApproved);
Example #42
0
		public async Task PhotosEditAlbumAsync(
			 long albumId ,
			 int? ownerId = null,
			 string title = "",
			 string description = "",
			 PrivacyType? privacy = null,
			 PrivacyType? commentPrivacy = null
			){
			await Executor.ExecAsync(
				_reqapi.PhotosEditAlbum(
											albumId,
											ownerId,
											title,
											description,
											privacy,
											commentPrivacy
									)
			);
		}
Example #43
0
 public ProfileSettings(PrivacyType privacyType)
 {
     PrivacyType = privacyType;
 }
Example #44
0
        public override bool UpdateBlogArticle(int userID, string createIP, int articleID, string subject, string content, string thumbnail, int? categoryID, bool enableComment, PrivacyType privacyType, string password, bool isApproved)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "bx_Blog_PostBlogArticle";
                query.CommandType = CommandType.StoredProcedure;

                query.CreateParameter<int>("@UserID", userID, SqlDbType.Int);
                query.CreateParameter<int>("@ArticleID", articleID, SqlDbType.Int);
                query.CreateParameter<int>("@CategoryID", categoryID == null ? 0 : categoryID.Value, SqlDbType.Int);
                query.CreateParameter<bool>("@IsApproved", isApproved, SqlDbType.Bit);
                query.CreateParameter<bool>("@EnableComment", enableComment, SqlDbType.Bit);
                query.CreateParameter<PrivacyType>("@PrivacyType", privacyType, SqlDbType.TinyInt);
                query.CreateParameter<string>("@CreateIP", createIP, SqlDbType.VarChar, 50);
                query.CreateParameter<string>("@Thumb", thumbnail, SqlDbType.VarChar, 200);
                query.CreateParameter<string>("@Subject", subject, SqlDbType.NVarChar, 200);
                query.CreateParameter<string>("@Password", password, SqlDbType.NVarChar, 50);
                query.CreateParameter<string>("@Content", content, SqlDbType.NText);

                query.ExecuteNonQuery();

                return true;
            }
        }
 public DefaultPermission()
 {
     PermissionType = PermissionType.None;
     DefaultValue   = PrivacyType.NotSet;
 }
Example #46
0
 /// <summary>
 /// 编辑指定相册
 /// </summary>
 /// <param name="albumID">指定相册ID</param>
 /// <param name="albumName">相册名称</param>
 /// <param name="privacyType">编辑为的隐私类型</param>
 /// <param name="password">若隐私类型为需要密码,此参数为该密码</param>
 public abstract bool UpdateAlbum(int albumID, string name, string description, PrivacyType privacyType, string password, int editUserID);
Example #47
0
        public Category(XmlElement node) : base(node)
        {
            foreach (XmlElement propertyNode in node.ChildNodes)
            {
                switch (propertyNode.Name)
                {
                case "id":
                    this._Id = ParseInt(propertyNode.InnerText);
                    continue;

                case "parentId":
                    this._ParentId = ParseInt(propertyNode.InnerText);
                    continue;

                case "depth":
                    this._Depth = ParseInt(propertyNode.InnerText);
                    continue;

                case "partnerId":
                    this._PartnerId = ParseInt(propertyNode.InnerText);
                    continue;

                case "name":
                    this._Name = propertyNode.InnerText;
                    continue;

                case "fullName":
                    this._FullName = propertyNode.InnerText;
                    continue;

                case "fullIds":
                    this._FullIds = propertyNode.InnerText;
                    continue;

                case "entriesCount":
                    this._EntriesCount = ParseInt(propertyNode.InnerText);
                    continue;

                case "createdAt":
                    this._CreatedAt = ParseInt(propertyNode.InnerText);
                    continue;

                case "updatedAt":
                    this._UpdatedAt = ParseInt(propertyNode.InnerText);
                    continue;

                case "description":
                    this._Description = propertyNode.InnerText;
                    continue;

                case "tags":
                    this._Tags = propertyNode.InnerText;
                    continue;

                case "appearInList":
                    this._AppearInList = (AppearInListType)ParseEnum(typeof(AppearInListType), propertyNode.InnerText);
                    continue;

                case "privacy":
                    this._Privacy = (PrivacyType)ParseEnum(typeof(PrivacyType), propertyNode.InnerText);
                    continue;

                case "inheritanceType":
                    this._InheritanceType = (InheritanceType)ParseEnum(typeof(InheritanceType), propertyNode.InnerText);
                    continue;

                case "userJoinPolicy":
                    this._UserJoinPolicy = (UserJoinPolicyType)ParseEnum(typeof(UserJoinPolicyType), propertyNode.InnerText);
                    continue;

                case "defaultPermissionLevel":
                    this._DefaultPermissionLevel = (CategoryUserPermissionLevel)ParseEnum(typeof(CategoryUserPermissionLevel), propertyNode.InnerText);
                    continue;

                case "owner":
                    this._Owner = propertyNode.InnerText;
                    continue;

                case "directEntriesCount":
                    this._DirectEntriesCount = ParseInt(propertyNode.InnerText);
                    continue;

                case "referenceId":
                    this._ReferenceId = propertyNode.InnerText;
                    continue;

                case "contributionPolicy":
                    this._ContributionPolicy = (ContributionPolicyType)ParseEnum(typeof(ContributionPolicyType), propertyNode.InnerText);
                    continue;

                case "membersCount":
                    this._MembersCount = ParseInt(propertyNode.InnerText);
                    continue;

                case "pendingMembersCount":
                    this._PendingMembersCount = ParseInt(propertyNode.InnerText);
                    continue;

                case "privacyContext":
                    this._PrivacyContext = propertyNode.InnerText;
                    continue;

                case "privacyContexts":
                    this._PrivacyContexts = propertyNode.InnerText;
                    continue;

                case "status":
                    this._Status = (CategoryStatus)ParseEnum(typeof(CategoryStatus), propertyNode.InnerText);
                    continue;

                case "inheritedParentId":
                    this._InheritedParentId = ParseInt(propertyNode.InnerText);
                    continue;

                case "partnerSortValue":
                    this._PartnerSortValue = ParseInt(propertyNode.InnerText);
                    continue;

                case "partnerData":
                    this._PartnerData = propertyNode.InnerText;
                    continue;

                case "defaultOrderBy":
                    this._DefaultOrderBy = (CategoryOrderBy)StringEnum.Parse(typeof(CategoryOrderBy), propertyNode.InnerText);
                    continue;

                case "directSubCategoriesCount":
                    this._DirectSubCategoriesCount = ParseInt(propertyNode.InnerText);
                    continue;

                case "moderation":
                    this._Moderation = (NullableBoolean)ParseEnum(typeof(NullableBoolean), propertyNode.InnerText);
                    continue;

                case "pendingEntriesCount":
                    this._PendingEntriesCount = ParseInt(propertyNode.InnerText);
                    continue;

                case "isAggregationCategory":
                    this._IsAggregationCategory = (NullableBoolean)ParseEnum(typeof(NullableBoolean), propertyNode.InnerText);
                    continue;

                case "aggregationCategories":
                    this._AggregationCategories = propertyNode.InnerText;
                    continue;
                }
            }
        }