public List<SysDepartment> SelectDeptByUser(string _userid)
 {
     if (_userid == "1")
     {
         return Select();
     }
     else
     {
         string deptlist = "";
         List<SysUserDepts> lists = new List<SysUserDepts>();
         SysUserDeptsBiz biz = new SysUserDeptsBiz();
         deptlist = biz.GetUserDeptList(_userid);
         if (string.IsNullOrEmpty(deptlist))
         {
             return null;
         }
         else
         {
             string sql = "";
             sql = "FDepartmentId in (" + deptlist + ")";
             NameValueCollection where = new NameValueCollection();
             where.Add("codition", sql);
             return Select(where);
         }
     }
 }
        public void GetGridData()
        {
            string _searchcontent = "";
            string _sortname = "";
            string _sortdirection = "";
            string _pagenumber = "";
            string _pagesize = "";
            _searchcontent = Parameters["psearchcontent"];
            _sortname = Parameters["psortname"];
            if (!string.IsNullOrEmpty(_sortname))
            {
                sSortName = _sortname;
            }
            _sortdirection = Parameters["psortdirection"];
            if (!string.IsNullOrEmpty(_sortdirection))
            {
                sSortDirection = _sortdirection;
            }
            _pagenumber = Parameters["ppagenumber"];
            if (!string.IsNullOrEmpty(_pagenumber))
            {
                sPageIndex = Convert.ToInt32(_pagenumber);
            }
            _pagesize = Parameters["ppagesize"];
            if (!string.IsNullOrEmpty(_pagesize))
            {
                sPageSize = Convert.ToInt32(_pagesize);
            }
            List<PmPartymember> lists = new List<PmPartymember>();
            PmPartymemberBiz biz = new PmPartymemberBiz();
            string _searchtext = _searchcontent;
            string wheresql = "(FActivistFlag = '1') and (FObjectFlag = '1') and (FPrePartyFlag = '0') and (FPartyFlag = '0') and (FHistoryFlag = '0') ";
            string _deptid = Parameters["pdeptid"];
            if (string.IsNullOrEmpty(_deptid) || _deptid == "0")
            {
                if (userid != "1")
                {
                    SysUserDeptsBiz udbiz = new SysUserDeptsBiz();
                    string deptidlist = udbiz.GetUserDeptList(userid);
                    if (string.IsNullOrEmpty(deptidlist))
                    {
                        wheresql += " and  (FDepartmentId in (0))";
                    }
                    else
                    {
                        wheresql += " and (FDepartmentId in (" + deptidlist + "))";
                    }
                }
            }
            else
            {
                wheresql += "(FDepartmentId = " + _deptid + ")";
            }

            if (!string.IsNullOrEmpty(_searchtext))
            {
                //difine wheresql
                wheresql += " and (FMemberName like '%" + _searchtext + "%')";

                //for example:wheresql = " (FDepartmentName like '%" + _searchtext + "%') or (FDepartmentCode like '%" + _searchtext + "%')";

            }
            NameValueCollection where = new NameValueCollection();
            where.Add("condition", wheresql);
            NameValueCollection orderby = new NameValueCollection();
            orderby.Add(_sortname, _sortdirection);
            Int32 totalcount = 0;
            lists = biz.Select(where, orderby, Convert.ToInt32(sPageIndex), Convert.ToInt32(sPageSize), out totalcount);
            for (int i = 0; i < lists.Count; i++)
            {
                lists[i].FOperation = "<a iconCls='icon-remove' class='btn' href='javascript:void(0)' onclick='delobject(" + lists[i].FMemberId.ToString() + ")'>取消资格</a>";
            }
            string datasource = Utils.GetRepeaterDatasource(lists, sPageIndex, sPageSize, totalcount);
            Response.Write(datasource);
        }
Beispiel #3
0
 public void GetGridData()
 {
     string _searchcontent = "";
     string _sortname = "";
     string _sortdirection = "";
     string _pagenumber = "";
     string _pagesize = "";
     string _deptid = "";
     _searchcontent = Parameters["psearchcontent"];
     _sortname = Parameters["psortname"];
     _deptid = Parameters["pdeptid"];
     if (!string.IsNullOrEmpty(_sortname))
     {
         sSortName = _sortname;
     }
     _sortdirection = Parameters["psortdirection"];
     if (!string.IsNullOrEmpty(_sortdirection))
     {
         sSortDirection = _sortdirection;
     }
     _pagenumber = Parameters["ppagenumber"];
     if (!string.IsNullOrEmpty(_pagenumber))
     {
         sPageIndex = Convert.ToInt32(_pagenumber);
     }
     _pagesize = Parameters["ppagesize"];
     if (!string.IsNullOrEmpty(_pagesize))
     {
         sPageSize = Convert.ToInt32(_pagesize);
     }
     List<SysMember> lists = new List<SysMember>();
     SysMemberBiz biz = new SysMemberBiz();
     string _searchtext = _searchcontent;
     string wheresql = "";
     if (string.IsNullOrEmpty(_deptid) || _deptid == "0")
     {
         if (userid != "1")
         {
             SysUserDeptsBiz udbiz = new SysUserDeptsBiz();
             string deptidlist = udbiz.GetUserDeptList(userid);
             if (string.IsNullOrEmpty(deptidlist))
             {
                 wheresql = "(FDepartmentId in (0))";
             }
             else
             {
                 wheresql = "(FDepartmentId in (" + deptidlist + "))";
             }
         }
         else
         {
             wheresql = "1=1";
         }
     }
     else
     {
         wheresql = "(FDepartmentId = " + _deptid + ")";
     }
     if (!string.IsNullOrEmpty(_searchtext))
     {
         wheresql = " and ((FMemberName like '%" + _searchtext + "%') or (FMemberCode like '%" + _searchtext + "%'))";
     }
     NameValueCollection where = new NameValueCollection();
     where.Add("condition", wheresql);
     NameValueCollection orderby = new NameValueCollection();
     orderby.Add(_sortname, _sortdirection);
     Int32 totalcount = 0;
     lists = biz.Select(where, orderby, Convert.ToInt32(sPageIndex), Convert.ToInt32(sPageSize), out totalcount);
     string datasource = Utils.GetRepeaterDatasource(lists, sPageIndex, sPageSize, totalcount);
     Response.Write(datasource);
 }