/// <summary> /// 获取导航数据源 /// </summary> /// <returns></returns> public static List <Navigator> GenerateNavSource <S>(Expression <Func <Navigator, bool> > predicate, Expression <Func <Navigator, S> > orderCondition, bool isDesc = false) { NavigateService navService = new NavigateService(); var curUserId = Utils.CurrentUser.ID; string[] roleIds = new RoleUserService().GenericService.GetAll(r => r.UserID == curUserId).Select(r => r.RoleID).ToArray(); var navs = isDesc ? navService.GenericService.GetAll(predicate).OrderByDescending(orderCondition).ToList() : navService.GenericService.GetAll(predicate).OrderBy(orderCondition).ToList(); //非超级管理员做筛选 if (!DZAFCPortal.Config.AppSettings.DefaultAccounts.Contains(Utils.CurrentUser.Account)) { for (int i = navs.Count - 1; i >= 0; i--) { var nav = navs[i]; if (!string.IsNullOrEmpty(nav.ApplyRoles)) { if (!IsNavVisible(nav.ApplyRoles.Split(','), roleIds)) { navs.Remove(nav); continue; } } } } return(navs); }
public List <User> GetOrganizationUser(string orgID) { List <string> lstUserID = new RoleUserService().GenericService.GetAll(p => p.OrganizationID == orgID).Select(p => p.UserID).ToList(); var res = userSetvice.GenericService.GetAll(p => lstUserID.Contains(p.ID)).OrderBy(p => p.Account); return(res.ToList()); }
public List <User> GetOrganizationUser(string orgID, int pageSize, int PageCurrent, out int PageCount) { List <string> lstUserID = new RoleUserService().GenericService.GetAll(p => p.OrganizationID == orgID).Select(p => p.UserID).ToList(); var res = userSetvice.GenericService.GetAll(p => lstUserID.Contains(p.ID)).OrderBy(p => p.Account); PageCount = res.Count(); return(res.Skip((PageCurrent - 1) * pageSize).Take(pageSize).ToList()); }
private void fillMenu() { List <RoleUser> role_user = new RoleUserService().getRoleIdByUserId(Convert.ToInt32(base.Session["currentUserId"])); string roleStr = ""; for (int i = 0; i < role_user.Count; i++) { roleStr = roleStr + "," + role_user[i].RoleId; } if (roleStr != "") { roleStr = roleStr.Substring(1, roleStr.Length - 1); } else { roleStr = "-1"; } List <roleSysform> rsf = new roleSysFormService().getRightsByRoleId(roleStr); this.sysForms = new List <SysForm>(); foreach (roleSysform r in rsf) { this.sysForms.Add(r.Sysform); } this.sysMenus = new sysMenuService().getAllSysMenus(); this.sysForms.Sort(delegate(SysForm form1, SysForm form2) { return(form1.FormIndex.CompareTo(form2.FormIndex)); }); List <ShowAccordion> accs = new List <ShowAccordion>(); foreach (SysMenu sm in this.sysMenus) { string DisplayName = sm.DisplayName; ShowAccordion showOne = new ShowAccordion(); showOne.HeardText = DisplayName; string body = ""; foreach (SysForm sf in this.sysForms) { if (sf.UpperID == sm.MenuID) { string url = base.ResolveUrl(sf.AssemblyPath); body = body + string.Format("<a href='{1}' target='right'>{0}</a><br><div style='border-top:1px dashed #cccccc;height: 1px;overflow:hidden;margin-top:7px;margin-bottom:7px'></div>", sf.DisplayName, url); } } if (body != "") { showOne.Body = body; accs.Add(showOne); } } this.sysMenus.Clear(); this.sysForms.Clear(); this.MyAccordion.DataSource = accs; this.MyAccordion.DataBind(); }
void BindDropdownlist() { var curUserAccount = DZAFCPortal.Utility.UserInfo.Account; var curUser = new UserService().GenericService.FirstOrDefault(u => u.Account == curUserAccount); var roleIds = new RoleUserService().GenericService.GetAll(r => r.UserID == curUser.ID).Select(r => r.RoleID).ToList(); var superAdminId = new RoleService().GenericService.FirstOrDefault(r => r.Code == "cjgly").ID; var sysAdminId = new RoleService().GenericService.FirstOrDefault(r => r.Code == "sysadmin").ID; var types = typeService.GenericService.GetAll().OrderBy(t => t.Name).ToList(); if (!roleIds.Contains(superAdminId) && !roleIds.Contains(sysAdminId)) { for (int i = types.Count - 1; i >= 0; i--) { var item = types[i]; var rIds = item.AssociatedRoles.Split(';').ToList(); if (rIds.Intersect(roleIds).Count() == 0) { types.Remove(item); } } } Dictionary <string, string> d = new Dictionary <string, string>(); if (types.Count == 0) { Response.Write("当前账户无权限访问任何字典类别,请联系管理员处理。"); return; } types.ForEach(t => { d.Add(t.ID, t.Name); }); ddlSearchDicType.DataValueField = "key"; ddlSearchDicType.DataTextField = "value"; ddlSearchDicType.DataSource = d; ddlSearchDicType.DataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if ((this.txtPwd.Text.Trim() == "") || (this.txtUserName.Text.Trim() == "")) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请将登录信息填写完整!');</script>"); } else { User _User = new User(); _User.LoginPwd = this.txtPwd.Text.Trim(); _User.LoginId = this.txtUserName.Text.Trim(); User u = new SysUserService().checkExist(_User); if (u == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户账号或密码不存在!');</script>"); } else if (u.LoginPwd != MD5Util.Encrypt(this.txtPwd.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户账号或密码不存在!');</script>"); } else { if (u != null) { Session["userInfo"] = u; this.Session["currentUserId"] = u.Id; this.Session["LoginName"] = u.LoginName; this.Session["zhiwu"] = u.Zhiwu; this.Session["CompanyCode"] = u.CompanyCode; Session["IsSpecialUser"] = u.IsSpecialUser; List <RoleUser> role_user = new RoleUserService().getRoleIdByUserId(u.Id); if (u.LoginStatus == "离职") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('用户已经禁用!');</script>"); return; } } //判断上一个季度是否执行了 DateTime crrentDate = DateTime.Now; //3 6 9 12 DateTime jiDuDate = DateTime.MinValue; int jiDu = 0; if (crrentDate.Month >= 1 && crrentDate.Month <= 3) { jiDuDate = Convert.ToDateTime(crrentDate.Year - 1 + "-" + "12-31"); } if (crrentDate.Month >= 4 && crrentDate.Month <= 6) { jiDuDate = Convert.ToDateTime(crrentDate.Year + "-" + "4-1").AddDays(-1); } if (crrentDate.Month >= 7 && crrentDate.Month <= 9) { jiDuDate = Convert.ToDateTime(crrentDate.Year + "-" + "7-1").AddDays(-1); } if (crrentDate.Month >= 10 && crrentDate.Month <= 12) { jiDuDate = Convert.ToDateTime(crrentDate.Year + "-" + "10-1").AddDays(-1); } var result = new JobInfoService().GetListArray( string.Format("JobTime>='{0} 00:00:00' and JobTime<='{0} 23:59:59'", jiDuDate.ToString("yyyy-MM-dd"))); if (result.Count == 0) { new Job2().DoGuestJob(jiDuDate); } //new Dal.JXC.TB_SupplierInvoiceService().AddSupplierInvoice("70728,70729,70730", "86576,86575,80333", // Session["LoginName"].ToString(), // Convert.ToInt32(Session["currentUserId"].ToString()), "江苏安太"); base.Response.Redirect("~/Main.htm"); } } } catch (Exception ex) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>"); } }