public FunctionOpenResult <bool> UpdateByID(Project info) { var r = new FunctionOpenResult <bool>(); r.Data = ProjectDal.update(info) > 0; return(r); }
public FunctionOpenResult <bool> DeleteCodeTemplateByID(List <int> idList) { var r = new FunctionOpenResult <bool>(); r.Data = CodeTemplateDal.Delete(idList); return(r); }
public FunctionOpenResult <bool> AddComponentConfigForApp(int componentConfigId, int appConfigId) { var r = new FunctionOpenResult <bool>(); var data = Rel_AppConfig_ComponentConfigDal.Get(appConfigId, componentConfigId); if (data != null) { r.Data = false; r.ErrorMsg = "此数据已存在"; return(r); } var appConfig = AppConfigDal.Get(appConfigId); var componentConfig = ComponentConfigDal.Get(componentConfigId); if (componentConfig == null) { r.Data = false; r.ErrorMsg = "此组件配置不存在"; return(r); } if ((appConfig != null) && (componentConfig != null)) { r.Data = Rel_AppConfig_ComponentConfigDal.Add(new Rel_AppConfig_ComponentConfig() { AppConfigId = appConfig.AppConfigId, AppConfigVersion = appConfig.Version, ComponentConfigId = componentConfig.ComponentConfigId, ComponentConfigVersion = componentConfig.Version, SolutionID = appConfig.SolutionID }) > 0; } return(r); }
public FunctionOpenResult <bool> DeleteCodeTemplateByID(List <int> idList) { var r = new FunctionOpenResult <bool>(); r.Data = (CodeTemplateDal.Delete(idList) && Rel_Solution_CodeTemplateDal.DeleteByCodeTemplateId(idList)); return(r); }
public FunctionOpenResult <CreateGogsRepoResult> CreateGitRepo(CreateGogsRepoParamater repon, string gogsToken) { var r = new FunctionOpenResult <CreateGogsRepoResult>(); String url = ConfigHelper.Instance.GetRequestUrl("user/repos", gogsToken); string httpReulst = null; try { httpReulst = HttpHelper.PostJson(JsonHelper.Serlaize <CreateGogsRepoParamater>(repon).Replace("isprivate", "private"), url); }catch (Exception ex) { r.ActionResult = false; r.ErrorMsg = String.Format("Gogs服务http请求失败,详细信息:{0}", ex.Message); } if (!string.IsNullOrEmpty(httpReulst)) { httpReulst = httpReulst.Replace("private", "isprivate"); try { CreateGogsRepoResult data = JsonHelper.Deserialize <CreateGogsRepoResult>(httpReulst); r.Data = data; }catch (Exception ex) { r.ActionResult = false; r.ErrorMsg = String.Format("Gogs返回结果json序列化失败,详细信息:{0}", ex.Message); } } return(r); }
public FunctionOpenResult <bool> Remove10002ComponentConfig(int appConfigId) { var r = new FunctionOpenResult <bool>(); r.Data = Rel_AppConfig_ComponentConfigDal.Delete10002(appConfigId); return(r); }
public FunctionOpenResult <bool> UpdateByID(AppInstance info) { var r = new FunctionOpenResult <bool>(); r.Data = AppInstanceDal.Update(info) > 0; return(r); }
public FunctionOpenResult <bool> CancleById(List <int> idList) { var r = new FunctionOpenResult <bool>(); r.Data = AppServiceDal.CancleById(idList); return(r); }
public FunctionOpenResult <bool> RemoveComponentConfigForApp(List <int> componentConfigIds, int appConfigId) { var r = new FunctionOpenResult <bool>(); r.Data = Rel_AppConfig_ComponentConfigDal.Delete(componentConfigIds, appConfigId); return(r); }
/// <summary> /// No safe TODO /// </summary> /// <param name="appId"></param> /// <param name="componentId"></param> /// <param name="appUserId"></param> /// <returns></returns> public FunctionOpenResult <bool> SetComponent(int appId, int componentId, int appUserId) { FunctionOpenResult <bool> r = new FunctionOpenResult <bool>(); var existResult = ExistComponent(appId, componentId, appUserId); if (existResult.ActionResult && existResult.Data) { Rel_AppComponent_AppUserDal.Delete(appId, componentId); } var list = AppComponentDal.GetList(new AppComponentSearchPamater() { ComponentId = componentId }); if (list != null) { list.ForEach(c => { Rel_AppComponent_AppUserDal.Add(new Rel_AppComponent_AppUser() { AppComponentId = c.AppComponentId, AppUserId = appUserId, AppId = appId }); }); } r.Data = true; return(r); }
public FunctionOpenResult <bool> DeleteByID(List <int> idList) { var r = new FunctionOpenResult <bool>(); r.Data = ProjectDal.Delete(idList); return(r); }
public FunctionOpenResult <bool> UpdateCodeTemplateByID(CodeTemplate info) { var r = new FunctionOpenResult <bool>(); r.Data = CodeTemplateDal.Update(info) > 0; return(r); }
public FunctionOpenResult <bool> ExistComponent(int appId, int componentId, int appUserId) { FunctionOpenResult <bool> r = new FunctionOpenResult <bool>(); var info = Rel_AppComponent_AppUserDal.GetList(appId, componentId, appUserId); r.Data = (info != null); return(r); }
/// <summary> /// 获取AppId /// </summary> /// <returns></returns> public static FunctionOpenResult <AppLocalConfig> GetAppLocalConfig() { var r = new FunctionOpenResult <AppLocalConfig>(); AppLocalConfig config = ProgramDistributedConfig.Instance.GetSeedConfig(); if (config != null) { r.Data = config; } return(r); }
public FunctionOpenResult <List <string> > GetAppComponentInterfaces(int appComponentId) { var r = new FunctionOpenResult <List <string> >(); var interfaces = AppComponentInterfaceDal.GetListByAppComponentId(appComponentId); if (interfaces != null) { r.Data = interfaces.Select(i => i.ComponentInterface).ToList(); } return(r); }
public FunctionOpenResult<bool> UpdateByID(AppToken info) { var r = new FunctionOpenResult<bool>(); r.Data = AppTokenDal.Update(info) > 0; if (r.Data&&info.Status) { RedisService.Set<AppToken>("default", String.Format(ConfigAuthorityCacheKey.AuthorityCacheKey, info.AppId), info); } else { RedisService.Delete("default", String.Format(ConfigAuthorityCacheKey.AuthorityCacheKey, info.AppId)); } return r; }
public FunctionOpenResult <string> CompanyUserLogin(string loginKey, string pwd, string sessionKey) { FunctionOpenResult <string> result = new FunctionOpenResult <string>() { ActionResult = true }; //获取会话数据 UserSession userSession = UserSessionDal.Get(sessionKey); int sessionId = (userSession == null)?0:userSession.SessionId; //先检查失败次数 LoginAudit loginAudit = (sessionId > 0)? LoginAuditDal.Get(sessionId): LoginAuditDal.Add(new LoginAudit()); if ((loginAudit != null) && (loginAudit.FailTotal >= 3)) { result.ActionResult = false; result.ErrorMsg = "密码错误太多"; result.ErrorCode = ErrorCode.PwdAttack; return(result); } //验证口令 UserSession loginSession = CompanyLoginDal.Get(loginKey, pwd); if (loginSession == null) { loginSession = new UserSession(); } loginSession.SessionKey = sessionKey; if (loginSession.UserId > 0) { loginSession.Status = 1; loginSession.SessionId = UserSessionDal.Add(loginSession); userSession = loginSession; //添加会话缓存 RedisComponent.SaveCache <UserSession>(String.Format(UserAuthorityCacheKey.AuthorityCacheKey, sessionKey), loginSession); result.Data = loginSession.SessionKey; } else { loginAudit.FailTotal++; result.ActionResult = false; result.ErrorMsg = "验证未通过"; result.ErrorCode = ErrorCode.LoginFail; } if (userSession == null) { loginSession.Status = 1; UserSessionDal.Add(loginSession); } return(result); }
public FunctionOpenResult <bool> DeleteByID(List <int> idList) { var r = new FunctionOpenResult <bool>(); r.Data = AppComponentDal.Delete(idList); if (r.Data) { idList.ForEach(id => { AppComponentInterfaceDal.DeleteByAppComponentId(id); }); } return(r); }
public static FunctionOpenResult <T> GetAppRootConfig <T>() { var r = new FunctionOpenResult <T>(); var config = ProgramDistributedConfig.Instance.GetAppConfig(); if (config != null) { if (!string.IsNullOrEmpty(config.ConfigContent)) { r.Data = Newtonsoft.Json.JsonConvert.DeserializeObject <T>(config.ConfigContent); } } return(r); }
public FunctionOpenResult <bool> UserIsLogin(string authtoken) { FunctionOpenResult <bool> r = new FunctionOpenResult <bool>(); var info = RedisService.Get <LoginToken>(DefineTable.CacheName, String.Format(UserAuthorityCacheKey.AuthorityCacheKey, authtoken)); r.Data = false; if (info != null) { if ((info.Status) && (info.EndTime > DateTime.Now)) { r.Data = true; } } return(r); }
public ConfigTool(int componentID) { FunctionResult <T> Config = AppSeed.GetConfig <T>(componentID); if (Config.ActionResult & Config.HavingData) { g_config = Config.Data; } FunctionOpenResult <APPROOT> appRootConfig = AppSeed.GetAppRootConfig <APPROOT>(); if (Config.ActionResult & Config.HavingData) { g_appRootConfig = appRootConfig.Data; } }
public FunctionOpenResult <bool> Grant(int appId, Dictionary <int, List <int> > authority) { var r = new FunctionOpenResult <bool>(); foreach (var kv in authority) { kv.Value.ForEach(fid => { AppGrantDal.Add(new AppGrant() { AppFunctionId = fid, AppId = appId, AppServiceId = kv.Key }); }); } r.Data = true; return(r); }
public FunctionOpenResult <bool> Add(List <AppService> data, int appInstanceId) { var r = new FunctionOpenResult <bool>(); r.Data = false; if (data != null) { Rel_AppInstance_AppServiceDal.Add(new Rel_AppInstance_AppService() { AppInstanceId = appInstanceId, AppService = JsonHelper.Serlaize <List <AppService> >(data) }); r.Data = true; } return(r); }
public FunctionOpenResult <bool> Reg(string key, string pwd, int userId) { FunctionOpenResult <bool> r = new FunctionOpenResult <bool>(); int loginInfoId = LoginInfoDal.Insert(new LoginInfo() { LoginKey = key, UserId = userId, Status = 1 }); if (loginInfoId > 0) { r.Data = LoginPwdDal.Add(new LoginPwdInfo() { LoginInfoId = loginInfoId, LoginPwd = pwd, Status = true }, false) > 0; } return(r); }
public FunctionOpenResult <bool> UpdateByID(AppComponent info, List <String> interfaces) { var r = new FunctionOpenResult <bool>(); r.Data = AppComponentDal.Update(info) > 0; if (r.Data) { AppComponentInterfaceDal.DeleteByAppComponentId(info.AppComponentId); interfaces.ForEach(i => { AppComponentInterfaceDal.Add(new AppComponentInterface() { ComponentInterface = i, AppComponentId = info.AppComponentId }); }); } return(r); }
public FunctionOpenResult <bool> IsCompare(List <AppService> target, int appId) { var r = new FunctionOpenResult <bool>(); List <AppService> source = GetAppServiceByAppId(appId); if (target != null) { foreach (var ap in target) { var sap = source.Find(t => t.Name == ap.Name); if (sap != null) { ap.AppFunctions.Sort(); sap.AppFunctions.Sort(); String strAp = String.Join(",", ap.AppFunctions.Select(a => a.FunctionName)); String strSap = String.Join(",", sap.AppFunctions.Select(a => a.FunctionName)); if (strAp == strSap) { r.Data = true; } else { r.ErrorMsg = String.Format("{0}服务的方法名称不匹配", sap.Name); r.Data = false; break; } } else { r.ErrorMsg = String.Format("{0}服务找不到数据", ap.Name); r.Data = false; break; } } ; } else { r.Data = false; } return(r); }
public FunctionOpenResult <bool> ExistAppService(int appId) { var r = new FunctionOpenResult <bool>(); var parmater = new AppServiceSearchPamater(); parmater.SetAppId(appId, PamaterOperationType.Equal); var source = AppServiceDal.GetList(parmater); if ((source != null) && (source.Count > 0)) { r.Data = true; } else { r.Data = false; } return(r); }
public FunctionOpenResult <Dictionary <int, List <String> > > GetAppComponentInterfacesByIds(List <int> appComponentIds) { var r = new FunctionOpenResult <Dictionary <int, List <String> > >() { }; var interfaces = AppComponentInterfaceDal.GetListByAppComponentIds(appComponentIds); if (interfaces != null) { r.Data = new Dictionary <int, List <string> >(); interfaces.ForEach(i => { if (!r.Data.ContainsKey(i.AppComponentId)) { r.Data.Add(i.AppComponentId, new List <string>()); } r.Data[i.AppComponentId].Add(i.ComponentInterface); }); } return(r); }
public FunctionOpenResult <bool> RecordAppService(List <AppService> data, int appInstanceId) { FunctionOpenResult <bool> r = new FunctionOpenResult <bool>(); r.Data = Rel_AppInstance_AppServiceDal.UpdateAppInstanceId(new Rel_AppInstance_AppService() { AppInstanceId = appInstanceId, AppService = JsonHelper.Serlaize <List <AppService> >(data), IsCompare = r.Data }) > 0; if (!r.Data) { r.Data = Rel_AppInstance_AppServiceDal.Add(new Rel_AppInstance_AppService() { AppInstanceId = appInstanceId, AppService = JsonHelper.Serlaize <List <AppService> >(data), IsCompare = r.Data }) > 0; } return(r); }
public FunctionOpenResult <bool> UpdateByID(LoginInfo info) { var r = new FunctionOpenResult <bool>(); r.Data = LoginInfoDal.Update(info) > 0; return(r); }