//得到案卷的综合查询结果 public DataSet GetSearchResult(List <SearchField> list1) { U_RolesBU role1 = new U_RolesBU(); String sql = null; String condition = SearchField.GetSearchCondition(list1); if (role1.isRole(new string[] { "公司领导", "评审部角色", "会计", "出纳", "档案管理员" })) { sql = "select * from DA_AnJuan "; if (condition != null && condition.Trim() != String.Empty) { sql = sql + " where " + condition; } } else { sql = @"select DA_AnJuan.* from DA_AnJuan inner join U_ZC on DA_AnJuan.ajnum=U_ZC.num2 where U_ZC.zeren='" + Comm.CurUser + "'"; if (condition != null && condition.Trim() != String.Empty) { sql = sql + " and " + condition; } } DataSet ds1 = this.tabCommand.TableComm.SearchData(sql); return(ds1); }
/// <summary> /// 得到公司的项目列表 /// "公司领导", "会计", "会计" /// </summary> /// <returns></returns> public DataSet GetShenPiList3() { U_RolesBU role1 = new U_RolesBU(); bool isAllCanSee = role1.isRole(new string[] { "公司领导", "综合管理", "评审部角色", "会计", "出纳", "领导秘书" }); role1.Close(); List <SearchField> condition = new List <SearchField>(); if (isAllCanSee) { condition.Add(new SearchField("id>1", "", SearchOperator.用户定义)); } else { condition.Add(new SearchField("id", "-1")); } //增加了方案提交审批的要求(11年7月5日调整) condition.Add(new SearchField("exists(select * from u_zcsp where czid=u_zc2.id)", "", SearchOperator.用户定义)); return(this.GetShenPiList(condition)); }
//判断是否能浏览档案 public static bool isCanSeeFile(String ajnum) { bool result = false; //判断是否为“档案管理员” String[] allowRoles = new String[] { "档案管理员", "公司领导", "评审部角色" }; U_RolesBU role1 = new U_RolesBU(); //判断是否为“公司领导” result = role1.isRole(allowRoles); //判断是否为该资产责任人的 “领导” //判断是否为该资产的责任人或“协办人" if (result == false) { //普通的用户只能查询自己负责(或下属负责的项目) U_UserNameBU user1 = new U_UserNameBU(); String userName1 = user1.GetSelfAndXiaShu(Comm.CurUser); user1.Close(); String[] userArr = userName1.Split(','); CommTable tab1 = new CommTable("U_ZC"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("num2", ajnum)); DataSet ds1 = tab1.SearchData("*", condition); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { DataRow dr1 = ds1.Tables[0].Rows[0]; String u1 = dr1["Zeren"].ToString().Trim(); string u2 = dr1["Zeren1"].ToString().Trim(); if (u1 != String.Empty && Array.IndexOf(userArr, u1) >= 0) { result = true; //判断是否为资产的责任人(或责任人领导) } //判断是否为资产的协办人 if (result == false) { if (u2 != String.Empty && u2 == Comm.CurUser) { result = true; } } } } //判断是否通过了借阅申请 if (result == false) { CommTable comm1 = new CommTable("DA_JyBill"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("ajnum", ajnum)); condition.Add(new SearchField("borrow", Comm.CurUser)); condition.Add(new SearchField("status", "1")); condition.Add(new SearchField("time1", DateTime.Now.ToString("yyyy-MM-dd"), SearchOperator.大于等于)); DataSet ds1 = comm1.SearchData("count(*)", condition); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { DataRow dr1 = ds1.Tables[0].Rows[0]; if (int.Parse(dr1[0].ToString().Trim()) > 0) { result = true; } } comm1.Close(); } return(result); }
/// <summary> /// 根据查询条件,得到查询结果 /// </summary> /// <returns></returns> public DataSet GetShenPiListBySearchCondition( String xmmc, String num1, String danwei, String status, String time0, String time1, String status1, String status2) { List <SearchField> condition = new List <SearchField>(); if (xmmc != String.Empty) { condition.Add(new SearchField("xmmc", xmmc, SearchOperator.包含)); } if (num1 != String.Empty) { condition.Add(new SearchField("num2", num1)); } if (danwei != String.Empty) { condition.Add(new SearchField("danwei", danwei, SearchOperator.包含)); } if (status != String.Empty) { condition.Add(new SearchField("spstatus", status)); } if (time0 != String.Empty) { condition.Add(new SearchField("shijian1", time0, SearchOperator.大于等于)); } if (time1 != String.Empty) { condition.Add(new SearchField("shijian1", time1, SearchOperator.小于等于)); } if (status1 != String.Empty) { condition.Add(new SearchField("status1", status1)); } if (status2 != String.Empty) { condition.Add(new SearchField("status2", status1)); } //设置查询范围 U_RolesBU role1 = new U_RolesBU(); bool isAllCanSee = role1.isRole(new string[] { "公司领导", "评审部角色", "综合管理", "会计", "出纳", "领导秘书" }); role1.Close(); //1)公司领导、会计、出纳、领导秘书 可查询所有的项目 if (isAllCanSee == false) { //普通的用户只能查询自己负责(或下属负责的项目) List <SearchField> condition1 = new List <SearchField>(); U_UserNameBU user1 = new U_UserNameBU(); String userName1 = user1.GetSelfAndXiaShu(Comm.CurUser); user1.Close(); if (userName1 != String.Empty) { condition.Add(new SearchField("zeren", userName1, SearchOperator.集合)); } } return(this.GetShenPiList(condition)); }