Пример #1
0
        protected void btnNext_Click(object sender, EventArgs e)
        {
            if (txtContent.Text.Length > 200)
            {
                Response.Write("<script>alert('内容简介不能超过200个汉字!');</script>");
                return;
            }

            if (txtMemo.Text.Length > 50)
            {
                Response.Write("<script>alert('备注不能超过50个汉字!');</script>");
                return;
            }

            TrainPlanBLL objTrainPlanBll = new TrainPlanBLL();

            RailExam.Model.TrainPlan objTrainPlan = new RailExam.Model.TrainPlan();

            string strID = Request.QueryString.Get("id");

            if (strID != null && strID != "")
            {
                objTrainPlan.TrainPlanID  = Convert.ToInt32(strID);
                objTrainPlan.TrainName    = txtPlanName.Text;
                objTrainPlan.TrainContent = txtContent.Text;
                objTrainPlan.BeginDate    = DateTime.Parse(txtBegin.Text);
                objTrainPlan.EndDate      = DateTime.Parse(txtEnd.Text);
                objTrainPlan.HasExam      = chkExam.Checked;
                objTrainPlan.ExamForm     = txtExam.Text;
                objTrainPlan.StatusID     = Convert.ToInt32(ddlStatus.SelectedValue);
                objTrainPlan.Memo         = txtMemo.Text;

                objTrainPlanBll.UpdateTrainPlan(objTrainPlan);
            }
            else
            {
                objTrainPlan.TrainName    = txtPlanName.Text;
                objTrainPlan.TrainContent = txtContent.Text;
                objTrainPlan.BeginDate    = DateTime.Parse(txtBegin.Text);
                objTrainPlan.EndDate      = DateTime.Parse(txtEnd.Text);
                objTrainPlan.HasExam      = chkExam.Checked;
                objTrainPlan.ExamForm     = txtExam.Text;
                objTrainPlan.StatusID     = 1;
                objTrainPlan.Memo         = txtMemo.Text;

                objTrainPlanBll.AddTrainPlan(objTrainPlan);
            }

            Response.Redirect("TrainPlanCourse.aspx?PlanID=" + objTrainPlan.TrainPlanID + "&PlanName=" + objTrainPlan.TrainName);
        }
Пример #2
0
        private void GetPlanInfo(string strID)
        {
            TrainPlanBLL objTrainPlanBll = new TrainPlanBLL();

            RailExam.Model.TrainPlan objTrainPlan = objTrainPlanBll.GetTrainPlanInfo(Convert.ToInt32(strID));

            txtPlanName.Text        = objTrainPlan.TrainName;
            txtContent.Text         = objTrainPlan.TrainContent;
            txtBegin.Text           = objTrainPlan.BeginDate.ToString("yyyy-MM-dd");
            txtEnd.Text             = objTrainPlan.EndDate.ToString("yyy-MM-dd");
            chkExam.Checked         = objTrainPlan.HasExam;
            txtExam.Text            = objTrainPlan.ExamForm;
            ddlStatus.SelectedValue = objTrainPlan.StatusID.ToString();
            txtMemo.Text            = objTrainPlan.Memo;
        }