public IActionResult FlowMonitorFrame() { base.SetGlobalViewBag(); string UserId = CPExpressionHelper.Instance.RunCompile("${CPUser.UserId()}"); string UserRoleIds = CPExpressionHelper.Instance.RunCompile("${CPUser.UserRoleIds()}"); CPFlowTemplate template = CPFlowTemplate.Instance(); List <int> roleIdCol = new List <int>(); UserRoleIds.Split(',').ToList().ForEach(t => { if (string.IsNullOrEmpty(t) == false) { roleIdCol.Add(int.Parse(t)); } }); List <CPFlow> col = template.GetHasMonitorRightFlow(int.Parse(UserId), roleIdCol); string flowVerIds = ""; col.ForEach(t => { if (string.IsNullOrEmpty(flowVerIds)) { flowVerIds = t.FlowVerId.ToString(); } else { flowVerIds += "," + t.FlowVerId.ToString(); } }); if (string.IsNullOrEmpty(flowVerIds)) { flowVerIds = "-1"; } CPAppContext.GetHttpContext().Session.SetString("UserHasMonitorRightFlowVerIds", flowVerIds); return(Redirect(CPAppContext.CPWebRootPath() + "/Plat/Grid/GridView?GridCode=" + CPAppContext.QueryString <string>("GridCode"))); }
public FileResult DownloadTabConfig(string TabIds, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { throw new Exception("系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"); } TabIds = TabIds.Replace("@", ","); TabIds = CPAppContext.FormatSqlPara(TabIds); List <int> col = new List <int>(); TabIds.Split(',').ToList().ForEach(t => { if (string.IsNullOrEmpty(t) == false) { col.Add(int.Parse(t)); } }); string sXml = CPTabEngine.Instance().GetTabConfigXml(col); byte[] byteArray = System.Text.Encoding.Default.GetBytes(sXml); return(File(byteArray, "application/x-msdownload", "标签页配置.CPXml")); }
public CPWebApiBaseReturnEntity ImportGridInnerFunc(int GridId, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { CPGridEngine.Instance(CurUserId).ImportInnerFunc(GridId); re.Result = true; return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }
public GetFormFieldByViewIdReturn GetFormViewByViewId(int ViewId , int CurUserId, string CurUserIden ) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); GetFormFieldByViewIdReturn re = new GetFormFieldByViewIdReturn(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { re.FieldCol = CPFormTemplate.Instance(CurUserId).GetFormFieldByViewId(ViewId); re.View = CPFormTemplate.Instance(CurUserId).GetFormViewByViewId(ViewId, false); re.Result = true; return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }
public override bool DeletePhase(List <int> phaseIdCol) { if (phaseIdCol.Count <= 0) { return(true); } string ids = ""; phaseIdCol.ForEach(t => { if (string.IsNullOrEmpty(ids)) { ids = t.ToString(); } else { ids += "," + t.ToString(); } }); string strSql = @"DELETE FROM Flow_TemplatePhaseRuleHandle WHERE PhaseId IN (" + ids + @"); DELETE FROM Flow_TemplatePhaseRule WHERE PhaseId IN (" + ids + @"); DELETE FROM Flow_TemplatePhaseLink WHERE StartPhaseId IN (" + ids + @") OR EndPhaseId IN (" + ids + @"); DELETE FROM Flow_TemplatePhaseForm WHERE PhaseId IN (" + ids + @"); DELETE FROM Flow_TemplatePhase WHERE PhaseId IN (" + ids + @");"; DbHelper _helper = new DbHelper("CPCommonIns", CPAppContext.CurDbType()); _helper.ExecuteNonQuery(strSql); return(true); }
public GetMsgReturn GetMsg(int MsgType, int MsgCount, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); GetMsgReturn re = new GetMsgReturn(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { re.MsgCol = CPMsgs.Instance().GetMsg(CurUserId, CPEnum.ConvertMsgTypeEnum(MsgType), MsgCount); re.Result = true; return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }
//http://localhost:9000/CPSite/api/FormEngine/InitFormDefaultView?FormId=1&CurUserId=1&CurUserIden=E0A04F94-90D5-4C2A-8C9D-836813F73DC4 public CPWebApiBaseReturnEntity InitFormDefaultViewForEditor(int FormId, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { re.Result = CPFormTemplate.Instance(CurUserId).InitFormDefaultViewForEditor(FormId); if (re.Result == false) { re.ErrorMsg = "自动初始化一个默认视图时出错!"; } return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }
public IActionResult UploadFilesAjax() { string _FilePath = CPAppContext.QueryString <string>("FilePath"); _FilePath = CPAppContext.CPFilesPath() + _FilePath; if (System.IO.Directory.Exists(_FilePath) == false) { System.IO.Directory.CreateDirectory(_FilePath); } long size = 0; var files = Request.Form.Files; foreach (var file in files) { var filename = ContentDispositionHeaderValue .Parse(file.ContentDisposition) .FileName .Trim('"'); filename = _FilePath + $@"\{filename}"; size += file.Length; using (FileStream fs = System.IO.File.Create(filename)) { file.CopyTo(fs); fs.Flush(); } } string message = "{\"ReturnCode\":" + 1 + "}"; return(Json(message)); }
public static CPFormEngine Instance(int curUserId) { CPFormEngine iObj = CPAppContext.GetService <CPFormEngine>(); iObj.CurUserId = curUserId; return(iObj); }
//http://localhost:9000/CPSite/api/GridEngine/SynGridFieldInfo?GridId=1&CurUserId=1&CurUserIden=E0A04F94-90D5-4C2A-8C9D-836813F73DC4 public CPWebApiBaseReturnEntity SynGridFieldInfo(int GridId, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { re.Result = CPGridEngine.Instance(CurUserId).SyncFieldInfo(GridId); if (re.Result == false) { re.ErrorMsg = "从数据库同步字段信息时出错了!"; } } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); } return(re); }
public GetDbNameReturn GetDbName(string dbIns, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); GetDbNameReturn re = new GetDbNameReturn(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } re.Result = true; try { re.DbName = CPAppContext.GetDbName(dbIns); return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }
public CPWebApiBaseReturnEntity UpdateTreeDataParent(int TreeDataSourceId, string SourcePKValue, string TargetPKValue, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { string errorMsg = ""; re.Result = CPTreeEngine.Instance().UpdateTreeDataParent(TreeDataSourceId, SourcePKValue, TargetPKValue, ref errorMsg); if (re.Result == false) { re.ErrorMsg = errorMsg; } return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }
public GetUserByUserNameOrLoginNameReturn GetUserByUserNameOrLoginName(string NameEx, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); NameEx = CPAppContext.FormatSqlPara(NameEx); GetUserByUserNameOrLoginNameReturn re = new GetUserByUserNameOrLoginNameReturn(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { re.UserCol = COOrgans.Instance().GetUserByUserNameOrLoginName(NameEx); re.UserCol = re.UserCol.OrderBy(t => t.UserName).ToList(); re.Result = true; return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }
public bool UpdateTreeDataParent(int TreeDataSourceId, string sourcePKValue, string targetPKValue, ref string errorMsg) { CPTreeDataSource ds = this._CPTreeDataSourceRep.Get(TreeDataSourceId); if (string.IsNullOrEmpty(ds.MainTableName)) { errorMsg = "数据源未配置数据表名"; return(false); } if (string.IsNullOrEmpty(ds.PKField)) { errorMsg = "数据源未配置表主键字段"; return(false); } if (string.IsNullOrEmpty(ds.ParentIdField)) { errorMsg = "数据源未配置存储父级ID的字段名"; return(false); } DbHelper _helper = new DbHelper(ds.DbIns, CPAppContext.CurDbType()); string strSql2 = "UPDATE " + ds.MainTableName + " SET " + ds.ParentIdField + "='" + targetPKValue + "' WHERE " + ds.PKField + " in (" + sourcePKValue + ")"; _helper.ExecuteNonQuery(strSql2); return(true); }
public override bool DeleteInstanceTask(int insId) { string strSql = "DELETE FROM Flow_InstanceTask WHERE InsId=" + insId; DbHelper _helper = new DbHelper("CPFlowIns", CPAppContext.CurDbType()); _helper.ExecuteNonQuery(strSql); return(true); }
public FileResult DownloadFile() { string FilePath = CPAppContext.QueryString <string>("FilePath"); FilePath = CPAppContext.CPFilesPath() + FilePath; byte[] fileBytes = System.IO.File.ReadAllBytes(FilePath); return(File(fileBytes, "application/x-msdownload", System.IO.Path.GetFileName(FilePath))); }
public IActionResult PlatAdmin() { base.SetGlobalViewBag(); List <CPSystem> sysCol = CPSystemHelper.Instance().GetSystems(); ViewBag.SystemCol = sysCol; ViewBag.DefaultUrl = CPAppContext.CPWebRootPath() + "/Plat/Tab/TabView?TabCode=Tab0002&SysId=2"; return(View()); }
public IActionResult GridViewPreview() { base.SetGlobalViewBag(); int TargetGridId = CPAppContext.QueryString <int>("TargetGridId"); string userId = CPExpressionHelper.Instance.RunCompile("${CPUser.UserId()}"); CPGrid grid = CPGridEngine.Instance(int.Parse(userId)).GetGrid(TargetGridId, false, false); return(RedirectToAction("GridView", new { GridCode = grid.GridCode })); }
public override bool DeleteOverdueKey() { string strSql = "delete from CP_UserIdentity where (DATEDIFF(hour, LoginTime, GETDATE()) > 12)"; // this._dbContext.Set<COUserIdentity>(). DbHelper _helper = new DbHelper("CPOrganIns", CPAppContext.CurDbType()); _helper.ExecuteNonQuery(strSql); return(true); }
/// <summary> /// 如果列表有编辑列,获取编辑列类型是下拉列表的数据源 /// </summary> /// <param name="gridObj"></param> /// <returns></returns> public Dictionary <string, string> ReadListDataAndFormat(CPGrid gridObj) { Dictionary <string, string> col = new Dictionary <string, string>(); gridObj.ColumnCol.ForEach(t => { if (t.ColumnType == CPGridEnum.ColumnTypeEnum.DropDownListEditor) { if (string.IsNullOrEmpty(t.FieldEnumDataIns)) { throw new Exception("字段" + t.FieldName + "配置成下拉列表编辑列,但未配置下拉列表数据源数据库实例"); } if (string.IsNullOrEmpty(t.FieldEnumDataSource)) { throw new Exception("字段" + t.FieldName + "配置成下拉列表编辑列,但未配置下拉列表数据源"); } DbHelper dbHelper = new DbHelper(t.FieldEnumDataIns, CPAppContext.CurDbType()); string strSql = t.FieldEnumDataSource; try { strSql = CPExpressionHelper.Instance.RunCompile(strSql); DataTable dt = dbHelper.ExecuteDataTable(strSql); DataTable dtNew = new DataTable(); dtNew.Columns.Add(new DataColumn() { ColumnName = "textEx", DataType = typeof(string) }); dtNew.Columns.Add(new DataColumn() { ColumnName = "valueEx", DataType = typeof(string) }); foreach (DataRow dr in dt.Rows) { DataRow newDR = dtNew.NewRow(); newDR["textEx"] = dr[0]; if (dt.Columns[1].DataType == Type.GetType("System.Boolean")) { newDR["valueEx"] = dr[1].ToString().Trim().ToLower(); } else { newDR["valueEx"] = dr[1]; } dtNew.Rows.Add(newDR); } col.Add("Column" + t.Id.ToString(), CPUtils.DataTable2Json(dtNew)); } catch (Exception ex) { throw new Exception("执行sql语句:" + strSql + "出错,详细信息为:" + ex.Message); } } }); return(col); }
public CPWebApiBaseReturnEntity SynTabConfig(int TargetSysId, bool IsCreateNew, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { var files = Request.Form.Files; foreach (var file in files) { // var filename = ContentDispositionHeaderValue // .Parse(file.ContentDisposition) // .FileName // .Trim('"'); //// filename = _FilePath + $@"\{filename}"; // size += file.Length; byte[] bData = null; using (var fileStream = file.OpenReadStream()) using (var ms = new MemoryStream()) { fileStream.CopyTo(ms); bData = ms.ToArray(); //var fileBytes = ms.ToArray(); //string s = Convert.ToBase64String(fileBytes); //// act on the Base64 data } if (bData != null) { if (IsCreateNew) { re.Result = CPTabEngine.Instance().InitTabFromConfigXml(TargetSysId, bData); } else { re.Result = CPTabEngine.Instance().SyncTabFromConfigXml(TargetSysId, bData); } } } re.Result = true; return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }
public IActionResult Login() { base.SetGlobalViewBag(); string DefaultUrl = CPAppContext.GetPara("DefaultUrl"); if (string.IsNullOrEmpty(DefaultUrl)) { DefaultUrl = "/Plat/Portal/SysFrame"; } ViewBag.DefaultUrl = DefaultUrl; return(View()); }
public FileResult ShowPicture() { string FilePath = CPAppContext.QueryString <string>("FilePath"); FilePath = CPAppContext.CPFilesPath() + FilePath; int lastIndex = FilePath.LastIndexOf("."); string fileEx = FilePath.Substring(lastIndex + 1, FilePath.Length - lastIndex - 1); // return new FileStreamResult(new FileStream(FilePath, FileMode.Open), "image/" + fileEx); byte[] fileBytes = System.IO.File.ReadAllBytes(FilePath); return(File(fileBytes, "image/" + fileEx, System.IO.Path.GetFileName(FilePath))); }
public bool SaveData(CPForm form, List <CPFormChildTable> childTableCol, List <CPFormField> fieldCol, ref string pkValue, string formDataJSON, CPFormUseScene useScene, out string errorMsg) { bool b = this._CPFormRep.SaveData(form, childTableCol, fieldCol, ref pkValue, formDataJSON, out errorMsg); if (b) { dynamic formData = JsonConvert.DeserializeObject <dynamic>(formDataJSON); if (string.IsNullOrEmpty(useScene.FormSaveExeSql) == false) { CPExpressionHelper.Instance.Add(CPFormExpression.DataRowKey, formData); CPExpressionHelper.Instance.Add(CPFormExpression.PKValueKey, pkValue); CPExpressionHelper.Instance.Add(CPFormExpression.MainTableKey, form.MainTableName); CPExpressionHelper.Instance.Add(CPFormExpression.MainTablePKKey, form.PKFieldName); string sql = CPExpressionHelper.Instance.RunCompile(useScene.FormSaveExeSql); CPExpressionHelper.Instance.Remove(CPFormExpression.DataRowKey); CPExpressionHelper.Instance.Remove(CPFormExpression.PKValueKey); CPExpressionHelper.Instance.Remove(CPFormExpression.MainTableKey); CPExpressionHelper.Instance.Remove(CPFormExpression.MainTablePKKey); try { DbHelper _helper = new DbHelper(form.DbIns, CPAppContext.CurDbType()); _helper.ExecuteNonQuery(sql); } catch (Exception ex) { throw new Exception("表单保存后,执行扩展配置的SQL时出错,SQL语句为【" + sql + "】,错误信息如下 :" + ex.Message); } } if (string.IsNullOrEmpty(useScene.FormSaveHandler) == false) { string[] sArray = useScene.FormSaveHandler.Split(';'); for (int i = 0; i < sArray.Length; i++) { if (string.IsNullOrEmpty(sArray[i])) { continue; } try { ICPFormAfterSaveEventArgs e = new ICPFormAfterSaveEventArgs(form, pkValue, formData); ICPFormAfterSave inter = Activator.CreateInstance(Type.GetType(sArray[i])) as ICPFormAfterSave; inter.AfterSave(e); } catch (Exception ex) { throw new Exception("调用表单保存后扩展二次开发方法【" + sArray[i] + "】时出错,错误信息如下 :" + ex.Message); } } } } return(b); }
public bool DeleteTreeData(int TreeDataSourceId, string pkFieldValue, ref string errorMsg) { CPTreeDataSource ds = this._CPTreeDataSourceRep.Get(TreeDataSourceId); if (string.IsNullOrEmpty(ds.MainTableName)) { errorMsg = "数据源未配置数据表名"; return(false); } if (string.IsNullOrEmpty(ds.PKField)) { errorMsg = "数据源未配置表主键字段"; return(false); } List <string> pkCol = new List <string>(); pkCol.Add(pkFieldValue); DbHelper _helper = new DbHelper(ds.DbIns, CPAppContext.CurDbType()); if (string.IsNullOrEmpty(ds.ParentIdField) == false) { //递归删除数据 string strSql = "SELECT " + ds.PKField + " FROM " + ds.MainTableName + " WHERE " + ds.ParentIdField; DataTable dt = _helper.ExecuteDataSet(strSql + "='" + pkFieldValue + "'").Tables[0]; foreach (DataRow dr in dt.Rows) { pkCol.Add(dr[0].ToString()); //获取子节点 List <string> tCol = this.GetChildPK(strSql, dr[0].ToString(), ds.DbIns); pkCol.AddRange(tCol); } dt.Dispose(); } string ids = ""; pkCol.ForEach(t => { if (string.IsNullOrEmpty(ids)) { ids = "'" + t + "'"; } else { ids += ",'" + t + "'"; } }); string strSql2 = "DELETE FROM " + ds.MainTableName + " WHERE " + ds.PKField + " in (" + ids + ")"; _helper.ExecuteNonQuery(strSql2); return(true); }
public bool DeleteMsg(List <int> msgIdCol, out string errorMsg) { errorMsg = ""; if (msgIdCol.Count <= 0) { return(true); } string MsgSendHandler = CPAppContext.GetPara("MsgSendHandler"); if (string.IsNullOrEmpty(MsgSendHandler)) { return(true); } bool b = true; string[] sArray = MsgSendHandler.Split(';'); for (int i = 0; i < sArray.Length; i++) { if (string.IsNullOrEmpty(sArray[i])) { continue; } try { ICPMsgHandler inter = null; if (sArray[i].Equals("CPFrameWork.Global.Msg.CPMsgInnerDbHandler,CPFrameWork.Global", StringComparison.CurrentCultureIgnoreCase)) { inter = new CPMsgInnerDbHandler(); } else { inter = Activator.CreateInstance(Type.GetType(sArray[i])) as ICPMsgHandler; } inter.CPMsgRep = this._CPMsgRep; b = inter.DeleteMsg(msgIdCol); if (!b) { errorMsg = "调用消息接口【" + sArray[i] + "】删除消息时出错。"; return(b); } } catch (Exception ex) { errorMsg = "调用消息接口【" + sArray[i] + "】删除消息时出错,详细信息如下:" + ex.Message; return(false); } } return(true); }
public IActionResult LoginOut() { CPAppContext.GetHttpContext().Session.Clear(); string loginUrl = CPAppContext.GetPara("LoginUrl"); if (string.IsNullOrEmpty(loginUrl)) { return(RedirectToAction("Login")); } else { return(Redirect(CPAppContext.CPWebRootPath() + loginUrl)); } // }
private List <string> GetChildPK(string strSql, string parentId, string dbIns) { DbHelper _helper = new DbHelper(dbIns, CPAppContext.CurDbType()); string tempSql = strSql += "='" + parentId + "'"; DataTable dt = _helper.ExecuteDataSet(strSql).Tables[0]; List <string> pkCol = new List <string>(); foreach (DataRow dr in dt.Rows) { pkCol.Add(dr[0].ToString()); //获取子节点 List <string> tCol = this.GetChildPK(strSql, dr[0].ToString(), dbIns); pkCol.AddRange(tCol); } dt.Dispose(); return(pkCol); }
public IActionResult SysFrame() { base.SetGlobalViewBag(); ViewBag.UserName = CPExpressionHelper.Instance.RunCompile("${CPUser.UserName()}"); ViewBag.UserId = CPExpressionHelper.Instance.RunCompile("${CPUser.UserId()}"); ViewBag.UserPhotoPath = CPExpressionHelper.Instance.RunCompile("${CPUser.UserPhotoPath()}"); if (string.IsNullOrEmpty(ViewBag.UserPhotoPath)) { ViewBag.UserPhotoPath = "../../Style/CommonImage/UserNoPic.png"; } else { ViewBag.UserPhotoPath = CPAppContext.CPWebRootPath() + "/api/CPCommonEngine/ShowPicture?FilePath=" + System.Web.HttpUtility.UrlEncode(ViewBag.UserPhotoPath); } ViewBag.SystemTitle = CPAppContext.GetPara("SystemTitle"); return(View()); }
public GetChildModuleReturn GetChildModule(int SysId, int ParentModuleId, bool IsLoadChildModule, int CurUserId, string CurUserIden) { base.SetHeader(); CurUserIden = CPAppContext.FormatSqlPara(CurUserIden); GetChildModuleReturn re = new GetChildModuleReturn(); if (this.CheckUserIden(CurUserId, CurUserIden) == false) { re.Result = false; re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!"; return(re); } try { List <CPPortalModule> moduleCol = CPModuleEngine.Instance(CurUserId).GetModules(CurUserId, SysId, ParentModuleId); re.ModuleCol = new List <CPPortalModuleClient>(); Mapper.Initialize(cfg => { cfg.CreateMap <CPPortalModule, CPPortalModuleClient>(); }); moduleCol.ForEach(t => { CPPortalModuleClient c = AutoMapper.Mapper.Map <CPPortalModuleClient>(t); c.ChildModule = new List <CPPortalModuleClient>(); if (IsLoadChildModule) { List <CPPortalModule> cModuleCol = CPModuleEngine.Instance(CurUserId).GetModules(CurUserId, SysId, t.Id); cModuleCol.ForEach(f => { CPPortalModuleClient tmp = AutoMapper.Mapper.Map <CPPortalModuleClient>(f); c.ChildModule.Add(tmp); }); } re.ModuleCol.Add(c); }); re.Result = true; return(re); } catch (Exception ex) { re.Result = false; re.ErrorMsg = ex.Message.ToString(); return(re); } }