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)); }
public string Update() { UpdateApplicationParams actionParams = JavaScriptConvert.DeserializeObject <UpdateApplicationParams>(UnicodeToString(JsonParams)); ManyouApplicationInfo appInfo = new ManyouApplicationInfo(); appInfo.AppId = actionParams.AppId; appInfo.AppName = actionParams.AppName; appInfo.DisplayMethod = Utils.GetEnum <DisplayMethod>(actionParams.DisplayMethod, DisplayMethod.IFrame); appInfo.DisplayOrder = actionParams.DisplayOrder; appInfo.Version = actionParams.Version; return(GetResult(ManyouApplications.UpdateApplicationInfo(appInfo))); }