Example #1
0
        Model.USER_Users mUser         = new Dianda.Model.USER_Users();//加载用户的实体类

        /// <summary>
        /// 根据用户的ID,或取到该用户所管理的所有项目的列表
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public void getMyProjectList(Page e)
        {
            try
            {
                mUser = (Model.USER_Users)e.Session["USER_Users"];//实例化
                //负责的项目
                //string sql1 = " SELECT ID,NAMES FROM vProject_Projects WHERE LeaderID='" + mUser.ID + "' and DELFLAG=0  and (Status=1 or Status=3 or Status=5) ";
                //string sql1 = " SELECT ID,NAMES,DELFLAG,Status FROM vProject_Projects WHERE LeaderID='" + mUser.ID + "' and (Status=1 or Status=3 or Status=5) ";

                //由于在我的项目中需要添加一个已删除的项目,所以在加载项目时也需要将删除的显示出来,故作以上修改(and DELFLAG=0 删除了)--早于2011-02-17
                string sql1 = " SELECT ID,NAMES,DELFLAG,Status FROM vProject_Projects WHERE (SendUserID='" + mUser.ID + "' OR LeaderID='" + mUser.ID + "') and (Status=1 or Status=3 or Status=5) ";
                //由于项目的创建人的权限,现在比项目负责人的权限还要大,所以要修改2011-02-17 唐春龙
                DataTable dt1 = pageControl.doSql(sql1).Tables[0];

                //参与的项目
                // string sql2 = " SELECT  ID,NAMES FROM  vProject_Projects WHERE  DELFLAG=0 and id in(select Projectid from Project_UserList where userid='" + mUser.ID + "' and status='1') ";
                string sql2 = " SELECT  ID,NAMES,DELFLAG,Status  FROM  vProject_Projects WHERE id in(select Projectid from Project_UserList where userid='" + mUser.ID + "' and status='1')  and (Status=1 or Status=3 or Status=5)";
                //由于在我的项目中需要添加一个已删除的项目,所以在加载项目时也需要将删除的显示出来,故作以上修改(DELFLAG=0 and 删除了)

                DataTable dt2 = pageControl.doSql(sql2).Tables[0];

                //合并两个相同结构的DATATABLE
                DataTable Newdt = common.CombineTheSameDatatable(dt1, dt2);
                //将一个DATATABLE中的重复项去除掉
                if (null != Newdt)
                {
                    Newdt = common.makeDistinceTable(Newdt, "ID");
                    e.Session["Project_Projects"] = Newdt;
                }
            }
            catch
            {
            }
        }
Example #2
0
        /// <summary>
        /// 根据传过来的文件夹的ID值,遍历文件夹及其下级子文件夹的目录
        /// </summary>
        /// <param name="folderlist"></param>
        public void ShowFoldes(string folderlist, string fileList)
        {
            try
            {
                DataTable dtAll     = new DataTable(); //用来接收汇总后文件夹的数据
                DataTable dtAllfile = new DataTable(); //用来接收汇总后的文件的数据
                string    sqlinfile = commons.makeSqlIn(fileList, ';');
                string    sqlin     = commons.makeSqlIn(folderlist, ';');
                DataTable dt        = new DataTable();
                if (folderlist.Length > 1)
                {
                    dt = bdf.GetList(" DELFLAG='0' and  ID IN " + sqlin).Tables[0];
                }
                if (fileList.Length > 1)
                {
                    string sqlfile = "select * from vDocument_File where DELFLAG='0' and id in" + sqlinfile;
                    dtAllfile = pcdosql.doSql(sqlfile).Tables[0];//获取到被选择的文件的数据集合
                }
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string paths = dt.Rows[i]["COLUMNSPATH"].ToString();
                        //用循环的方式构建DT(文件夹)
                        DataTable dt1 = bdf.GetList(" DELFLAG='0' and COLUMNSPATH LIKE '" + paths + "%'").Tables[0];
                        if (dt1.Rows.Count > 0)
                        {
                            dtAll = commons.CombineTheSameDatatable(dt1, dtAll);
                        }

                        //处理文件的
                        string    sqlfile2 = "select * from vDocument_File where DELFLAG='0' and COLUMNSPATH LIKE '" + paths + "%'";
                        DataTable dtf2     = pcdosql.doSql(sqlfile2).Tables[0];
                        if (dtf2.Rows.Count > 0)
                        {
                            dtAllfile = commons.CombineTheSameDatatable(dtf2, dtAllfile);
                        }
                    }
                    dtAll = commons.makeDistinceTable(dtAll, "COLUMNSPATH"); //将重复的数据处理掉

                    dtAllfile = commons.makeDistinceTable(dtAllfile, "ID");  //将重复的数据处理掉

                    if (dtAll.Rows.Count > 0)
                    {
                        GridView1.DataSource = dtAll;
                        GridView1.DataBind();
                        GridView1.Visible = true;
                    }
                    else
                    {
                        GridView1.Visible = false;
                    }
                }
                if (dtAllfile.Rows.Count > 0)
                {
                    GridView2.DataSource = dtAllfile;
                    GridView2.DataBind();
                    GridView2.Visible = true;
                }
                else
                {
                    GridView2.Visible = false;
                }
            }
            catch
            {
            }
        }
Example #3
0
        /// <summary>
        /// 根据文件的属性是项目的还是个人的,还有用户的ID,项目的ID获取到列表
        /// </summary>
        /// <param name="userid">用户的ID</param>
        /// <param name="types">文件的归类:public是项目的文件夹;private是个人的文件夹</param>
        /// <param name="projectid">项目的ID(select in ('0','ds')的方式)</param>
        public DataTable makeFolder1(string userid, string types, string projectid, string TJ)
        {
            DataTable DTColumns = new DataTable();

            if (TJ == "and ( status is null or Status=-1)")
            {
                TJ = "";
            }
            else if (String.IsNullOrEmpty(TJ))
            {
                TJ = "and ( status is null or Status=1)";
            }

            try
            {
                userid    = commons.RequestSafeString(userid, 50);
                types     = commons.RequestSafeString(types, 50);
                projectid = commons.RequestSafeString(projectid, 50);
                // 用来比对子栏目是否为顶级节点

                string sqlwhere = "";
                if (types == "private")
                {
                    sqlwhere  = " Types='" + types + "' and UserID='" + userid + "' and DELFLAG='0'" + TJ + "  order by COLUMNSPATH";
                    DTColumns = bdf.GetList(sqlwhere).Tables[0];
                }
                else if (types == "public")
                {
                    if (projectid.Length > 0)//表示仅仅取该项目的文档
                    {
                        sqlwhere  = "select * from vDocument_Folder where Types='" + types + "' and (projectid='" + projectid + "' or upid='-1') and DELFLAG='0' " + TJ + "  order by COLUMNSPATH";
                        DTColumns = pageconto.doSql(sqlwhere).Tables[0];
                        //DTColumns = bdf.GetList(sqlwhere).Tables[0];
                    }
                    else
                    {
                        // sqlwhere = " Types='" + types + "' and (projectid in(select id from Project_Projects where leaderid='" + userid + "') or projectid in(select Projectid from Project_UserList where userid='" + userid + "' and status='1') or projectid='0') and DELFLAG='0' order by COLUMNSPATH";
                        sqlwhere  = "select * from vDocument_Folder where  Types='" + types + "' and (projectid in(select id from Project_Projects where leaderid='" + userid + "') or projectid in(select Projectid from Project_UserList where userid='" + userid + "' and status='1') or projectid='0') and DELFLAG='0' AND (PDEL=0 OR PDEL IS NULL) " + TJ + "  order by status,COLUMNSPATH";
                        DTColumns = pageconto.doSql(sqlwhere).Tables[0];
                        System.Web.HttpContext.Current.Session["tj"] = "";
                    }
                    // DTColumns = bdf.GetList(sqlwhere).Tables[0];
                }
                else//共享文档
                {
                    //根据当前的用户,从视图中找出所有的提供共享的组织内用户
                    string sql1 = " SELECT userid,username,realname,shareForuser,shareForuser+'/'+userid as paths FROM vDocument_File_Share where shareforuser='******' and delflag='0' group by userid,username,realname,shareForuser";

                    string    sql2 = "select userid,username,realname,shareForuser,shareForuser+'/'+userid as paths from vDocument_Folder_Share where shareforuser='******' and delflag='0' group by userid,username,realname,shareForuser";
                    DataTable dt1  = pageconto.doSql(sql1).Tables[0];
                    DataTable dt2  = pageconto.doSql(sql2).Tables[0];
                    DTColumns = commons.CombineTheSameDatatable(dt1, dt2);
                    DTColumns = commons.makeDistinceTable(DTColumns, "userid");
                    System.Web.HttpContext.Current.Session["tj"] = "";
                }

                // 有子栏目,则显示树
            }
            catch
            {
                System.Web.HttpContext.Current.Session["tj"] = "";
            }
            return(DTColumns);
        }