Beispiel #1
0
        /// <summary>
        ///更新记录
        /// </summary>
        /// <param name="Courseware"></param>
        /// <returns></returns>
        public bool GetUpdate(M_Courseware courseware)
        {
            string sqlStr = "UPDATE [dbo].[ZL_Courseware] SET [Courseware] = @Courseware,[CoursNum] = @CoursNum,[Listen] = @Listen,[UpdateTime] = @UpdateTime,[FileUrl] = @FileUrl,[CourseID] = @CourseID,[Speaker]=@Speaker,[SJName]=@SJName,[Status]=@Status,[Description]=@Description,[Classification]=@Classification,[CoursType]=@CoursType,[CreationTime]=@CreationTime WHERE [ID] = @ID";

            SqlParameter[] cmdParams = courseware.GetParameters();
            return(SqlHelper.ExecuteSql(sqlStr, cmdParams));
        }
Beispiel #2
0
        /// <summary>
        ///添加记录
        /// </summary>
        /// <param name="Courseware"></param>
        /// <returns></returns>
        public int GetInsert(M_Courseware courseware)
        {
            string sqlStr = "INSERT INTO [dbo].[ZL_Courseware] ([Courseware],[CoursNum],[Listen],[UpdateTime],[FileUrl],[CourseID],[Speaker],[SJName],[Status],[Description],[Classification],[CoursType],[CreationTime]) VALUES (@Courseware,@CoursNum,@Listen,@UpdateTime,@FileUrl,@CourseID,@Speaker,@SJName,@Status,@Description,@Classification,@CoursType,@CreationTime);select @@IDENTITY";

            SqlParameter[] cmdParams = courseware.GetParameters();
            return(SqlHelper.ObjectToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sqlStr, cmdParams)));
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            int          id = DataConverter.CLng(coureId.Value);
            M_Courseware mc = bcourse.GetSelect(id);

            mc.Courseware   = this.txt_Courename.Text;
            mc.Speaker      = this.TextBox1.Text;
            mc.SJName       = this.TextBox2.Text;
            mc.CoursNum     = DataConverter.CLng(this.txt_Order.Text);
            mc.CoursType    = DataConverter.CLng(this.RadioButtonList1.SelectedValue);
            mc.Status       = DataConverter.CLng(this.RadioButtonList2.SelectedValue);
            mc.Listen       = DataConverter.CLng(this.rblHot.SelectedValue);
            mc.Description  = this.txtP_Content.Text;
            mc.FileUrl      = this.txtUrl.Text;
            mc.UpdateTime   = DateTime.Now;
            mc.CreationTime = DateTime.Now;
            if (mc != null && mc.ID > 0)
            {
                bool result = bcourse.GetUpdate(mc);
                if (result)
                {
                    function.WriteSuccessMsg("修改成功!");
                }
                else
                {
                    function.WriteErrMsg("修改失败!");
                }
            }
        }
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            int          id = DataConverter.CLng(coureId.Value);
            M_Courseware mc = bcourw.GetSelect(id);

            mc.Courseware   = this.txt_Courename.Text;
            mc.Speaker      = this.TextBox1.Text;
            mc.SJName       = this.TextBox2.Text;
            mc.CoursNum     = DataConverter.CLng(this.txt_Order.Text);
            mc.CoursType    = DataConverter.CLng(this.RadioButtonList1.SelectedValue);
            mc.Status       = DataConverter.CLng(this.RadioButtonList2.SelectedValue);
            mc.Listen       = rblHot.Checked ? 1 : 0;
            mc.Description  = this.txtP_Content.Text;
            mc.FileUrl      = this.txtUrl.Text;
            mc.UpdateTime   = DateTime.Now;
            mc.CourseID     = DataConverter.CLng(cid.Value);
            mc.CreationTime = DateTime.Now;
            if (mc != null && mc.ID > 0)
            {
                bool result = bcourw.GetUpdate(mc);
                if (result)
                {
                    function.WriteSuccessMsg("修改成功!");
                }
                else
                {
                    function.WriteErrMsg("修改失败!");
                }
            }
            else
            {
                int ids = bcourw.GetInsert(mc);
                if (ids > 0)
                {
                    function.WriteSuccessMsg("添加成功!");
                }
                else
                {
                    function.WriteErrMsg("添加失败!");
                }
            }
            int Course = DataConverter.CLng(Request.QueryString["CourseID"]);

            MyBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     liCoures.Text = "添加课件";
     cid.Value     = Course.ToString();
     if (!string.IsNullOrEmpty(Request.QueryString["menu"]) && Request.QueryString["menu"] == "del")
     {
         int cids = DataConverter.CLng(Request.QueryString["id"]);
         bcourw.DeleteByGroupID(cids);
     }
     if (!IsPostBack)
     {
         int id = DataConverter.CLng(Request.QueryString["ID"]);
         coureId.Value = id.ToString();
         M_Courseware mcs = bcourw.GetSelect(id);
         if (mcs != null && mcs.ID > 0)
         {
             liCoures.Text                       = "添加课件";
             this.txt_Courename.Text             = mcs.Courseware;
             this.TextBox1.Text                  = mcs.Speaker;
             this.TextBox2.Text                  = mcs.SJName;
             this.txt_Order.Text                 = (mcs.CoursNum).ToString();
             this.RadioButtonList1.SelectedValue = mcs.CoursType.ToString();
             this.RadioButtonList2.SelectedValue = mcs.Status.ToString();
             this.rblHot.Checked                 = mcs.Listen == 1 ? true : false;
             this.txtP_Content.Text              = mcs.Description;
             this.txtUrl.Text                    = mcs.FileUrl;
         }
         else
         {
             this.txt_Courename.Text             = "";
             this.TextBox1.Text                  = "";
             this.TextBox2.Text                  = "";
             this.txt_Order.Text                 = "";
             this.RadioButtonList1.SelectedValue = "";
             this.RadioButtonList2.SelectedValue = "";
             this.rblHot.Checked                 = false;
             this.txtP_Content.Text              = "";
             this.txtUrl.Text = "";
         }
         MyBind();
         Call.SetBreadCrumb(Master, "<li>教育模块</li><li><a href='QuestionManage.aspx'>在线考试系统</a></li><li>课程管理</li><li><a href='AddCourseware.aspx?CourseID=" + Request.QueryString["CourseID"] + "'>" + liCoures.Text + "</a></li>");
     }
 }
Beispiel #6
0
        private static M_Courseware GetInfoFromReader(SqlDataReader rdr)
        {
            M_Courseware info = new M_Courseware();

            info.ID             = DataConverter.CLng(rdr["ID"].ToString());
            info.Courseware     = rdr["Courseware"].ToString();
            info.CoursNum       = DataConverter.CLng(rdr["CoursNum"].ToString());
            info.Listen         = DataConverter.CLng(rdr["Listen"].ToString());
            info.UpdateTime     = DataConverter.CDate(rdr["UpdateTime"].ToString());
            info.FileUrl        = rdr["FileUrl"].ToString();
            info.CourseID       = DataConverter.CLng(rdr["CourseID"].ToString());
            info.Speaker        = rdr["Speaker"].ToString();
            info.SJName         = rdr["SJName"].ToString();
            info.Status         = DataConverter.CLng(rdr["Status"].ToString());
            info.Description    = rdr["Description"].ToString();
            info.Classification = rdr["Classification"].ToString();
            info.CoursType      = DataConverter.CLng(rdr["CoursType"].ToString());
            info.CreationTime   = DataConverter.CDate(rdr["CreationTime"].ToString());
            rdr.Close();
            rdr.Dispose();
            return(info);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int id = DataConverter.CLng(Request.QueryString["ID"]);
         coureId.Value = id.ToString();
         M_Courseware mcs = bcourse.GetSelect(id);
         if (mcs != null && mcs.ID > 0)
         {
             this.txt_Courename.Text             = mcs.Courseware;
             this.TextBox1.Text                  = mcs.Speaker;
             this.TextBox2.Text                  = mcs.SJName;
             this.txt_Order.Text                 = (mcs.CoursNum).ToString();
             this.RadioButtonList1.SelectedValue = mcs.CoursType.ToString();
             this.RadioButtonList2.SelectedValue = mcs.Status.ToString();
             this.rblHot.SelectedValue           = mcs.Listen.ToString();
             this.txtP_Content.Text              = mcs.Description;
             this.txtUrl.Text = mcs.FileUrl;
         }
     }
     Call.SetBreadCrumb(Master, "<li>教育模块</li><li><a href='QuestionManage.aspx'>在线考试系统</a></li><li>修改试听文件</li>");
 }