コード例 #1
0
ファイル: NotifyList.aspx.cs プロジェクト: skyaspnet/usta
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DalOperationAboutAdminNotifyType dalOperationAboutAdminNotifyType = new DalOperationAboutAdminNotifyType();
            DataSet _ds = dalOperationAboutAdminNotifyType.FindAllParentAdminNotifyType();

            string strLi = string.Empty;

            for (int i = 0; i < _ds.Tables[0].Rows.Count; i++)
            {
                strLi += "<li id=\"liFragment" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\" pid=\"" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\"><a href=\"?pid=" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\"><span>" + _ds.Tables[0].Rows[i]["notifyTypeName"].ToString().Trim() + "</span></a></li>";

                if (i == 0 && notifyTypeParentId == -3)
                {
                    notifyTypeParentId = int.Parse(_ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim());
                }
            }

            ltlNotifyTypeParent.Text = strLi;

            if (notifyTypeParentId > 0 || notifyTypeParentId == -3)
            {

                divFragment1.Attributes.Add("pid", notifyTypeParentId.ToString());
                DataListBindNotifyType(notifyTypeParentId);
                divFragment1.Visible = true;
            }

            if (notifyTypeParentId == -1)
            {
                ViewAdminNotify();
            }
            if (notifyTypeParentId == -2)
            {
                if (Request["notifyTypeId"] != null)
                {
                    int typeId = -1;
                    if (CommonUtility.SafeCheckByParams<string>(Request["notifyTypeId"], ref typeId))
                    {
                        DataListBindNotifyByTypeId(typeId);
                    }
                    else
                    {
                        Javascript.GoHistory(-1, Page);
                    }
                }
            }

            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();

            isAdmin = UserCookiesInfo.userType.ToString();

            if (UserCookiesInfo.userType == 3)
            {
                DalOperationUsers DalOperationUsers = new DalOperationUsers();
                DataSet ds = DalOperationUsers.StudentTips(UserCookiesInfo.userNo);

                int examCount = ds.Tables[0].Rows.Count;

                int experimentsCount = ds.Tables[1].Rows.Count;

                int schoolWorksCount = ds.Tables[2].Rows.Count;

                int schoolworkpaperCount = ds.Tables[3].Rows.Count;

                int feedBackCount = ds.Tables[4].Rows.Count;

                DalOperationPatch dal = new DalOperationPatch();
                DataSet ds1 = dal.GetLatestCourseNotify(UserCookiesInfo.userNo);

                int courseNotifyCount = ds1.Tables[0].Rows.Count;

                tbTip.Visible = true;

                if (feedBackCount == 0)
                {
                    divFeedBack.Visible = false;
                    tdFeedBack.Visible = false;
                }
                else
                {
                    ltlFeedBack.Text = feedBackCount.ToString();
                    dlistFeedBack.DataSource = ds.Tables[4];
                    dlistFeedBack.DataBind();
                }

                if (examCount == 0)
                {
                    divExam.Visible = false;
                    tdExam.Visible = false;
                }
                else
                {
                    ltlExamTip.Text = examCount.ToString();
                    dlstExam.DataSource = ds.Tables[0];
                    dlstExam.DataBind();
                }

                if (experimentsCount == 0)
                {
                    divExperiments.Visible = false;
                    tdExperiments.Visible = false;
                }
                else
                {
                    ltlExperimentsTip.Text = experimentsCount.ToString();
                    dlstExpriment.DataSource = ds.Tables[1];
                    dlstExpriment.DataBind();
                }

                if (schoolWorksCount == 0)
                {
                    divSchoolWorks.Visible = false;
                    tdSchoolWorks.Visible = false;
                }
                else
                {
                    ltlSchoolWorksTip.Text = schoolWorksCount.ToString() + "次在线作业待提交";

                    dlstSchoolwork.DataSource = ds.Tables[2];
                    dlstSchoolwork.DataBind();
                }

                if (schoolworkpaperCount == 0)
                {
                    divSchoolWorksPaper.Visible = false;
                    tdSchoolWorksPaper.Visible = false;
                }
                else
                {
                    ltlschoolworkpaper.Text = "近期有" + schoolworkpaperCount.ToString() + "次书面作业待提交(此为提醒功能,并不表示未提交作业)";

                    dlstSchoolworkpa.DataSource = ds.Tables[3];
                    dlstSchoolworkpa.DataBind();
                }

                if (courseNotifyCount == 0)
                {
                    divNotify.Visible = false;
                    tdNotify.Visible = false;
                }
                else
                {
                    ltlnotify.Text = courseNotifyCount.ToString();
                    DataList1.DataSource = ds1.Tables[0];
                    DataList1.DataBind();
                }
            }
            if (UserCookiesInfo.userType == 0 || UserCookiesInfo.userType == 1 || UserCookiesInfo.userType == 2)
            {
                DalOperationAboutArchivesConfig dalArchivesConfig = new DalOperationAboutArchivesConfig();

                if (dalArchivesConfig.CheckArchivesNotifyTime())
                {
                    tdArchivesNotify.Visible = true;
                    divArchivesNotify.Visible = true;
                }
                else
                {
                    tdArchivesNotify.Visible = false;
                    divArchivesNotify.Visible = false;
                }

                DalOperationAboutGameCategory dal = new DalOperationAboutGameCategory();

                if (dal.GetGameCategoryIng(DateTime.Now).Tables[0].Rows.Count>0)
                {
                    tdGameCategory.Visible = true;
                    divGameCategory.Visible = true;
                }
                else
                {
                    tdGameCategory.Visible = false;
                    divGameCategory.Visible = false;
                }

            }
        }
    }