public Sys_EmpDataRightResult GetEmpDataRight(Sys_EmpDataRightParam param) { this.CheckSession(); try { if (_empDataRight != null) { return(_empDataRight); } WhereClip where = Sys_EmpDataRight._.EmpID == this.SessionInfo.UserID.ToInt32() && Sys_EmpDataRight._.IsDeleted == false && Sys_EmpDataRight._.GCompanyID == this.SessionInfo.CompanyID; _empDataRight = this.Select <Sys_EmpDataRightResult>(where); } catch (WarnException exp) { throw exp; } catch (Exception exp) { LogInfoBLL.WriteLog(SessionInfo, exp); throw exp; } return(_empDataRight); }
/// <summary> /// 批量修改和插入 /// </summary> /// <param name="paramList"></param> /// <returns></returns> public WCFAddUpdateResult UpdateOrInsertList(List <Sys_AttachFilesResult> list) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { #region 判断 if (list.Count <= 0) { throw new WarnException("没有需要操作的对象!"); } #endregion int affect = 0; this.BatchInsertOrUpdate <Sys_AttachFilesResult>(list); affect = this.BatchExecute(); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 删除实体 /// </summary> /// <param name="param">删除条件实体</param> /// <returns></returns> public WCFAddUpdateResult DelInfo(SYS_DictItemParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.DictItemID.ToInt32() <= 0) { throw new WarnException("请指定要删除的数据字典ID!"); } #endregion WhereClip whereClip = GetWhereClip(param); SYS_DictItemResult info = new SYS_DictItemResult(); info.IsDeleted = true; affect = this.Update <SYS_DictItemResult>(info, whereClip); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
public WCFAddUpdateResult DelInfo(SYS_CredentialCodeRuleParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.RuleID == -1) { throw new WarnException("请指定要删除的记录!"); } #endregion WhereClip where = SYS_CredentialCodeRuleResult._.RuleID == param.RuleID; SYS_CredentialCodeRuleResult oldInfo = this.GetInfo(param); SYS_CredentialCodeRuleResult info = new SYS_CredentialCodeRuleResult(); info.IsDeleted = true; affect = this.Update <SYS_CredentialCodeRuleResult>(info, where); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
public Dictionary <string, int> GetDictGroup(SYS_DictItemParam param) { this.CheckSession(); Dictionary <string, int> dic = new Dictionary <string, int>(); try { WhereClip whereClip = GetWhereClip(param); var query = this.SelectList <SYS_DictItemResult>(whereClip, SYS_DictItem._.DictGroupName.Desc).GroupBy(a => a.DictGroupName).Select(g => new { g.Key, Count = g.Count() }); foreach (var item in query) { dic.Add(item.Key, item.Count); } } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(dic); }
public List <Sys_ModuleResult> GetModuleList(Sys_ModuleParam param) { this.CheckSession(); List <Sys_ModuleResult> ret = new List <Sys_ModuleResult>(); try { WhereClip whereClip = GetWhereClip(param); List <Field> lstField = new List <Field>() { Sys_Module._.MenuID, Sys_Module._.ModuleCode, Sys_Module._.ModuleID, Sys_Module._.ModuleName, Sys_Module._.ActionCode }; ret = this.SelectList <Sys_ModuleResult>(whereClip, Sys_Module._.ModuleCode.Desc); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
public PageList <Sys_ModuleResult> GetPageList(Sys_ModuleParam param) { this.CheckSession(); PageList <Sys_ModuleResult> ret = new PageList <Sys_ModuleResult>(); try { WhereClip whereClip = GetWhereClip(param); List <Field> lstField = new List <Field>() { Sys_Module._.MenuID, Sys_Module._.ModuleCode, Sys_Module._.ModuleID , Sys_Module._.ModuleName, Sys_Module._.ActionCode }; ret = this.SelectList <Sys_ModuleResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(20), lstField, whereClip, Sys_Module._.ModuleCode.Desc); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
/// <summary> /// 删除实体 /// </summary> /// <param name="param">删除条件实体</param> /// <returns></returns> public WCFAddUpdateResult DelInfo(Sys_AttachFilesParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.AttachGuID == null) { throw new WarnException("请指定附件GUID!"); } #endregion WhereClip whereClip = GetWhereClip(param); Sys_AttachFilesResult info = new Sys_AttachFilesResult(); info.IsDeleted = true; affect = this.Update <Sys_AttachFilesResult>(info, whereClip); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(Sys_RoleResult param) { CheckSession(); var ret = new WCFAddUpdateResult(); try { #region 判断重复 WhereClip whereChk = Sys_Roles._.RoleID != -1 && Sys_Roles._.RoleName == param.RoleName; if (param.RoleID > 0) { whereChk = whereChk & Sys_Roles._.RoleID != param.RoleID; } int chkNum = Count <Sys_RoleResult>(whereChk); if (chkNum > 0) { throw new WarnException("存在重复的角色名称!"); } #endregion #region 系统默认值 if (param.RoleID > 0) { WhereClip where = Sys_Roles._.RoleID == param.RoleID; Update(param, @where); } else { param.IsDeleted = false; param.GCompanyID = this.SessionInfo.CompanyID; this.Insert(param); param = Select <Sys_RoleResult>(new List <Field> { Sys_Roles._.RoleID }, Sys_Roles._.RoleName == param.RoleName); } #region 设置返回值 ret.Key = param.RoleID; #endregion #endregion } catch (WarnException exp) { throw exp; } catch (Exception exp) { LogInfoBLL.WriteLog(SessionInfo, exp); throw exp; } return(ret); }
public PageList <Sys_FormRightResult> GetPageList(Sys_FormRightParam param) { this.CheckSession(); PageList <Sys_FormRightResult> rst = new PageList <Sys_FormRightResult>(); try { #region 获取分页列表 WhereClip where = GetWhereClip(param); List <Field> lstField = new List <Field>() { Sys_FormRight._.FormRightID, Sys_FormRight._.NameSpace, Sys_FormRight._.FormEngName, Sys_FormRight._.FormChsName, Sys_FormRight._.UserControlEngName, Sys_FormRight._.UserControlChsName, Sys_FormRight._.OprControlEngName, Sys_FormRight._.OprControlChsName, Sys_FormRight._.OprPropertyName, Sys_FormRight._.ModuleID, Sys_FormRight._.ActionCode, Sys_FormRight._.IsDeleted }; rst = this.SelectList <Sys_FormRightResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(20), lstField, where, Sys_FormRight._.NameSpace.Desc); #endregion #region 单据对应模块名称 if (rst != null && rst.ResultList != null) { Sys_ModuleBLL moduleBll = new Sys_ModuleBLL(); int?[] arrModuleID = rst.ResultList.Select(a => a.ModuleID).Distinct().ToArray(); moduleBll.SessionInfo = this.SessionInfo; List <Sys_ModuleResult> moduleList = new List <Sys_ModuleResult>(); if (arrModuleID.Length > 0) { moduleList = moduleBll.GetPageList(new Sys_ModuleParam() { PageIndex = 1, PageSize = arrModuleID.Length, ModuleIDs = arrModuleID }).ResultList; } Sys_ModuleResult findModule = new Sys_ModuleResult(); foreach (Sys_FormRightResult info in rst.ResultList) { findModule = moduleList.Find(a => a.ModuleID == info.ModuleID); if (findModule != null) { info.ModuleName = findModule == null ? "" : findModule.ModuleName; } } } #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(rst); }
/// <summary> /// 获取员工的操作权限 /// </summary> /// <param name="param"></param> /// <returns></returns> public PageList <Sys_EmpRightResult> GetPageList(Sys_EmpRightParam param) { this.CheckSession(); PageList <Sys_EmpRightResult> pagelist = new PageList <Sys_EmpRightResult>(); try { WhereClip whereClip = WhereClip.All;// if (param.IsNoAction) { whereClip = whereClip && Sys_EmpRight._.ActionCode.IsNull(); } else { whereClip = GetWhereClip(param); } if (param.MenuID > 0) { whereClip = whereClip && Sys_Module._.MenuID.At("b") == param.MenuID; } if (!string.IsNullOrEmpty(param.ModuleName)) { whereClip = whereClip && Sys_Module._.ModuleName.At("b").Like("%" + param.ModuleName + "%"); } List <Field> fiels = new List <Field>() { Sys_EmpRight._.EmpRightID, Sys_EmpRight._.EmpID, Sys_Module._.ModuleID.At("b"), Sys_EmpRight._.ActionCode, Sys_Module._.ModuleName.At("b"), Sys_Module._.ModuleCode.At("b"), Sys_Module._.MenuID.At("b"), Sys_Module._.ActionCode.At("b").As("BaseActionCode") }; WhereClip onWhereClip = Sys_EmpRight._.ModuleID == Sys_Module._.ModuleID.At("b"); pagelist = this.SelectList <Sys_EmpRightResult, Sys_Module>(JoinType.RightJoin, onWhereClip, param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), fiels, whereClip, Sys_Module._.ModuleCode.At("b").Asc, null, null); pagelist.ResultJoinList.Columns.Add("RightName"); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(pagelist); }
public WCFAddUpdateResult AddOrUpdate(SYS_CredentialCodeRuleResult param) { this.CheckSession(); int affect = 0; WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { #region 判断 if (param.TableName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定表名!"); } if (param.CodeFieldName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定单据名称"); } if (param.CodeFieldName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定编号字段!"); } if (param.ModuleName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定模块名称!"); } if (param.RuleID > 0) { WhereClip where = SYS_CredentialCodeRuleResult._.RuleID == param.RuleID; affect = this.Update <SYS_CredentialCodeRuleResult>(param, where); ret.Key = param.RuleID; } else { Sys_CodeRulerBLL codeRulerBll = new Sys_CodeRulerBLL(); codeRulerBll.SessionInfo = this.SessionInfo; affect = this.Insert <SYS_CredentialCodeRuleResult>(param); ret.Key = this.Select <SYS_CredentialCodeRuleResult>(SYS_CredentialCodeRule._.TableName == param.TableName && SYS_CredentialCodeRule._.CodeFieldName == param.CodeFieldName && SYS_CredentialCodeRule._.IsDeleted == false).RuleID; } #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
public WCFAddUpdateResult AddOrUpdate(Sys_FormRightResult param) { this.CheckSession(); int affect = 0; WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { #region 判断 if (param.FormEngName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定窗体英文名!"); } //if (param.UserControlEngName.ToStringHasNull().Trim() == "") throw new WarnException("请指定用户控件英文名!"); if (param.OprControlEngName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定操作控件英文名!"); } if (param.ActionCode.ToStringHasNull().Trim() == "") { throw new WarnException("请指定对应权限!"); } if (param.FormRightID > 0) { WhereClip where = Sys_FormRightResult._.FormRightID == param.FormRightID; affect = this.Update <Sys_FormRightResult>(param, where); ret.Key = param.FormRightID; } else { Sys_FormRightBLL formrightbll = new Sys_FormRightBLL(); formrightbll.SessionInfo = this.SessionInfo; param.IsDeleted = false; affect = this.Insert <Sys_FormRightResult>(param); ret.Key = this.Select <Sys_FormRightResult>(Sys_FormRight._.NameSpace == param.NameSpace && Sys_FormRight._.OprControlEngName == param.OprControlEngName && Sys_FormRight._.IsDeleted == false).FormRightID; } #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
public PageList <SYS_DictItemLineResult> GetDictItemLineList(SYS_DictItemLineParam param) { this.CheckSession(); PageList <SYS_DictItemLineResult> ret = new PageList <SYS_DictItemLineResult>(); try { WhereClip whereClip = SYS_DictItem._.IsDeleted.At("b") == 0 && SYS_DictItemLine._.IsDeleted == 0; if (param.ItemName != null) { whereClip = whereClip && SYS_DictItem._.ItemName.At("b") == param.ItemName; } if (param.ItemCode != null) { whereClip = whereClip && SYS_DictItem._.ItemCode.At("b") == param.ItemCode; } if (param.ItemCodes != null) { whereClip = whereClip && SYS_DictItem._.ItemCode.At("b").In(param.ItemCodes); } if (param.NoItemValue != null) { whereClip = whereClip && !SYS_DictItemLine._.ItemValue2.In(param.NoItemValue); } WhereClip onWhereClip = SYS_DictItem._.DictItemID.At("b") == SYS_DictItemLine._.DictItemID; List <Field> field = new List <Field> { SYS_DictItemLine._.DictItemLineID, SYS_DictItemLine._.ItemValue, SYS_DictItemLine._.ItemValue2, SYS_DictItem._.DictItemID.At("b"), SYS_DictItem._.ItemCode.At("b"), SYS_DictItem._.ItemName.At("b") }; ret = this.SelectList <SYS_DictItemLineResult, SYS_DictItem>(JoinType.InnerJoin, onWhereClip, param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, whereClip, null, null, null); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 删除角色 /// </summary> /// <param name="param"></param> /// <returns></returns> public WCFAddUpdateResult DelInfo(Sys_RoleParam param) { CheckSession(); var ret = new WCFAddUpdateResult(); try { #region 判断 if (param.RoleID.ToInt32() <= 0) { throw new WarnException("请指定要删除的模块ID!"); } if (this.Count <Sys_EmpDataRight>(Sys_EmpDataRight._.IsDeleted == false && Sys_EmpDataRight._.RoleIDs.Like("%," + param.RoleID.ToStringHasNull() + ",%")) >= 0) { throw new WarnException("存在业务引用,不允许删除!"); } if (this.Count <Sys_RoleRight>(Sys_RoleRight._.RoleID == param.RoleID && Sys_RoleRight._.IsDeleted == false) >= 0) { throw new WarnException("存在业务引用,不允许删除!"); } #endregion WhereClip where = GetWhereClip(param); var info = new Sys_RoleResult { IsDeleted = true }; var affect = Update(info, @where); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (Exception exp) { LogInfoBLL.WriteLog(SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(Sys_EmpDataRightResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 #endregion #region 系统默认值 if (param.SysEmpRoleID != 0) { WhereClip where = Sys_EmpDataRight._.SysEmpRoleID == param.SysEmpRoleID; affect = this.Update <Sys_EmpDataRightResult>(param, where); } else { param.IsDeleted = false; param.GCompanyID = this.SessionInfo.CompanyID; affect = this.Insert <Sys_EmpDataRightResult>(param); param = this.Select <Sys_EmpDataRightResult>(new List <Field>() { Sys_EmpDataRight._.SysEmpRoleID }, Sys_EmpDataRight._.EmpID == param.EmpID); } #region 设置返回值 ret.Key = param.SysEmpRoleID.ToInt32(); #endregion #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
public List <Sys_MenuResult> GetMenuTree(Sys_MenuParam param) { this.CheckSession(); List <Sys_MenuResult> ret = new List <Sys_MenuResult>(); try { WhereClip whereClip = GetWhereClip(param); ret = this.SelectList <Sys_MenuResult>(whereClip, Sys_MenuResult._.MenuCode.Asc); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
public List <SYS_DictItemLineResult> GetList(SYS_DictItemLineParam param) { this.CheckSession(); List <SYS_DictItemLineResult> ret = new List <SYS_DictItemLineResult>(); try { WhereClip whereClip = GetWhereClip(param); ret = this.SelectList <SYS_DictItemLineResult>(whereClip, SYS_DictItemLine._.DictItemLineID.Asc); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
public List <Sys_RoleResult> GetRolesTree(Sys_RoleParam param) { CheckSession(); var ret = new List <Sys_RoleResult>(); try { WhereClip whereClip = GetWhereClip(param); ret = SelectList <Sys_RoleResult>(whereClip, Sys_Roles._.RoleName.Asc); } catch (WarnException exp) { throw exp; } catch (Exception exp) { LogInfoBLL.WriteLog(SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 获取集合 /// </summary> /// <param name="param"></param> /// <returns></returns> public List <Sys_AttachFilesResult> GetList(Sys_AttachFilesParam param) { this.CheckSession(); List <Sys_AttachFilesResult> ret = new List <Sys_AttachFilesResult>(); try { WhereClip whereClip = GetWhereClip(param); ret = this.SelectList <Sys_AttachFilesResult>(whereClip, Sys_AttachFiles._.CreatedTime.Asc); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
public Sys_FormRightResult GetInfo(Sys_FormRightParam param) { this.CheckSession(); Sys_FormRightResult rst = new Sys_FormRightResult(); try { #region 判断 if (param.FormRightID <= 0) { throw new WarnException("请指定关键字GUID!"); } #endregion #region 保存实体 WhereClip where = Sys_FormRight._.FormRightID == param.FormRightID; rst = this.Select <Sys_FormRightResult>(where); if (rst != null) { Sys_ModuleBLL moduleBll = new Sys_ModuleBLL(); moduleBll.SessionInfo = this.SessionInfo; Sys_ModuleResult moduleRst = moduleBll.GetInfo(new Sys_ModuleParam() { ModuleID = rst.ModuleID.ToInt32() }); rst.ModuleName = moduleRst == null ? "" : moduleRst.ModuleName; } #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(rst); }
/// <summary> /// 删除实体 /// </summary> /// <param name="param">删除条件实体</param> /// <returns></returns> public WCFAddUpdateResult DelInfo(Sys_MenuParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.MenuID.ToInt32() <= 0) { throw new WarnException("请指定要删除的菜单ID!"); } #endregion #region 业务关联判断 if (this.Count <Sys_Module>(Sys_Module._.MenuID == param.MenuID && Sys_Module._.IsDeleted == false) > 0) { throw new WarnException("已发生业务关联!"); } #endregion WhereClip where = GetWhereClip(param); Sys_MenuResult info = new Sys_MenuResult(); info.IsDeleted = true; affect = this.Update <Sys_MenuResult>(info, where); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
/// <summary> /// 删除角色 /// </summary> /// <param name="param"></param> /// <returns></returns> public WCFAddUpdateResult DelInfo(Sys_RoleRightParam param) { CheckSession(); var ret = new WCFAddUpdateResult(); try { #region 判断 if (param.RoleRightID.ToInt32() <= 0) { throw new WarnException("请指定要删除的权限ID!"); } #endregion WhereClip where = GetWhereClip(param); var info = new Sys_RoleRightResult { IsDeleted = true }; var affect = Update(info, @where); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException) { throw; } catch (Exception exp) { LogInfoBLL.WriteLog(SessionInfo, exp); } return(ret); }
/// <summary> /// 批量修改和插入 /// </summary> /// <param name="paramList"></param> /// <returns></returns> public WCFAddUpdateResult UpdateOrInsertList(List <Sys_RoleRightResult> list) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { #region 判断 if (list.Count <= 0) { throw new WarnException("没有需要保存的对象!"); } #endregion int affect = 0; foreach (Sys_RoleRightResult info in list) { info.GCompanyID = this.SessionInfo.CompanyID; if (info.IsDeleted == null) { info.IsDeleted = false; } } affect += this.BatchInsertOrUpdate <Sys_RoleRightResult>(list); this.BatchExecute(); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
public List <Sys_FormRightResult> GetRightTree(Sys_FormRightParam param) { this.CheckSession(); PageList <Sys_FormRightResult> ret = new PageList <Sys_FormRightResult>(); List <Field> lstField = new List <Field>() { Sys_FormRight._.NameSpace }; try { WhereClip whereClip = GetWhereClip(param); ret = this.SelectList <Sys_FormRightResult>(param.PageIndex.GetValueOrDefault(1), int.MaxValue, lstField, whereClip, Sys_FormRightResult._.NameSpace.Asc, Sys_FormRight._.NameSpace.Group, null); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret.ResultList); }
/// <summary> /// 分页集合 /// </summary> /// <param name="param"></param> /// <returns></returns> public PageList <Sys_AttachFilesResult> GetPageList(Sys_AttachFilesParam param) { this.CheckSession(); PageList <Sys_AttachFilesResult> ret = new PageList <Sys_AttachFilesResult>(); try { List <Field> field = new List <Field>() { Field.All }; ret = this.SelectList <Sys_AttachFilesResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, GetWhereClip(param), Sys_AttachFiles._.CreatedTime.Desc); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(Sys_ModuleResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (param.ModuleName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定菜单名称!"); } if (param.MenuID.ToInt32() < 0) { throw new WarnException("请指定所属菜单!"); } if (param.TargetForm.ToStringHasNull().Trim() == "") { throw new WarnException("请指定所属目标体窗!"); } string parentCode = ""; Sys_MenuResult menuRst = new Sys_MenuResult(); menuRst = this.Select <Sys_MenuResult>(Sys_Menu._.MenuID == param.MenuID); if (param.MenuID > 0 && (menuRst == null || menuRst.MenuCode == "")) { throw new WarnException("菜单编号的所属菜单不存在!"); } parentCode = menuRst.MenuCode; #endregion #region 生成模块编号 int maxModuleNum = 1; maxModuleNum = this.Count <Sys_ModuleResult>(Sys_Module._.MenuID == param.MenuID) + 1; #endregion #region 判断重复 WhereClip whereChk = Sys_Module._.IsDeleted == false && Sys_Module._.ModuleName == param.ModuleName; if (param.ModuleID > 0) { whereChk = whereChk & Sys_Module._.ModuleID != param.ModuleID; } int chkNum = this.Count <Sys_ModuleResult>(whereChk); if (chkNum > 0) { throw new WarnException("存在重复的模块名称!"); } #endregion #region 系统默认值 if (param.ModuleID > 0) { if (!param.ModuleCode.StartsWith(parentCode)) { param.ModuleCode = parentCode + maxModuleNum.ToString().PadLeft(3, '0'); } WhereClip where = Sys_Module._.ModuleID == param.ModuleID; affect = this.Update <Sys_ModuleResult>(param, where); } else { Sys_ModuleResult codeRulerBll = new Sys_ModuleResult(); param.ModuleCode = parentCode + maxModuleNum.ToString().PadLeft(3, '0'); param.IsDeleted = false; affect = this.Insert <Sys_ModuleResult>(param); param = this.Select <Sys_ModuleResult>(new List <Field>() { Sys_Module._.ModuleID }, Sys_Module._.ModuleCode == param.ModuleCode); } #region 设置返回值 ret.Key = param.ModuleID; #endregion #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(SYS_DictItemResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (param.ItemCode.Trim() == "") { throw new WarnException("请指定数据字典编码!"); } if (param.ItemName.Trim() == "") { throw new WarnException("请指定数据字典名称!"); } if (param.DictGroupName.Trim() == "") { throw new WarnException("请指定数据字典所属组名!"); } #endregion #region 判断重复 WhereClip whereChk = SYS_DictItem._.IsDeleted == false && SYS_DictItem._.ItemCode == param.ItemCode; if (param.DictItemID > 0) { whereChk = whereChk & SYS_DictItem._.DictItemID != param.DictItemID; } int chkNum = this.Count <SYS_DictItemResult>(whereChk); if (chkNum > 0) { throw new WarnException("存在重复的数据字典编码!"); } #endregion #region 系统默认值 if (param.DictItemID > 0) { WhereClip where = SYS_DictItem._.DictItemID == param.DictItemID; affect = this.Update <SYS_DictItemResult>(param, where); } else { param.GCompanyID = this.SessionInfo.CompanyID; param.IsDeleted = false; affect = this.Insert <SYS_DictItemResult>(param); param = this.Select <SYS_DictItemResult>(new List <Field>() { SYS_DictItemResult._.DictItemID }, SYS_DictItem._.ItemCode == param.ItemCode); } #region 设置返回值 ret.Key = param.DictItemID; #endregion #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); } return(ret); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(Sys_RoleRightResult param) { CheckSession(); var ret = new WCFAddUpdateResult(); try { #region 判断 if (param.ActionCode.ToStringHasNull().Trim() == "") { throw new WarnException("请指定权限ActionCode!"); } if (param.RoleRightID < 0) { throw new WarnException("请指定权限RoleRightID!"); } var rolesResult = Select <Sys_RoleRightResult>(Sys_RoleRight._.RoleRightID == param.RoleRightID); if (param.RoleRightID > 0 && (rolesResult == null || rolesResult.ActionCode == "")) { throw new WarnException("权限不存在!"); } #endregion #region 判断重复 WhereClip whereChk = Sys_RoleRight._.RoleRightID != -1 && Sys_RoleRight._.RoleID == param.RoleID && Sys_RoleRight._.ModuleID == param.ModuleID && Sys_RoleRight._.IsDeleted == param.IsDeleted; if (param.RoleRightID > 0) { whereChk = whereChk & Sys_RoleRight._.RoleRightID != param.RoleRightID; } int chkNum = Count <Sys_RoleRightResult>(whereChk); if (chkNum > 0) { throw new WarnException("存在重复的模块权限!"); } #endregion #region 系统默认值 if (param.RoleRightID > 0) { WhereClip where = Sys_RoleRight._.RoleRightID == param.RoleRightID; Update(param, @where); } else { // var roleResult = new Sys_RoleRightResult(); Insert(param); param = Select <Sys_RoleRightResult>(new List <Field> { Sys_RoleRight._.RoleRightID }, Sys_RoleRight._.ActionCode == param.ActionCode); } #region 设置返回值 ret.Key = param.RoleRightID; #endregion #endregion } catch (WarnException) { throw; } catch (Exception exp) { LogInfoBLL.WriteLog(SessionInfo, exp); } return(ret); }
/// <summary> /// 批量上传 /// </summary> /// <param name="paramList"></param> /// <returns></returns> public List <Sys_AttachFilesResult> UploadAttach(List <Sys_AttachFilesResult> list) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { #region 判断 if (list.Count <= 0) { throw new WarnException("没有需要操作的对象!"); } if (list.Exists(a => a.AttachType == null)) { throw new WarnException("没有设置上传的附件类型!"); } #endregion AttachType type = list[0].AttachType; string attachType = string.Empty; switch (type) { case AttachType.Bill: attachType = "Bill"; break; case AttachType.Pic: attachType = "Pic"; break; } Sys_RootDirMappingBLL mBLL = new Sys_RootDirMappingBLL(); mBLL.SessionInfo = this.SessionInfo; //获取根目录 Sys_RootDirMappingResult mRst = mBLL.GetInfo(new Sys_RootDirMappingParam() { AttachType = attachType, IsEffect = true }); if (mRst == null) { throw new WarnException("根目录映射表没有有效的设置信息!"); } mRst.PhysicalRootPath = mRst.PhysicalRootPath.Replace("{Company}", this.SessionInfo.CompanyID.ToStringHasNull()); //设置文件目录 string folderPath = mRst.PhysicalRootPath + @"\" + DateTime.Now.Year + @"\" + DateTime.Now.ToString("yyyyMMdd"); string thumbnailFolderPath = string.Empty; if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } ////如果有图片才形成压缩图片的存放目录 //if (list.Exists(a => ".bmp.png.jpg.gif.jpeg.BMP.PNG.JPG.GIF.JPEG".Contains(a.FileSuffix))) //{ // //设置压缩图片的存放目录 // thumbnailFolderPath= folderPath + @"\Thumbnail"; // if (!Directory.Exists(thumbnailFolderPath)) // { // Directory.CreateDirectory(thumbnailFolderPath); // } //} foreach (Sys_AttachFilesResult rst in list) { rst.FileName = DateTime.Now.ToString("yyyyMMddHHmmssms") + new Random().Next(10000, 99999); rst.FilePath = folderPath + @"\" + rst.FileName + rst.FileSuffix; using (FileStream fs = new FileStream(rst.FilePath, FileMode.CreateNew)) { fs.Write(rst.File, 0, rst.FileSize.ToInt32()); fs.Close(); } if (rst.TBNFile != null) { rst.TBNFileName = rst.FileName + "_TBN" + ".JPG";; rst.TBNFilePath = folderPath + @"\" + rst.TBNFileName; using (FileStream fs = new FileStream(rst.TBNFilePath, FileMode.CreateNew)) { fs.Write(rst.TBNFile, 0, rst.TBNFile.Length.ToInt32()); fs.Close(); } } } } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(list); }