示例#1
0
        /// <summary>
        /// 更新用户应用信息
        /// </summary>
        /// <param name="userAppInfo"></param>
        /// <returns></returns>
        public static int UpdateUserApplication(UserApplicationInfo userAppInfo)
        {
            if (userAppInfo == null || userAppInfo.Uid < 1 || userAppInfo.AppId < 1)
                return -1;

            return Data.ManyouApplications.UpdateUserApplication(userAppInfo);
        }
        public string Add()
        {
            AddUserApplicationParams actionParam = JavaScriptConvert.DeserializeObject<AddUserApplicationParams>(UnicodeToString(JsonParams));//当传递过来的参数值可能存在unicode编码的字符串时需要使用UnicodeToString方法

            UserApplicationInfo userAppInfo = new UserApplicationInfo();
            userAppInfo.AppId = actionParam.AppId;
            userAppInfo.AppName = actionParam.AppName;
            userAppInfo.Uid = actionParam.Uid;
            userAppInfo.AllowFeed = actionParam.AllowFeed == null || (bool)actionParam.AllowFeed ? 1 : 0;//可不传递型属性处理实例
            userAppInfo.AllowProfileLink = actionParam.AllowProfileLink == null || (bool)actionParam.AllowProfileLink ? 1 : 0;
            userAppInfo.AllowSideNav = actionParam.AllowSideNav == null || (bool)actionParam.AllowSideNav ? 1 : 0;
            userAppInfo.DisplayOrder = actionParam.DisplayOrder == null ? 0 : (int)actionParam.DisplayOrder;
            userAppInfo.Privacy = Utils.GetEnum<PrivacyEnum>(actionParam.Privacy, PrivacyEnum.Public);

            //不确定代码
            userAppInfo.ProfileLink = actionParam.DefaultProfileLink;
            userAppInfo.MYML = actionParam.DefaultMYML;

            //当用户添加应用的时候,会在全局应用表中也增加或者更新原有记录,保证数据同步
            ManyouApplicationInfo appInfo = new ManyouApplicationInfo();
            appInfo.AppId = actionParam.AppId;
            appInfo.AppName = actionParam.AppName;
            appInfo.DisplayMethod = Utils.GetEnum<DisplayMethod>(actionParam.DisplayMethod, DisplayMethod.IFrame);
            appInfo.DisplayOrder = actionParam.DisplayOrder ?? 0;
            appInfo.Version = TypeConverter.StrToInt(actionParam.Version);

            ManyouApplications.UpdateApplicationInfo(appInfo);

            return GetResult(ManyouApplications.AddUserApplication(userAppInfo) > -1);
        }
示例#3
0
        /// <summary>
        /// 用户增加新应用
        /// </summary>
        /// <param name="userAppInfo"></param>
        /// <returns></returns>
        public static int AddUserApplication(UserApplicationInfo userAppInfo)
        {
            if (userAppInfo == null || userAppInfo.Uid < 1 || userAppInfo.AppId < 1)
                return -1;

            int result = Data.ManyouApplications.AddUserApplication(userAppInfo);

            DeleteApplicationInviteByAppId(userAppInfo.Uid, userAppInfo.AppId);

            int olId = OnlineUsers.GetOlidByUid(userAppInfo.Uid);

            if (olId > 0) //更新在线表信息
                OnlineUsers.UpdateNewApplicationRequest(olId, ManyouApplications.GetApplicationInviteCount(userAppInfo.Uid));

            return result;
        }
        public string Update()
        {
            UpdateUserApplicationParams actionParam = JavaScriptConvert.DeserializeObject<UpdateUserApplicationParams>(UnicodeToString(JsonParams));

            UserApplicationInfo userAppInfo = new UserApplicationInfo();
            userAppInfo.AppId = actionParam.AppIds[0];
            userAppInfo.AppName = actionParam.AppName;
            userAppInfo.Uid = actionParam.Uid;
            userAppInfo.AllowFeed = actionParam.AllowFeed == null || (bool)actionParam.AllowFeed ? 1 : 0;//可不传递型属性处理实例
            userAppInfo.AllowProfileLink = actionParam.AllowProfileLink == null || (bool)actionParam.AllowProfileLink ? 1 : 0;
            userAppInfo.AllowSideNav = actionParam.AllowSideNav == null || (bool)actionParam.AllowSideNav ? 1 : 0;
            userAppInfo.DisplayOrder = actionParam.DisplayOrder == null ? 0 : (int)actionParam.DisplayOrder;
            userAppInfo.Privacy = Utils.GetEnum<PrivacyEnum>(actionParam.Privacy, PrivacyEnum.Public);
            //不确定代码
            userAppInfo.ProfileLink = actionParam.DefaultProfileLink;
            userAppInfo.MYML = actionParam.DefaultMYML;

            return GetResult(ManyouApplications.UpdateUserApplication(userAppInfo) > -1);
        }
 private UserApplicationMessage LoadSingleUserApplicationMessage(UserApplicationInfo userAppInfo)
 {
     UserApplicationMessage appMsg = new UserApplicationMessage();
     appMsg.AllowFeed = userAppInfo.AllowFeed == 1;
     appMsg.AllowProfileLink = userAppInfo.AllowProfileLink == 1;
     appMsg.AllowSideNav = userAppInfo.AllowSideNav == 1;
     appMsg.AppId = userAppInfo.AppId;
     appMsg.DisplayOrder = userAppInfo.DisplayOrder;
     appMsg.Privacy = GetPrivacyString(userAppInfo.Privacy);
     return appMsg;
 }
 /// <summary>
 /// 更新用户应用信息
 /// </summary>
 /// <param name="userAppInfo"></param>
 /// <returns></returns>
 public static int UpdateUserApplication(UserApplicationInfo userAppInfo)
 {
     return DatabaseProvider.GetInstance().UpdateUserApplication(userAppInfo);
 }
        private static UserApplicationInfo LoadShortUserApplicationInfo(IDataReader reader)
        {
            UserApplicationInfo userAppInfo = new UserApplicationInfo();

            userAppInfo.AppId = TypeConverter.ObjectToInt(reader["appid"]);
            userAppInfo.AppName = reader["appname"].ToString();
            userAppInfo.Uid = TypeConverter.ObjectToInt(reader["uid"]);
            userAppInfo.DisplayOrder = TypeConverter.ObjectToInt(reader["displayorder"]);
            userAppInfo.MenuOrder = TypeConverter.ObjectToInt(reader["menuorder"]);

            return userAppInfo;

        }
        private static UserApplicationInfo LoadUserApplicationInfo(IDataReader reader)
        {
            UserApplicationInfo userAppInfo = new UserApplicationInfo();

            userAppInfo.AppId = TypeConverter.ObjectToInt(reader["appid"]);
            userAppInfo.AppName = reader["appname"].ToString();
            userAppInfo.Uid = TypeConverter.ObjectToInt(reader["uid"]);
            userAppInfo.AllowSideNav = TypeConverter.ObjectToInt(reader["allowsidenav"]);
            userAppInfo.AllowFeed = TypeConverter.ObjectToInt(reader["allowfeed"]);
            userAppInfo.AllowProfileLink = TypeConverter.ObjectToInt(reader["allowprofilelink"]);
            userAppInfo.Narrow = TypeConverter.ObjectToInt(reader["narrow"]);
            userAppInfo.DisplayOrder = TypeConverter.ObjectToInt(reader["displayorder"]);
            userAppInfo.MenuOrder = TypeConverter.ObjectToInt(reader["menuorder"]);
            userAppInfo.ProfileLink = reader["profilelink"].ToString();
            userAppInfo.MYML = reader["myml"].ToString();

            return userAppInfo;
        }