コード例 #1
0
        public static void saveSubscriptions(string UserId, string FriendId, SubscriptionsBO sbo)
        {
            //SubscriptionsBO sbo = new SubscriptionsBO();
            MongoCollection <PostOptions> objCollection = db.GetCollection <PostOptions>("c_PostOption");
            var query = Query.And(
                Query.EQ("UserId", ObjectId.Parse(UserId)),
                Query.EQ("FriendId", ObjectId.Parse(FriendId)));
            var result = objCollection.Find(query);

            if (result.Any())
            {
                var update = Update
                             .Set("SubscriptionStatus", sbo.Status)
                             .Set("SubscriptionPhotos", sbo.Photos)
                             .Set("SubscriptionVideos", sbo.Videos)

                             .Set("SubscriptionLinks", sbo.Links)
                             .Set("SubscriptionVideoLinks", sbo.VideoLinks)
                ;
                var sortBy  = SortBy.Descending("_id");
                var result2 = objCollection.FindAndModify(query, sortBy, update, true);
            }

            // return sbo;
        }
コード例 #2
0
    protected void LoadSubscription()
    {
        string          FriendId = Session["TempUserId"].ToString();
        string          UserId   = Session["UserId"].ToString();
        SubscriptionsBO sbo      = WallBLL.getSubscriptions(UserId, FriendId);

        if (sbo.Links == 0)
        {
            CheckBoxList1.Items.FindByValue("Links").Selected = true;
        }
        if (sbo.Photos == 0)
        {
            CheckBoxList1.Items.FindByValue("Photos").Selected = true;
        }
        if (sbo.Status == 0)
        {
            CheckBoxList1.Items.FindByValue("Status").Selected = true;
        }
        if (sbo.VideoLinks == 0)
        {
            CheckBoxList1.Items.FindByValue("VideoLinks").Selected = true;
        }
        if (sbo.Videos == 0)
        {
            CheckBoxList1.Items.FindByValue("Videos").Selected = true;
        }
    }
コード例 #3
0
        public static SubscriptionsBO getSubscriptions(string UserId, string FriendId)
        {
            SubscriptionsBO sbo = new SubscriptionsBO();
            MongoCollection <PostOptions> objCollection = db.GetCollection <PostOptions>("c_PostOption");
            var query = Query.And(
                Query.EQ("UserId", ObjectId.Parse(UserId)),
                Query.EQ("FriendId", ObjectId.Parse(FriendId)));
            var result = objCollection.Find(query);

            if (!result.Any())
            {
                //sbo.All = 0;
                sbo.Links      = 0;
                sbo.Photos     = 0;
                sbo.Status     = 0;
                sbo.VideoLinks = 0;
                sbo.Videos     = 0;
            }
            else
            {
                foreach (PostOptions po in result)
                {
                    //updatestype = po.UpdatesType;
                    //sbo.All = po.SubscriptionAll;
                    sbo.Photos     = po.SubscriptionPhotos;
                    sbo.Links      = po.SubscriptionLinks;
                    sbo.Videos     = po.SubscriptionVideos;
                    sbo.VideoLinks = po.SubscriptionVideoLinks;
                    sbo.Status     = po.SubscriptionStatus;
                    break;
                }
            }

            return(sbo);
        }
コード例 #4
0
ファイル: ViewProfile.aspx.cs プロジェクト: usmanasif/pyramid
    protected void btnSubSave_Click(object sender, EventArgs e)
    {
        string FriendId = Session["TempUserId"].ToString();
        string UserId = Session["UserId"].ToString();
        SubscriptionsBO sbo = new SubscriptionsBO();

        //sbo.All = CheckBoxList1.Items.FindByValue("All").Selected == true ? 0 : 1;

        sbo.Links = CheckBoxList1.Items.FindByValue("Links").Selected == true ? 0 : 1;

        sbo.Photos = CheckBoxList1.Items.FindByValue("Photos").Selected == true ? 0 : 1;

        sbo.Status = CheckBoxList1.Items.FindByValue("Status").Selected == true ? 0 : 1;

        sbo.VideoLinks = CheckBoxList1.Items.FindByValue("VideoLinks").Selected == true ? 0 : 1;

        sbo.Videos = CheckBoxList1.Items.FindByValue("Videos").Selected == true ? 0 : 1;

        WallBLL.saveSubscriptions(UserId, FriendId, sbo);
    }
コード例 #5
0
    protected void btnSubSave_Click(object sender, EventArgs e)
    {
        string          FriendId = Session["TempUserId"].ToString();
        string          UserId   = Session["UserId"].ToString();
        SubscriptionsBO sbo      = new SubscriptionsBO();

        //sbo.All = CheckBoxList1.Items.FindByValue("All").Selected == true ? 0 : 1;

        sbo.Links = CheckBoxList1.Items.FindByValue("Links").Selected == true ? 0 : 1;

        sbo.Photos = CheckBoxList1.Items.FindByValue("Photos").Selected == true ? 0 : 1;

        sbo.Status = CheckBoxList1.Items.FindByValue("Status").Selected == true ? 0 : 1;

        sbo.VideoLinks = CheckBoxList1.Items.FindByValue("VideoLinks").Selected == true ? 0 : 1;

        sbo.Videos = CheckBoxList1.Items.FindByValue("Videos").Selected == true ? 0 : 1;

        WallBLL.saveSubscriptions(UserId, FriendId, sbo);
    }
コード例 #6
0
ファイル: WallDAL.cs プロジェクト: usmanasif/pyramid
        public static void saveSubscriptions(string UserId, string FriendId, SubscriptionsBO sbo)
        {
            //SubscriptionsBO sbo = new SubscriptionsBO();
            MongoCollection<PostOptions> objCollection = db.GetCollection<PostOptions>("c_PostOption");
            var query = Query.And(
                          Query.EQ("UserId", ObjectId.Parse(UserId)),
                          Query.EQ("FriendId", ObjectId.Parse(FriendId)));
            var result = objCollection.Find(query);
            if (result.Any())
            {
                var update = Update
                                    .Set("SubscriptionStatus", sbo.Status)
                                    .Set("SubscriptionPhotos", sbo.Photos)
                                    .Set("SubscriptionVideos", sbo.Videos)

                                    .Set("SubscriptionLinks", sbo.Links)
                                    .Set("SubscriptionVideoLinks", sbo.VideoLinks)
                                        ;
                var sortBy = SortBy.Descending("_id");
                var result2 = objCollection.FindAndModify(query, sortBy, update, true);

            }

            // return sbo;
        }
コード例 #7
0
ファイル: WallDAL.cs プロジェクト: usmanasif/pyramid
        public static SubscriptionsBO getSubscriptions(string UserId, string FriendId)
        {
            SubscriptionsBO sbo = new SubscriptionsBO();
            MongoCollection<PostOptions> objCollection = db.GetCollection<PostOptions>("c_PostOption");
            var query = Query.And(
                          Query.EQ("UserId", ObjectId.Parse(UserId)),
                          Query.EQ("FriendId", ObjectId.Parse(FriendId)));
            var result = objCollection.Find(query);
            if (!result.Any())
            {
                //sbo.All = 0;
                sbo.Links = 0;
                sbo.Photos = 0;
                sbo.Status = 0;
                sbo.VideoLinks = 0;
                sbo.Videos = 0;
            }
            else
            {
                foreach (PostOptions po in result)
                {
                    //updatestype = po.UpdatesType;
                    //sbo.All = po.SubscriptionAll;
                    sbo.Photos = po.SubscriptionPhotos;
                    sbo.Links = po.SubscriptionLinks;
                    sbo.Videos = po.SubscriptionVideos;
                    sbo.VideoLinks = po.SubscriptionVideoLinks;
                    sbo.Status = po.SubscriptionStatus;
                    break;
                }

            }

            return sbo;
        }
コード例 #8
0
 public static void saveSubscriptions(string UserId, string FriendId, SubscriptionsBO sbo)
 {
     WallDAL.saveSubscriptions(UserId, FriendId, sbo);
 }