Exemplo n.º 1
0
        /// <summary>
        /// 行命令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void gvPeriod_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            long userId   = BLL.User.GetUserID(SPContext.Current.Web.CurrentUser);
            long periodId = long.Parse(((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent)).Cells[0].Text); //根据点击行,获取对应期次ID

            if (e.CommandName == "Del")                                                                           //删除期次,即将期次的Flag置为0
            {
                Periods dr = new Periods();
                dr.PeriodID = periodId;
                DateTime dtNow = DateTime.Now;
                DAL.Periods.DelPeriodsByID(dr, userId, dtNow);
                List <CSPeriodsCourse> dt = DAL.Periods.GetPeriodByUserId(long.Parse(ViewState["CreatedBy"].ToString()));
                BindGvDate(dt);
            }
            if (e.CommandName == "Standard")    //评价指标,为该期次制定评价指标
            {
                DAL.Common.OpenWindow(this.Page, DAL.Common.SPWeb.Url + "/_layouts/15/ContestWeb/" + "ScoreStandard.aspx?PeriodID=" + periodId.ToString());
            }

            if (e.CommandName == "Upload")    //为该期次上传样例作品,以供学生评分训练
            {
                DAL.Common.OpenWindow(this.Page, DAL.Common.SPWeb.Url + "/_layouts/15/ContestWeb/" + "OnlineEnroll.aspx?IsSample=1&&PeriodID=" + periodId.ToString());
            }

            if (e.CommandName == "Alloting")     //评分分配,按照作品总数,确定互评每组人数,然后随机分配作品给每个用户
            {
                int workscount = DAL.Works.GetWorksNumByPeriodID(periodId);
                if (workscount <= 2)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "message",
                                                            "<script defer>alert('作品数仅有" + workscount + "件,总数太少,请提醒参赛者尽快提交作品!');</script>");
                }
                else
                {
                    BLL.Period.WorksAlloting(periodId);
                }
            }
            if (e.CommandName == "ComputingScore")
            {
                DateTime[] dateArr     = BLL.Period.GetPeridTimeSets(periodId); //获取当前期次的时间设置
                DateTime   nowDateTime = DateTime.Now;
                if (nowDateTime > dateArr[3].AddDays(1))                        //期次评分阶段结束
                {
                    BLL.WorksScoring.ComputerAllScoresByPeriod(periodId);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "message", "<script defer>alert('本期成绩已公布!');</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "message", "<script defer>alert('作品还未到成绩公布时间,或已过期,请确认当前所处比赛时间阶段后再试!');</script>");
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 发布
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnAdd_Click(object sender, EventArgs e)
        {
            //验证时间
            if (JudgeTime())
            {
                Periods ds = DAL.Periods.GetPeriodsByTitle(txtName.Text.ToString());
                if (ds != null)
                {
                    error.Text = "竞赛名称已经存在";
                    txtName.Focus();
                    return;
                }
                Periods dr = WorksDt;
                dr.PeriodID    = 1;
                dr.PeriodTitle = txtName.Text;

                dr.Require  = txtRequire.Text;
                dr.CourseID = long.Parse(ViewState["CourseID"].ToString());
                //添加作品类别
                //当小类不限时
                if (long.Parse(ddlTwoWorksType.SelectedValue) == 0)
                {
                    //当大类有值时
                    if (long.Parse(ddlOneWorksType.SelectedValue) != 0)
                    {
                        dr.WorksTypeID = int.Parse(ddlOneWorksType.SelectedValue);
                    }
                    else
                    {
                        dr.WorksTypeID = 0;
                    }
                }
                else
                {
                    //当小类有值时
                    dr.WorksTypeID = int.Parse(ddlTwoWorksType.SelectedValue);
                }

                string dateStr = DateTime.Now.ToString("yyyyMMdd");

                //dr["Type"] = rblIsUrl.SelectedValue;
                if (txtNum.Text != "")
                {
                    dr.Number = int.Parse(txtNum.Text);
                }

                if (!dateTimeStartSubmit.IsDateEmpty)
                {
                    dr.StartSubmit = dateTimeStartSubmit.SelectedDate;
                }
                if (!dateTimeEndSubmit.IsDateEmpty)
                {
                    dr.EndSubmit = dateTimeEndSubmit.SelectedDate;
                }

                if (!dateTimeStartScore.IsDateEmpty)
                {
                    dr.StartScore = dateTimeStartScore.SelectedDate;
                }

                if (!dateTimeEndScore.IsDateEmpty)
                {
                    dr.EndScore = dateTimeEndScore.SelectedDate;
                }

                if (!dateTimeStartPublic.IsDateEmpty)
                {
                    dr.StartPublic = dateTimeStartPublic.SelectedDate;
                }

                if (!dateTimeEndPublic.IsDateEmpty)
                {
                    dr.EndPublic = dateTimeEndPublic.SelectedDate;
                }
                //时间和人
                dr.CreatedBy = BLL.User.GetUserID(SPContext.Current.Web.CurrentUser);
                dr.Created   = DateTime.Now;
                dr.Flag      = 1;

                DAL.Periods.InsertPeriods(dr);
                BindGvDate();
                ClearDateTime(dateTimeStartSubmit);
                ClearDateTime(dateTimeEndSubmit);
                ClearDateTime(dateTimeStartScore);
                ClearDateTime(dateTimeEndScore);
                ClearDateTime(dateTimeStartPublic);
                ClearDateTime(dateTimeEndPublic);
                SetValue();
                DAL.Common.ShowMessage(this.Page, this.GetType(), "添加成功!");
                Response.Redirect(DAL.Common.SPWeb.Url + "/_layouts/15/ContestWeb/pubContest.aspx");
            }
            else
            {
                error.Text = "请注意设置的提交、评分、公示的开放时间和截止时间,开放时间必须早于截止时间!";
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 行命令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void gvPeriod_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            long userId = BLL.User.GetUserID(SPContext.Current.Web.CurrentUser);

            if (e.CommandName == "Del")
            {
                GridViewRow drv = ((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent));
                Periods     dr  = new Periods();
                dr.PeriodID = long.Parse(drv.Cells[0].Text);
                DateTime dtNow = DateTime.Now;
                DAL.Periods.DelPeriodsByID(dr, userId, dtNow);
                BindGvDate();
                ClearDateTime(dateTimeStartSubmit);
                ClearDateTime(dateTimeEndSubmit);
                ClearDateTime(dateTimeStartScore);
                ClearDateTime(dateTimeEndScore);
                ClearDateTime(dateTimeStartPublic);
                ClearDateTime(dateTimeEndPublic);

                SetValue();
                SetControls(1);
            }

            if (e.CommandName == "Down")
            {
                ClearDateTime(dateTimeStartSubmit);
                ClearDateTime(dateTimeEndSubmit);
                ClearDateTime(dateTimeStartScore);
                ClearDateTime(dateTimeEndScore);
                ClearDateTime(dateTimeStartPublic);
                ClearDateTime(dateTimeEndPublic);
                //
                GridViewRow        drv = ((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent));
                CSPeriodsWorksType dt  = DAL.Periods.GetPeriodsByID(long.Parse(drv.Cells[0].Text));
                txtName.Text = dt.PeriodTitle;

                txtRequire.Text = dt.Require;


                txtNum.Text = dt.Number.ToString();

                if (dt.StartSubmit.ToString() != "")
                {
                    dateTimeStartSubmit.SelectedDate = DateTime.Parse(dt.StartSubmit.ToString());
                }
                if (dt.EndSubmit.ToString() != "")
                {
                    dateTimeEndSubmit.SelectedDate = DateTime.Parse(dt.EndSubmit.ToString());
                }
                //
                if (dt.StartScore.ToString() != "")
                {
                    dateTimeStartScore.SelectedDate = DateTime.Parse(dt.StartScore.ToString());
                }
                if (dt.EndScore.ToString() != "")
                {
                    dateTimeEndScore.SelectedDate = DateTime.Parse(dt.EndScore.ToString());
                }
                //
                if (dt.StartPublic.ToString() != "")
                {
                    dateTimeStartPublic.SelectedDate = DateTime.Parse(dt.StartPublic.ToString());
                }
                if (dt.EndPublic.ToString() != "")
                {
                    dateTimeEndPublic.SelectedDate = DateTime.Parse(dt.EndPublic.ToString());
                }
                //当存的不是不限时
                if (dt.LevelID.ToString() != "")
                {
                    //有小类
                    if (dt.LevelID.ToString() != "0")
                    {
                        BindOneWorksType(WorksType);

                        //加载作品类别
                        ddlOneWorksType.SelectedIndex = -1;
                        ddlOneWorksType.Items.FindByValue(dt.ParentID.ToString()).Selected = true;
                        BindTwoWorksType(WorksType, ddlOneWorksType.SelectedValue);
                        ddlTwoWorksType.SelectedIndex = -1;
                        ddlTwoWorksType.Items.FindByValue(dt.WorksTypeID.ToString()).Selected = true;
                    }
                    else
                    {
                        BindOneWorksType(WorksTypeDt);
                        //加载作品类别

                        ddlOneWorksType.SelectedIndex = -1;
                        ddlOneWorksType.Items.FindByValue(dt.WorksTypeID.ToString()).Selected = true;
                        BindTwoWorksType(WorksType, ddlOneWorksType.SelectedValue);
                        ddlTwoWorksType.SelectedIndex = -1;
                        ddlTwoWorksType.Items.FindByValue("0").Selected = true;
                    }
                }
                else
                {
                    BindOneWorksType(WorksTypeDt);
                    //加载作品类别
                    BindTwoWorksType(WorksTypeDt, ddlOneWorksType.SelectedValue);
                }
                hfID.Value = drv.Cells[0].Text;
                BindGvDate();
                SetControls(2);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnSave_Click(object sender, EventArgs e)
        {
            //验证时间
            if (JudgeTime())
            {
                btnSave.Visible = false;
                btnAdd.Visible  = true;
                Periods dr = WorksDt;
                dr.PeriodID    = long.Parse(hfID.Value);
                dr.PeriodTitle = txtName.Text;

                dr.Require  = txtRequire.Text;
                dr.CourseID = long.Parse(ViewState["CourseID"].ToString());
                //dr["Type"] = rblIsUrl.SelectedValue;
                //添加作品类别
                if (long.Parse(ddlTwoWorksType.SelectedValue) == 0)
                {
                    dr.WorksTypeID = int.Parse(ddlOneWorksType.SelectedValue);
                }
                else
                {
                    dr.WorksTypeID = int.Parse(ddlTwoWorksType.SelectedValue);
                }

                if (txtNum.Text != "")
                {
                    dr.Number = int.Parse(txtNum.Text);
                }

                if (!dateTimeStartSubmit.IsDateEmpty)
                {
                    dr.StartSubmit = dateTimeStartSubmit.SelectedDate;
                }
                if (!dateTimeEndSubmit.IsDateEmpty)
                {
                    dr.EndSubmit = dateTimeEndSubmit.SelectedDate;
                }

                if (!dateTimeStartScore.IsDateEmpty)
                {
                    dr.StartScore = dateTimeStartScore.SelectedDate;
                }

                if (!dateTimeEndScore.IsDateEmpty)
                {
                    dr.EndScore = dateTimeEndScore.SelectedDate;
                }

                if (!dateTimeStartPublic.IsDateEmpty)
                {
                    dr.StartPublic = dateTimeStartPublic.SelectedDate;
                }

                if (!dateTimeEndPublic.IsDateEmpty)
                {
                    dr.EndPublic = dateTimeEndPublic.SelectedDate;
                }
                //时间和人
                dr.CreatedBy = BLL.User.GetUserID(SPContext.Current.Web.CurrentUser);
                dr.Created   = DateTime.Now;
                dr.Flag      = 1;

                DAL.Periods.UpdatePeriodsByID(dr);
                BindGvDate();
                ClearDateTime(dateTimeStartSubmit);
                ClearDateTime(dateTimeEndSubmit);
                ClearDateTime(dateTimeStartScore);
                ClearDateTime(dateTimeEndScore);
                ClearDateTime(dateTimeStartPublic);
                ClearDateTime(dateTimeEndPublic);
                SetValue();
                SetControls(1);
                error.Text = "";
                // DAL.Common.ShowMessage(this.Page, this.GetType(), "保存成功!");
                Response.Redirect("pubContest.aspx");
                //Response.Redirect(DAL.Common.SPWeb.Url + "/_layouts/15/ContestWeb/pubContest.aspx");
            }
            else
            {
                error.Text = "请注意设置的提交、评分、公示的开放时间和截止时间为必填,开放时间必须早于截止时间!";
            }
        }