Пример #1
0
        private bool SaveFeedPrivacy()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("feedprivacy");

            int userID             = MyUserID;
            AppBaseCollection apps = AppManager.GetAllApps();

            //所有动作都加入动态的应用
            //string appIDString = _Request.Get("apps", Method.Post);

            //string[] appIDs;
            //if (!string.IsNullOrEmpty(appIDString))
            //{
            //    appIDs = appIDString.Split(',');
            //}
            //else
            //    appIDs = new string[] { };


            UserNoAddFeedAppCollection userNoAddFeedApps = new UserNoAddFeedAppCollection();

            foreach (AppBase app in apps)
            {
                //bool isAddAllAction = false;
                //foreach (string appID in appIDs)
                //{
                //    if (app.AppID.ToString() == appID)//该应用的所有动作都加入动态
                //    {
                //        isAddAllAction = true;
                //        break;
                //    }
                //}

                //if (!isAddAllAction)
                //{

                //加入动态的动作
                string actionIDString = _Request.Get("app_" + app.AppID.ToString() + "_Actions", Method.Post);

                string[] actionIDs;
                if (!string.IsNullOrEmpty(actionIDString))
                {
                    actionIDs = actionIDString.Split(',');
                }
                else
                {
                    actionIDs = new string[] { }
                };

                foreach (AppAction appAction in app.AppActions)
                {
                    bool isAddFeed = false;
                    foreach (string actionType in actionIDs)
                    {
                        if (appAction.ActionType.ToString() == actionType)
                        {
                            isAddFeed = true;
                            break;
                        }
                    }

                    UserNoAddFeedApp userNoAddFeedApp = new UserNoAddFeedApp();
                    userNoAddFeedApp.AppID      = app.AppID;
                    userNoAddFeedApp.ActionType = appAction.ActionType;
                    userNoAddFeedApp.UserID     = MyUserID;
                    userNoAddFeedApp.Send       = isAddFeed;
                    userNoAddFeedApps.Add(userNoAddFeedApp);
                }

                //}
            }

            try
            {
                FeedBO.Instance.SetUserNoAddFeedApps(userID, userNoAddFeedApps);
                //msgDisplay.ShowInfo(this);
                //ShowSuccess();
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
                return(false);
            }

            return(true);
        }
Пример #2
0
        private bool SaveFeedPrivacy()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("feedprivacy");

            int userID = MyUserID;
            AppBaseCollection apps = AppManager.GetAllApps();

            //所有动作都加入动态的应用
            //string appIDString = _Request.Get("apps", Method.Post);

            //string[] appIDs;
            //if (!string.IsNullOrEmpty(appIDString))
            //{
            //    appIDs = appIDString.Split(',');
            //}
            //else
            //    appIDs = new string[] { };


            UserNoAddFeedAppCollection userNoAddFeedApps = new UserNoAddFeedAppCollection();

            foreach (AppBase app in apps)
            {
                //bool isAddAllAction = false;
                //foreach (string appID in appIDs)
                //{
                //    if (app.AppID.ToString() == appID)//该应用的所有动作都加入动态
                //    {
                //        isAddAllAction = true;
                //        break;
                //    }
                //}

                //if (!isAddAllAction)
                //{

                    //加入动态的动作
                    string actionIDString = _Request.Get("app_" + app.AppID.ToString() + "_Actions", Method.Post);

                    string[] actionIDs;
                    if (!string.IsNullOrEmpty(actionIDString))
                    {
                        actionIDs = actionIDString.Split(',');
                    }
                    else
                        actionIDs = new string[] { };

                    foreach (AppAction appAction in app.AppActions)
                    {
                        bool isAddFeed = false;
                        foreach (string actionType in actionIDs)
                        {
                            if (appAction.ActionType.ToString() == actionType)
                            {
                                isAddFeed = true;
                                break;
                            }
                        }

                        UserNoAddFeedApp userNoAddFeedApp = new UserNoAddFeedApp();
                        userNoAddFeedApp.AppID = app.AppID;
                        userNoAddFeedApp.ActionType = appAction.ActionType;
                        userNoAddFeedApp.UserID = MyUserID;
                        userNoAddFeedApp.Send = isAddFeed;
                        userNoAddFeedApps.Add(userNoAddFeedApp);
                    }

                //}
            }

            try
            {
                FeedBO.Instance.SetUserNoAddFeedApps(userID, userNoAddFeedApps);
                //msgDisplay.ShowInfo(this);
                //ShowSuccess();
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
                return false;
            }

            return true;
        }