Example #1
0
        protected void dlGameCategory_ItemCommand(object source, DataListCommandEventArgs e)
        {
            DalOperationAboutGameCategory doan = new DalOperationAboutGameCategory();

            if (e.CommandName == "delete")
            {
                string gameCategoryId = dlGameCategory.DataKeys[e.Item.ItemIndex].ToString();//取选中行公告编号
                doan.Delete(int.Parse(gameCategoryId));
                Javascript.AlertAndRedirect("删除成功!", "/Administrator/DrawManage.aspx?fragment=1&page=" + pageIndex, Page);
            }
            else if (e.CommandName == "openDraw")
            {
                string gameCategoryId = dlGameCategory.DataKeys[e.Item.ItemIndex].ToString();//取选中行公告编号

                //首先判断是否已经过截止日期,如果已经未过截止日期则禁止修改抽签状态
                DataTable dt = doan.CheckGameCategoryIsOverTimeByGameCategoryId(int.Parse(gameCategoryId),DateTime.Now).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    Javascript.GoHistory(-1, "当前报名未过截止日期,禁止修改抽签状态:(", Page);
                    return;
                }

                doan.UpdateDrawState(new GameCategory { gameCategoryId = int.Parse(gameCategoryId), isOpenDraw = 1 });
                Javascript.AlertAndRedirect("开放抽签成功!", "/Administrator/DrawManage.aspx?fragment=1&page=" + pageIndex, Page);
            }
            else if (e.CommandName == "closeDraw")
            {
                string gameCategoryId = dlGameCategory.DataKeys[e.Item.ItemIndex].ToString();//取选中行公告编号
                //首先判断是否已经过截止日期,如果已经未过截止日期则禁止修改抽签状态
                DataTable dt = doan.CheckGameCategoryIsOverTimeByGameCategoryId(int.Parse(gameCategoryId), DateTime.Now).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    Javascript.GoHistory(-1, "当前报名未过截止日期,禁止修改抽签状态:(", Page);
                    return;
                }
                doan.UpdateDrawState(new GameCategory { gameCategoryId = int.Parse(gameCategoryId), isOpenDraw = 0 });
                Javascript.AlertAndRedirect("关闭抽签成功!", "/Administrator/DrawManage.aspx?fragment=1&page=" + pageIndex, Page);
            }
        }
Example #2
0
        protected void btnEnroll_Click(object sender, EventArgs e)
        {
            UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo();
            DalOperationAboutGameEnrollList dal = new DalOperationAboutGameEnrollList();
            DateTime _now = DateTime.Now;

            DalOperationAboutGameCategory dalgc = new DalOperationAboutGameCategory();

            //首先检查报名时间是否已经截止
            if (dalgc.CheckGameCategoryIsOverTimeByGameCategoryId(int.Parse(ddlEnrollGameCategory.SelectedValue), _now).Tables[0].Rows.Count == 0)
            {
                Javascript.GoHistory(-1, "当前所选活动届次报名已经截止:(", Page);
                return;
            }

            if (dal.Exists(user.userNo, int.Parse(ddlEnrollGameCategory.SelectedValue), int.Parse(ddlEnrollGameType.SelectedValue)) > 0)
            {
                Javascript.AlertAndRedirect("当前所选活动届次和活动类型已经报名,点击确定查看报名信息", "/Administrator/EnrollManage.aspx?fragment=2", Page);
                return;
            }

            try
            {
                dal.Add(new GameEnrollList { gameCategoryId = int.Parse(ddlEnrollGameCategory.SelectedValue), gameTypeId = int.Parse(ddlEnrollGameType.SelectedValue), teacherNo = user.userNo, updateTime = _now });
                Javascript.AlertAndRedirect("报名成功:)", "/Administrator/EnrollManage.aspx?fragment=2", Page);
            }
            catch (System.Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                Javascript.GoHistory(-1, "报名失败:)", Page);
            }
        }