/// <summary> /// 取视图数据 /// </summary> /// <param name="actionContext"></param> /// <param name="httpContext"></param> /// <param name="pageNo"></param> /// <param name="pageSize"></param> /// <param name="sortField"></param> /// <param name="sortDir"></param> /// <returns></returns> protected override TSLib.PageInfo GetPageInfo(TSLibStruts.ActionContext actionContext, HttpContext httpContext, int pageNo, int pageSize, string sortField, string sortDir) { PageInfo pageInfo = new PageInfo(); pageInfo = privilegeService.GetPage(pageNo, pageSize, sortField, sortDir); return(pageInfo); }
protected override User CreateEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext) { User user = new User(); DateTime now = DateTime.Now; user.ID = Constants.BLANK_INT_VALUE; user.UserStatus = UserStatuses.Disable; user.ValidityEndDate = now; user.ValidityStartDate = now; // 设置默认的职务 // 绑定职务列表 IList allJobTitle = this.jobTitleService.FindAll(); string defaultJobtitlecode = SimpleResourceHelper.GetString("USER.DEFAULT_JOBTITLE_CODE"); if (!string.IsNullOrEmpty(defaultJobtitlecode)) { JobTitle defaultJobTitle = this.jobTitleService.LoadByCode(defaultJobtitlecode); if (defaultJobTitle != null) { foreach (JobTitle item in allJobTitle) { if (item.Unid == defaultJobTitle.Unid) { user.JobTitleName = defaultJobTitle.Name; user.JobTitleUnid = defaultJobTitle.Unid; break; } } } } return(user); }
protected override void SaveEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext, User entity) { string selectedGroupUnids = RequestUtils.GetStringParameter(httpContext, "GroupUnids", null); if (logger.IsDebugEnabled) { logger.Debug("selectedGroupUnids=" + selectedGroupUnids); } if (!string.IsNullOrEmpty(selectedGroupUnids)) { IList unids = new ArrayList(); string[] groups = System.Text.RegularExpressions.Regex.Split(selectedGroupUnids, ","); foreach (string unid in groups) { unids.Add(unid); } entity.GroupUnidLists = unids; } else { entity.GroupUnidLists = new ArrayList(); } this.userService.Save(entity); }
protected override void SaveEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext, Place entity) { if (entity.Parent.ID == -1) { entity.Parent = null; } this.placeService.Save(entity); }
protected override Role CreateEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext) { Role role = new Role(); role.ID = TSLibWeb.Constants.BLANK_LONG_VALUE; role.IsInner = TSLibWeb.Constants.YESNO_NO; role.Level = TSLibWeb.Constants.BLANK_STRING_VALUE; role.LevelName = TSLibWeb.Constants.BLANK_STRING_VALUE; return(role); }
protected override TSLib.PageInfo GetPageInfo(TSLibStruts.ActionContext actionContext, HttpContext httpContext, int pageNo, int pageSize, string sortField, string sortDir) { string parentUnid = RequestUtils.GetStringParameter(httpContext, "parentUnid", ""); if (parentUnid.Equals("-1", StringComparison.OrdinalIgnoreCase)) { parentUnid = ""; } return(this.placeService.GetPageInfoByParentUnid(pageNo, pageSize, sortField, sortDir, parentUnid)); }
/// <summary> /// 创建对象 /// </summary> /// <param name="actionContext">action上下文</param> /// <param name="httpContext">httpContext上下文</param> /// <returns>对象</returns> protected override Privilege CreateEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext) { Privilege entity = new Privilege(); entity.ID = TSLibWeb.Constants.BLANK_LONG_VALUE; entity.IsInner = TSLibWeb.Constants.YESNO_NO; entity.ModelID = TSLibWeb.Constants.BLANK_LONG_VALUE; entity.Type = Privilege.PRIVILEGETYPE_MODEL; return(entity); }
protected override void Delete(TSLibStruts.ActionContext actionContext, HttpContext httpContext, string[] ids, string type) { if ("unid".Equals(type, StringComparison.OrdinalIgnoreCase)) { this.placeService.Delete(ids); } else { this.placeService.Delete(StringUtils.StringArray2LongArray(ids)); } }
/// <summary> /// 获取对象 /// </summary> /// <param name="actionContext"></param> /// <param name="httpContext"></param> /// <param name="idValue"></param> /// <param name="idName"></param> /// <returns></returns> protected override Privilege LoadEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext, string idValue, string idName) { if ("unid".Equals(idName, StringComparison.OrdinalIgnoreCase)) { return(privilegeService.Load(idValue)); } else { return(privilegeService.Load(Convert.ToInt32(idValue))); } }
protected override Place LoadEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext, string idValue, string idName) { EaseErp.IC.Domain.Place place; if ("unid".Equals(idName, StringComparison.OrdinalIgnoreCase)) { place = this.placeService.Load(idValue); } else { place = this.placeService.Load(Convert.ToInt32(idValue)); } return(place); }
protected override User LoadEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext, string idValue, string idName) { User user; if ("unid".Equals(idName, StringComparison.OrdinalIgnoreCase)) { user = this.userService.Load(idValue); } else { user = this.userService.Load(Convert.ToInt32(idValue)); } return(user); }
protected override Role LoadEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext, string idValue, string idName) { Role role; if ("unid".Equals(idName, StringComparison.OrdinalIgnoreCase)) { role = this.roleService.Load(idValue); } else { role = this.roleService.Load(Convert.ToInt32(idValue)); } return(role); }
protected override void SaveEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext, Role entity) { string selectedPrivilegeIDs = httpContext.Request.Form.Get("PrivilegeIDs"); if (!string.IsNullOrEmpty(selectedPrivilegeIDs)) { entity.SetPrivilegeIDs(Regex.Split(selectedPrivilegeIDs, ",")); } else { entity.Privileges = new ArrayList(); } this.roleService.Save(entity); }
protected override PageInfo GetPageInfo(TSLibStruts.ActionContext actionContext, HttpContext httpContext, int pageNo, int pageSize, string sortField, string sortDir) { if ("UserTypeDesc".Equals(sortField)) { sortField = "UserType"; } string type = RequestUtils.GetStringParameter(httpContext, "type", "all"); if (logger.IsDebugEnabled) { logger.Debug("type=" + type); } if ("bySearch".Equals(type, StringComparison.OrdinalIgnoreCase)) { return(this.GetPageInfoBySearch(httpContext, pageNo, pageSize, sortField, sortDir)); } else if ("all".Equals(type, StringComparison.OrdinalIgnoreCase)) { string ouUnid = httpContext.Request.Params["ouUnid"]; if (logger.IsDebugEnabled) { logger.Debug("ouUnid=" + ouUnid); } if (!string.IsNullOrEmpty(ouUnid) && ouUnid != "root" && ouUnid != "-1") { return(this.userService.GetPageByOU(ouUnid, pageNo, pageSize, sortField, sortDir)); } else { return(this.userService.GetPageByOU(string.Empty, pageNo, pageSize, sortField, sortDir)); } } else { return(new PageInfo()); } }
protected override Place CreateEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext) { return(new Place()); }
protected override TSLib.PageInfo GetPageInfo(TSLibStruts.ActionContext actionContext, HttpContext httpContext, int pageNo, int pageSize, string sortField, string sortDir) { return(this.roleService.GetPage(pageNo, pageSize, sortField, sortDir)); }
/// <summary> /// 保存对象 /// </summary> /// <param name="actionContext"></param> /// <param name="httpContext"></param> /// <param name="entity"></param> protected override void SaveEntity(TSLibStruts.ActionContext actionContext, HttpContext httpContext, Privilege entity) { this.privilegeService.Save(entity); }