/// <summary> /// Default constructor. /// </summary> public GroupEditModel() { Group = new SysGroup(); List<SysGroup> groups = SysGroup.GetFields("sysgroup_id, sysgroup_name", new Params() { OrderBy = "sysgroup_name ASC" }); groups.Insert(0, new SysGroup() { Name = "" }); Groups = new SelectList(groups, "Id", "Name"); }
public void Update(string BranchID,int GroupID,string GroupName,short IsAdmin,string Desc) { SysGroup item = new SysGroup(); item.MarkOld(); item.IsLoaded = true; item.BranchID = BranchID; item.GroupID = GroupID; item.GroupName = GroupName; item.IsAdmin = IsAdmin; item.Desc = Desc; item.Save(UserName); }
public void Insert(string BranchID,string GroupName,short IsAdmin,string Desc) { SysGroup item = new SysGroup(); item.BranchID = BranchID; item.GroupName = GroupName; item.IsAdmin = IsAdmin; item.Desc = Desc; item.Save(UserName); }
public void AddToSysGroup(SysGroup sysGroup) { base.AddObject("SysGroup", sysGroup); }
public static SysGroup CreateSysGroup(int id) { SysGroup sysGroup = new SysGroup(); sysGroup.ID = id; return sysGroup; }
public System.Collections.Generic.List <SysUser> GetAllUserByGroupCode(SysGroup group) { return(SysUserProvider.GetAllUserByGroupCode(group)); }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>"); Response.End(); } string action = Request["action"]; string groupid = Request["groupid"]; string projectId = Request["projectid"]; FileFolder ffEnt = null; Project pEnt = null; switch (action) { case "upload": //如果是项目文档 上传项目编号文件夹 如果是部门文档上传到DEFAULT文件夹 if (!string.IsNullOrEmpty(projectId)) { pEnt = Project.Find(projectId); IList <FileFolder> ffEnts = FileFolder.FindAllByProperty(FileFolder.Prop_FolderKey, pEnt.ProjectCode); if (ffEnts.Count == 0) { ffEnt = new FileFolder(); ffEnt.Name = pEnt.ProjectCode; ffEnt.FolderKey = pEnt.ProjectCode; ffEnt.Path = pEnt.ProjectCode; ffEnt.ParentId = "1"; ffEnt.CreateTime = DateTime.Now; ffEnt.ModuleId = "1"; ffEnt.DoCreate(); ffEnt.FullId = "1." + ffEnt.Id; ffEnt.DoUpdate(); } else { ffEnt = ffEnts[0]; } if (!Directory.Exists(@"D:\RW\Files\AppFiles\Portal\" + pEnt.ProjectCode)) { Directory.CreateDirectory(@"D:\RW\Files\AppFiles\Portal\" + pEnt.ProjectCode); } } else { ffEnt = FileFolder.Find("1"); //如果是非项目文档,上传到默认文件夹 } string formdata = Request["formdata"]; JObject json = Aim.JsonHelper.GetObject <JObject>(formdata); FileItem fiEnt = new FileItem(); fiEnt.GroupId = groupid; fiEnt.ProjectId = projectId; fiEnt.FirstTypeId = json.Value <string>("FirstTypeId"); fiEnt.SecondTypeId = json.Value <string>("SecondTypeId"); HttpPostedFile postedFile = Request.Files["projectfile"]; //获取上传信息对象 string fileName = Path.GetFileName(postedFile.FileName); fiEnt.Name = fileName; fiEnt.FolderId = ffEnt.Id; fiEnt.CreatorId = Aim.Portal.Web.WebPortalService.CurrentUserInfo.UserID; fiEnt.CreatorName = Aim.Portal.Web.WebPortalService.CurrentUserInfo.Name; fiEnt.CreateTime = DateTime.Now; fiEnt.DoCreate(); // string filename = postedFile.FileName;//获取上传的文件路径 // string tempPath = System.Configuration.ConfigurationManager.AppSettings["NewsFolderPath"];//获取保存文件夹路径,我是设置在webconfig中了。 // string savepath = Server.MapPath(@"D:\RW\Files\AppFiles\Portal\" + pEnt.ProjectCode + "\\");//获取保存路径 // string sExtension = filename.Substring(filename.LastIndexOf('.'));//获取拓展名 //if (!Directory.Exists(savepath)) //Directory.CreateDirectory(savepath); //string sNewFileName = DateTime.Now.ToString("yyyyMMddhhmmsfff"); + fiEnt.Id + "_"" + seEnt.IsLeaf + " postedFile.SaveAs(@"D:\RW\Files\AppFiles\Portal\" + ffEnt.Path + @"/" + fiEnt.Id + "_" + fileName); //保存 Response.Write("{success:true}"); Response.End(); break; case "loadfiletype": string id = Request["id"]; if (string.IsNullOrEmpty(id)) { id = "cf38bd7a-79d1-46fb-bf06-640b30f61654"; } IList <SysEnumeration> seEnts = SysEnumeration.FindAllByProperty("SortIndex", SysEnumeration.Prop_ParentID, id); int i = 0; string result = "["; foreach (SysEnumeration seEnt in seEnts) { if (i != seEnts.Count - 1) { result += "{'id':'" + seEnt.EnumerationID + "','text':'" + seEnt.Name + "','leaf':" + (seEnt.IsLeaf.Value ? "true" : "false") + ",'parentid':'" + seEnt.ParentID + "'},"; } else { result += "{'id':'" + seEnt.EnumerationID + "','text':'" + seEnt.Name + "','leaf':" + (seEnt.IsLeaf.Value ? "true" : "false") + ",'parentid':'" + seEnt.ParentID + "'}"; } i++; } result += "]"; Response.Write(result); Response.End(); break; case "getprojectname": string temp = "{"; if (!string.IsNullOrEmpty(projectId)) { pEnt = Project.Find(projectId); temp += "ProjectName:'" + pEnt.ProjectName + "'"; } if (!string.IsNullOrEmpty(groupid)) { SysGroup sgEnt = SysGroup.Find(groupid); temp += (temp.Length > 1 ? ",GroupName:'" : "GroupName:'") + sgEnt.Name + "'"; } Response.Write(temp + "}"); Response.End(); break; } }
protected void Page_Load(object sender, EventArgs e) { SearchCriterion.DefaultPageSize = 50; id = RequestData.Get <string>("id", String.Empty); if (Request.QueryString["tag"] != null && Request.QueryString["tag"] == "Refresh") { Response.Write(""); Response.End(); } switch (RequestActionString) { case "querychildren": if (String.IsNullOrEmpty(id)) { sysgroupents = SysGroup.FindAll("FROM SysGroup as ent WHERE ParentId is null and (Type = 2 or Type = 3) Order By SortIndex asc"); } else { sysgroupents = SysGroup.FindAll("FROM SysGroup as ent WHERE ParentId = '" + id + "' and (Type = 2 or Type = 3) Order By SortIndex asc"); } this.PageState.Add("DtList", sysgroupents); break; case "treerowselect": using (new Castle.ActiveRecord.SessionScope()) { ICriterion cirt = Expression.Sql("UserID IN (SELECT UserID FROM SysUserGroup WHERE GroupID = ?)", id, NHibernateUtil.String); sysuserents = SysUserRule.FindAll(SearchCriterion, cirt); } this.PageState.Add("UsrList", sysuserents); break; case "sendmessage": SysMessage ent = new SysMessage(); ent.SenderId = UserInfo.UserID; ent.SenderName = UserInfo.Name; ent.ReceiverId = RequestData.Get <string>("ReceiverId"); ent.ReceiverName = RequestData.Get <string>("ReceiverName"); ent.MessageContent = RequestData.Get <string>("MessageContent"); ent.Attachment = RequestData.Get <string>("Attachment"); ent.SendTime = System.DateTime.Now; ent.DoCreate(); this.PageState.Add("entity", ent); break; case "chanagestate": IList <string> idList = RequestData.GetList <string>("IdArray"); if (idList != null && idList.Count > 0) { foreach (object obj in idList) { DataHelper.ExecSql("update SysMessage set IsRead='True' where Id='" + obj.ToString() + "'"); } } break; case "unreadmessage": string receiverId = RequestData.Get <string>("ReceiverId"); string sql = string.Empty; if (!string.IsNullOrEmpty(receiverId)) { sql = "select * from SysMessage where IsRead is null and ReceiverId='{0}' and SenderId='{1}'order by SendTime asc"; sql = string.Format(sql, UserInfo.UserID, receiverId); } else { sql = @"select * from SysMessage where IsRead is null and ReceiverId='{0}' and SenderId=(select top(1) SenderId from SysMessage where IsRead is null and ReceiverId='{1}' order by SendTime asc) order by SendTime asc"; sql = string.Format(sql, UserInfo.UserID, UserInfo.UserID); } IList <EasyDictionary> dicts = DataHelper.QueryDictList(sql); PageState.Add("unreadmessage", dicts); break; default: SysGroup[] grpList = SysGroup.FindAll("From SysGroup as ent where ParentId is null and (Type = 2 or Type = 21) Order By SortIndex, CreateDate Desc"); this.PageState.Add("DtList", grpList); break; } IEnumerable <SysModule> topAuthExamMdls = new List <SysModule>(); if (UserContext.AccessibleApplications.Count > 0) { SysApplication examApp = UserContext.AccessibleApplications.FirstOrDefault(tent => tent.Code == EXAMINING_APP_CODE); if (examApp != null && UserContext.AccessibleModules.Count > 0) { topAuthExamMdls = UserContext.AccessibleModules.Where(tent => tent.ApplicationID == examApp.ApplicationID && String.IsNullOrEmpty(tent.ParentID)); topAuthExamMdls = topAuthExamMdls.OrderBy(tent => tent.SortIndex); } } this.PageState.Add("Modules", topAuthExamMdls); }
private void GetRelated() { // Clear related Regions.Clear(); Properties.Clear(); AttachedContent.Clear(); // Get group parents DisableGroups = SysGroup.GetParents(Page.GroupId); DisableGroups.Reverse(); // Get template & permalink Template = PageTemplate.GetSingle("pagetemplate_id = @0", Page.TemplateId); Permalink = Permalink.GetSingle(Page.PermalinkId); if (Permalink == null) { // Get the site tree using (var db = new DataContext()) { var sitetree = db.SiteTrees.Where(s => s.Id == Page.SiteTreeId).Single(); Permalink = new Permalink() { Id = Guid.NewGuid(), Type = Permalink.PermalinkType.PAGE, NamespaceId = sitetree.NamespaceId }; Page.PermalinkId = Permalink.Id; } } Page.IsBlock = Template.IsBlock; // Get placement ref title if (!IsSite) { if (Page.ParentId != Guid.Empty || Page.Seqno > 1) { Page refpage = null; if (Page.Seqno > 1) { if (Page.ParentId != Guid.Empty) { refpage = Page.GetSingle("page_parent_id = @0 AND page_seqno = @1", Page.ParentId, Page.Seqno - 1); } else { refpage = Page.GetSingle("page_parent_id IS NULL AND page_seqno = @0 AND page_sitetree_id = @1", Page.Seqno - 1, Page.SiteTreeId); //ÖS 2015-03-18 added siteid to the query } } else { refpage = Page.GetSingle(Page.ParentId, true); } PlaceRef = !String.IsNullOrWhiteSpace(refpage.NavigationTitle) ? refpage.NavigationTitle : refpage.Title; } } if (Template != null) { // Only load regions & properties if this is an original if (Page.OriginalId == Guid.Empty) { // Get regions var regions = RegionTemplate.Get("regiontemplate_template_id = @0", Template.Id, new Params() { OrderBy = "regiontemplate_seqno" }); foreach (var rt in regions) { var reg = Region.GetSingle("region_regiontemplate_id = @0 AND region_page_id = @1 and region_draft = @2", rt.Id, Page.Id, Page.IsDraft); if (reg != null) { Regions.Add(reg); } else { Regions.Add(new Region() { InternalId = rt.InternalId, Name = rt.Name, Type = rt.Type, PageId = Page.Id, RegiontemplateId = rt.Id, IsDraft = Page.IsDraft, IsPageDraft = Page.IsDraft }); } } // Get Properties foreach (string name in Template.Properties) { Property prp = Property.GetSingle("property_name = @0 AND property_parent_id = @1 AND property_draft = @2", name, Page.Id, Page.IsDraft); if (prp != null) { Properties.Add(prp); } else { Properties.Add(new Property() { Name = name, ParentId = Page.Id, IsDraft = Page.IsDraft }); } } } } else { throw new ArgumentException("Could not find page template for page {" + Page.Id.ToString() + "}"); } // Only load attachments if this is an original if (Page.OriginalId == Guid.Empty) { // Get attached content if (Page.Attachments.Count > 0) { // Content meta data is actually memcached, so this won't result in multiple queries Page.Attachments.ForEach(a => { Models.Content c = Models.Content.GetSingle(a, true); if (c != null) { AttachedContent.Add(c); } }); } } // Get page position Parents = BuildParentPages(Sitemap.GetStructure(Page.SiteTreeInternalId, false), Page); Parents.Insert(0, new PagePlacement() { Level = 1, IsSelected = Page.ParentId == Guid.Empty }); Siblings = BuildSiblingPages(Page.Id, Page.ParentId, Page.Seqno, Page.ParentId, Page.SiteTreeInternalId); // Only load extensions if this is an original if (Page.OriginalId == Guid.Empty) { // Get extensions Extensions = Page.GetExtensions(true); } // Initialize regions foreach (var reg in Regions) { reg.Body.InitManager(this); } // Get whether comments should be enabled EnableComments = Areas.Manager.Models.CommentSettingsModel.Get().EnablePages; if (!Page.IsNew && EnableComments) { using (var db = new DataContext()) { Comments = db.Comments. Include("CreatedBy"). Where(c => c.ParentId == Page.Id && c.ParentIsDraft == false). OrderByDescending(c => c.Created).ToList(); } } // Get the site if this is a site page if (Permalink.Type == Models.Permalink.PermalinkType.SITE) { using (var db = new DataContext()) { SiteTree = db.SiteTrees.Where(s => s.Id == Page.SiteTreeId).Single(); } } // Check if the page can be published if (Page.OriginalId != Guid.Empty) { CanPublish = Page.GetScalar("SELECT count(*) FROM page WHERE page_id=@0 AND page_draft=0", Page.OriginalId) > 0; } }
protected void Page_Load(object sender, EventArgs e) { if (RequestActionString == "changeCorp") { string corpdeptId = RequestData.Get <string>("corpdeptId"); UserContext.ExtData["CompanyId"] = corpdeptId; Session["CompanyId"] = corpdeptId; //公司 SysGroup group = SysGroup.TryFind(corpdeptId); if (group != null) { UserContext.ExtData["CompanyName"] = group.Name; } else { UserContext.ExtData["CompanyName"] = ""; } PageState.Add("corpdeptId", corpdeptId); return; } IEnumerable <SysModule> topAuthExamMdls = new List <SysModule>(); string appcode = EXAMINING_APP_CODE; if (this.Request.QueryString["App"] != null && this.Request.QueryString["App"].Trim() != "") { appcode = this.Request.QueryString["App"]; } if (UserContext.AccessibleApplications.Count > 0) { SysApplication examApp = UserContext.AccessibleApplications.FirstOrDefault(tent => tent.Code == appcode); if (examApp != null && UserContext.AccessibleModules.Count > 0) { topAuthExamMdls = UserContext.AccessibleModules.Where(tent => tent.ApplicationID == examApp.ApplicationID && String.IsNullOrEmpty(tent.ParentID)); topAuthExamMdls = topAuthExamMdls.OrderBy(tent => tent.SortIndex); } } //查询是不是多公司 /*SysUser userent = SysUser.Find(UserInfo.UserID); * string sql = @"select *, GroupId as corpId, GroupId as corpName, GroupId as deptId, GroupId as deptName from SysUserGroup where UserId='{0}' * and GroupId not in (select RoleId from sysRole) and isnull(outdutydate,'')='' and pk_gw is not null"; * DataTable dtgroup = DataHelper.QueryDataTable(string.Format(sql, userent.UserID)); * string corpId = ""; * string corpName = ""; * string deptId = ""; * string deptName = ""; * foreach (DataRow row in dtgroup.Rows) * { * corpId = ""; * corpName = ""; * deptName = ""; * deptId = row["GroupId"] + ""; * getDeptInfo(ref corpId, ref corpName, deptId, ref deptName); * row["corpId"] = corpId; * row["corpName"] = corpName; * } * PageState.Add("gsbms", DataHelper.DataTableToDictList(dtgroup)); * PageState.Add("corpdeptId", Session["CompanyId"]);*/ if (Session["CompanyId"] == null) { ClientScript.RegisterClientScriptBlock(this.GetType(), "adsf", "window.parent.location.href='/Login.aspx'", true); } else { PageState.Add("CompanyName", SysGroup.Find(Session["CompanyId"]).Name); } //if (this.Request.QueryString["App"] != null && this.Request.QueryString["App"].Trim() != "") //{ // appcode = this.Request.QueryString["App"]; //} //IList<SysApplication> saEnts = UserContext.AccessibleApplications.OrderBy(tens => tens.SortIndex).Where(ent => ent.Status == 1).ToArray(); PageState.Add("Modules", topAuthExamMdls); }
string type = String.Empty; // 对象类型 #endregion #region ASP.NET 事件 protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); type = RequestData.Get <string>("type"); SysGroup ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <SysGroup>(); ent.DoUpdate(); this.SetMessage("修改成功!"); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <SysGroup>(); //ent.CreaterID = UserInfo.UserID; //ent.CreaterName = UserInfo.Name; if (ent.SortIndex == null) { ent.SortIndex = 9999; } ent.CreateDate = DateTime.Now; if (String.IsNullOrEmpty(id)) { ent.CreateAsRoot(); } else { ent.CreateAsSibling(SysGroup.Find(id)); } this.SetMessage("新建成功!"); break; default: if (RequestActionString == "createsub") { ent = this.GetPostedData <SysGroup>(); //ent.CreaterID = UserInfo.UserID; //ent.CreaterName = UserInfo.Name; ent.LastModifiedDate = DateTime.Now; if (!SysGroup.Exists("Name=? and code=? and Type=2 and ParentID = ?", ent.Name, ent.Code, id)) { ent.CreateAsChild(SysGroup.Find(id)); } this.SetMessage("新建成功!"); } break; } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = SysGroup.Find(id); } this.SetFormData(ent); } else { PageState.Add("CreaterName", UserInfo.Name); PageState.Add("CreatedDate", DateTime.Now); } }
protected void Page_Load(object sender, EventArgs e) { //防止多次添加 if (!UserContext.ExtData.ContainsKey("CompanyId")) { //添加公司Id UserContext.ExtData.Add("CompanyId", Session["CompanyId"] + ""); UserContext.ExtData.Add("DeptId", Session["DeptId"] + ""); //公司 SysGroup group = SysGroup.TryFind(Session["CompanyId"] + ""); if (group != null) { UserContext.ExtData.Add("CompanyName", group.Name); } else { UserContext.ExtData.Add("CompanyName", ""); } //部门 group = SysGroup.TryFind(Session["DeptId"] + ""); if (group != null) { UserContext.ExtData.Add("DeptName", group.Name); } else { UserContext.ExtData.Add("DeptName", ""); } } applicationId = RequestData.Get <string>("ApplicationId"); applicationName = Server.UrlDecode(RequestData.Get <string>("Name")); treeContainer.InnerHtml += "<script type='text/javascript'>"; treeContainer.InnerHtml += " d = new dTree('d');"; treeContainer.InnerHtml += "d.add('44b87eec-c353-4e98-82aa-4483a3ed86c9', -1, '招聘系统');"; SysAuthType[] authTypeList = SysAuthTypeRule.FindAll(); if (this.Request.QueryString["Role"] != null && this.Request.QueryString["Role"] == "User") { authTypeList = SysAuthType.FindAllByProperties(SysAuthType.Prop_AuthTypeID, 1);//&& tent.ParentID == null } IList <SysModule> ents = Aim.Portal.PortalService.CurrentUserContext.AccessibleModules.Where(tent => tent.ApplicationID == "f35cb450-cb38-4741-b8d7-9f726094b7ef").ToList(); if (UserContext.ExtData["CompanyId"] != null) { IEnumerable <string> mids = ents.Select(en => en.ModuleID); if (UserContext.ExtData["CompanyId"] + "" == "") { ClientScript.RegisterClientScriptBlock(this.GetType(), "adsf", "window.parent.location.href='/Login.aspx'", true); return; } SysGroup tGroup = SysGroup.Find(UserContext.ExtData["CompanyId"].ToString()); string[] groupIDs = (tGroup.Path + "." + tGroup.GroupID).Split('.'); ICriterion hqlCriterion = Expression.In("GroupID", groupIDs); hqlCriterion = SearchHelper.UnionCriterions(hqlCriterion, Expression.Sql("Path like '%" + tGroup.GroupID + "%' and GroupID in (Select GroupID from SysUserGroup where UserID='" + this.UserInfo.UserID + "' or GroupID='" + Session["DeptId"] + "')")); SysGroup[] groups = SysGroup.FindAll(hqlCriterion); using (new SessionScope()) { SysUser user = SysUser.Find(this.UserInfo.UserID); SysGroup[] grps = user.AllGroup.Where(en => en.Path != null && en.Path.IndexOf(tGroup.GroupID) >= 0 || en.GroupID == tGroup.GroupID).ToArray(); foreach (SysGroup group in grps)//groups) { SysGroup groupS = SysGroup.Find(group.ID); foreach (SysAuth tAuth in groupS.Auth) { if (tAuth.ModuleID != null && !mids.Contains(tAuth.ModuleID)) { ents.Add(SysModule.Find(tAuth.ModuleID)); } } } } } ents = ents.OrderBy(ens => ens.SortIndex).ToList(); foreach (SysModule smEnt in ents) { if (!string.IsNullOrEmpty(smEnt.ParentID)) { treeContainer.InnerHtml += "d.add('" + smEnt.ModuleID + "', '" + smEnt.ParentID + "', '" + smEnt.Name + "','" + smEnt.Url + "', '', 'mainShow');"; } else { treeContainer.InnerHtml += "d.add('" + smEnt.ModuleID + "', 'f35cb450-cb38-4741-b8d7-9f726094b7ef', '" + smEnt.Name + "','" + smEnt.Url + "', '', 'mainShow');"; } } treeContainer.InnerHtml += "document.write(d);"; treeContainer.InnerHtml += "$('.dtree > .dTreeNode:first-child').css({ display: 'none' });"; treeContainer.InnerHtml += "</script>"; }