Exemplo n.º 1
0
        public void DataBindGameCategoryAndType(DropDownList ddlGameCategory, DropDownList ddlGameType)
        {
            UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo();

            DalOperationAboutGameCategory dalGameCategory = new DalOperationAboutGameCategory();

            DataTable dtGameCategory = (ddlGameCategory.ID == "ddlEnrollGameCategory" ? dalGameCategory.GetGameCategoryIng(DateTime.Now).Tables[0] : dalGameCategory.GetList().Tables[0]);

            for (int i = 0; i < dtGameCategory.Rows.Count; i++)
            {
                ddlGameCategory.Items.Add(new ListItem(dtGameCategory.Rows[i]["gameTitle"].ToString().Trim(), dtGameCategory.Rows[i]["gameCategoryId"].ToString().Trim()));
            }

            //检查是否有活动届次数据

            if (ddlGameCategory.Items.Count == 0)
            {
                Javascript.AlertAndRedirect("当前暂无需要报名的活动届次信息:(", "/Administrator/EnrollManage.aspx?fragment=2", Page);
                return;
            }

            if (CommonUtility.SafeCheckByParams<String>(gameCategoryId, ref _gameCategoryId))
            {
                for (int i = 0; i < ddlGameCategory.Items.Count; i++)
                {
                    if (ddlGameCategory.Items[i].Value == gameCategoryId)
                    {
                        ddlGameCategory.SelectedIndex = i;
                        break;
                    }
                }
            }

            DalOperationAboutGameType dalGameType = new DalOperationAboutGameType();

            DataTable dtGameType = (ddlGameType.ID == "ddlEnrollGameType" || ddlGameType.ID == "ddlGameType" ? dalGameType.GetListByGameCategoryIdAndSex(int.Parse(ddlGameCategory.SelectedValue), user.Sex == "男" ? "1" : "2").Tables[0] : dalGameType.GetGameTypeByGameCategoryId(int.Parse(ddlGameCategory.SelectedValue)).Tables[0]);

            for (int i = 0; i < dtGameType.Rows.Count; i++)
            {
                ddlGameType.Items.Add(new ListItem(dtGameType.Rows[i]["gameTypeTitle"].ToString().Trim(), dtGameType.Rows[i]["gameTypeId"].ToString().Trim()));
            }

            if (CommonUtility.SafeCheckByParams<String>(gameTypeId, ref _gameCategoryId))
            {
                for (int i = 0; i < ddlGameType.Items.Count; i++)
                {
                    if (ddlGameType.Items[i].Value == gameTypeId)
                    {
                        ddlGameType.SelectedIndex = i;
                        break;
                    }
                }
            }

            //检查是否有活动届次和活动类型数据

            if (!(ddlGameCategory.Items.Count > 0 && ddlGameType.Items.Count > 0))
            {
                Javascript.AlertAndRedirect("当前暂无需要报名的活动届次信息:(", "/Administrator/EnrollManage.aspx?fragment=2", Page);
                return;
            }
        }
Exemplo n.º 2
0
    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;
                }

            }
        }
    }