コード例 #1
0
ファイル: Project.aspx.cs プロジェクト: youye00/UDS
        /// <summary>
        /// 显示数据
        /// </summary>
        private void PopulateData()
        {
            #region 初始化数据
            DataTable     dataTable  = new DataTable();
            SqlDataReader dataReader = null;
            ProjectClass  pjt        = new ProjectClass();
            MailClass     mail       = new MailClass();
            DocumentClass doc        = new DocumentClass();
            #endregion

            #region 获取项目信息
            dataReader = pjt.GetClassInfo(classID);
            try
            {
                if (dataReader.Read())
                {
                    this.lblClassName.Text = dataReader[0].ToString();
                    //			this.lblParentClassName.Text = dataReader[2].ToString();
                    //			this.lblBuildDate.Text	     = dataReader[3].ToString();
                    //			this.lblEndDate.Text		 = dataReader[4].ToString();
                    //			this.lblFinishedScale.Text   = dataReader[8].ToString();
                    //			this.lblDescription.Text	 = dataReader[7].ToString();
                }
            }
            catch (Exception ex)
            {
                UDS.Components.Error.Log(ex.ToString());
                Server.Transfer("../Error.aspx");
            }
            dataReader = null;
            #endregion

            #region 获取项目成员信息
            dataReader = pjt.GetMemberInClass(classID);
            int i = 0;
            try
            {
                while (dataReader.Read())
                {
                    if (i < 3)
                    {
                        this.lblMember.Text += "<a href='Mail/Compose.aspx?Action=3"
                                               + "&ClassID=" + classID.ToString()
                                               + "&Username="******"Staff_Name"].ToString()
                                               + "&Name=" + Server.UrlEncode(dataReader["RealName"].ToString())
                                               + "'>"
                                               + dataReader["RealName"].ToString()
                                               + "</a> &nbsp;&nbsp;";
                    }
                    i++;
                }
                if (i >= 3)
                {
                    this.lblMember.Text += "..";
                }
                if (this.lblMember.Text == "")
                {
                    this.lblMember.Text = "";
                }
            }
            catch (Exception ex)
            {
                UDS.Components.Error.Log(ex.ToString());
                Server.Transfer("../Error.aspx");
            }
            dataReader = null;
            #endregion

            #region 根据权限显示相关功能标题
            // 设置缺省值
            int cstRightToApproveDocument = 2;
            int cstRightToViewDocument    = 10;
            int cstRightToBuildNode       = 5;
            int cstDisplayMember          = 6;
            int cstTeamRight   = 7;
            int cstComposeMail = 11;
            int cstDeliveryDoc = 11;
            int cstProjectMove = 12;
            this.lblManageProject.Visible    = pjt.GetAccessPermission(classID, Username, cstRightToBuildNode);
            this.imgManageProject.Visible    = this.lblManageProject.Visible;
            this.lblManageDirectory.Visible  = pjt.GetAccessPermission(classID, Username, cstRightToBuildNode);
            this.imgManageDirectory.Visible  = this.lblManageDirectory.Visible;
            this.lblComposeMail.Visible      = pjt.GetAccessPermission(classID, Username, cstComposeMail);
            this.imgComposeMail.Visible      = this.lblComposeMail.Visible;
            this.lblDeliveryDoc.Visible      = pjt.GetAccessPermission(classID, Username, cstDeliveryDoc);
            this.imgDeliveryDoc.Visible      = this.lblDeliveryDoc.Visible;
            this.lblShowMember.Visible       = pjt.GetAccessPermission(classID, Username, cstDisplayMember);
            this.imgShowMember.Visible       = this.lblShowMember.Visible;
            this.lblManagePermission.Visible = pjt.GetAccessPermission(classID, Username, cstTeamRight);
            this.imgManagePermission.Visible = this.lblManagePermission.Visible;
            this.lblRemove.Visible           = pjt.GetAccessPermission(classID, Username, cstProjectMove);
            this.imgRemove.Visible           = this.lblRemove.Visible;

//			this.tr1.Visible				  = pjt.GetAccessPermission(classID,Username,cstRightToViewDocument);
//			this.tr3.Visible                  = pjt.GetAccessPermission(classID,Username,cstRightToApproveDocument);


            this.line1.Visible        = pjt.GetAccessPermission(classID, Username, cstRightToViewDocument);
            this.IMG1.Visible         = this.line1.Visible;
            this.dgDocList.Visible    = this.line1.Visible;
            this.imgSubscribe.Visible = this.line1.Visible;
            this.lblSubscribe.Visible = this.line1.Visible;
            this.line2.Visible        = pjt.GetAccessPermission(classID, Username, cstRightToApproveDocument);
            this.IMG3.Visible         = this.line2.Visible;
            this.dgAppDocList.Visible = this.line2.Visible;

            #endregion

            #region 根据权限取出邮件数据
            /// <summary>
            /// 将某用户的取出邮件数据
            /// </summary>

            dataTable             = mail.GetClassMails(classID, UserCookie.Value.ToString());
            dgMailList.DataSource = dataTable.DefaultView;
            dgMailList.DataBind();

            mail = null;

            #endregion

            #region 根据权限取出文档数据
            /// <summary>
            /// 将某用户的文档数据取出
            /// </summary>
            if (pjt.GetAccessPermission(classID, Username, cstRightToViewDocument) || bSubscription)
            {
                dataTable            = doc.GetClassDocs(classID);
                dgDocList.DataSource = dataTable.DefaultView;
                dgDocList.DataBind();
                dataTable = null;
            }
            else
            {
//				IMG1.Visible	  = false;
//				IMG4.Visible      = false;
                dgDocList.Visible = false;
            }
            #endregion

            #region 根据权限取出某项目的审批文档数据
            /// <summary>
            /// 将某项目的审批文档数据取出
            /// </summary>
            if (pjt.GetAccessPermission(classID, Username, cstRightToApproveDocument))
            {
                dataTable = doc.GetApproveClassDocs(classID);
                dgAppDocList.DataSource = dataTable.DefaultView;
                dgAppDocList.DataBind();
                dataTable = null;
                doc       = null;
            }
            else
            {
                IMG3.Visible         = false;
                dgAppDocList.Visible = false;
                lblApp.Visible       = false;
            }
            #endregion
        }