コード例 #1
0
        protected void DataBinds(int ID)
        {
            LabMS.BLL.CourseOutLine couOutLin = new LabMS.BLL.CourseOutLine();
            LabMS.Model.CourseOutLine couOutLinModel = new LabMS.Model.CourseOutLine();

            couOutLinModel = couOutLin.GetModel(ID);
            try
            {
                tb_Submitter.Text = couOutLinModel.COutLine_Submiter;
                tb_Time.Text = string.Format("{0:d}", couOutLinModel.COutLine_SubmitTime);
                tb_CourseName.Text = couOutLinModel.COutLine_Course;
                tb_CourseCode.Text = couOutLinModel.COutLine_CourseCode;
                tb_KeyWord.Text = couOutLinModel.COutLine_KeyWord;
                tb_Content.Text = couOutLinModel.COutLine_Content.Replace("\r\n", "<br/>");
                tb_CourseID.Text = couOutLinModel.COutLine_CourseID.ToString();
                AttachID.Value = couOutLinModel.COutLine_Attach.ToString();
                if (couOutLinModel.COutLine_Attach == null)
                {
                    a1.Visible = false;
                    AttachmentName.Visible = false;
                    IsDelCB.Checked = true;
                    fp_Attachment.Attributes.Add("style", "display:block");
                }
                else
                {
                    AttachmentName.Text = GetAttachName(int.Parse(couOutLinModel.COutLine_Attach.ToString()));
                }
            }
            catch
            {
                ERRLbl.Text = "系统异常,参数不合法!";
                ERRLbl.Visible = true;
                ModifyBtn.Visible = false;
            }
        }
コード例 #2
0
        protected void BindData(int ID)
        {
            LabMS.BLL.CourseOutLine couOutLin = new LabMS.BLL.CourseOutLine();
            List<LabMS.Model.CourseOutLine> couOutLinModel = new List<LabMS.Model.CourseOutLine>();

            string strWhere = " COutLine_CourseID=" + ID;
            couOutLinModel = couOutLin.GetModelList(strWhere);
            try
            {
                CouOutLinIDHF.Value = couOutLinModel[0].ID.ToString();
                tb_Submitter.Text = couOutLinModel[0].COutLine_Submiter;
                tb_Time.Text = string.Format("{0:d}", couOutLinModel[0].COutLine_SubmitTime);
                tb_CourseName.Text = couOutLinModel[0].COutLine_Course;
                tb_CourseCode.Text = couOutLinModel[0].COutLine_CourseCode;
                tb_KeyWord.Text = couOutLinModel[0].COutLine_KeyWord;
                tb_Content.Text = couOutLinModel[0].COutLine_Content.Replace("\r\n", "<br/>");

                if (couOutLinModel[0].COutLine_Attach == null)
                {
                    a1.Attributes.Remove("onclick");
                    AttachmentName = "无附件";
                }
                else
                {
                    AttachID.Value = couOutLinModel[0].COutLine_Attach.ToString();
                    AttachmentName = GetAttachName(int.Parse(couOutLinModel[0].COutLine_Attach.ToString()));
                }
            }
            catch
            {
                ERRLbl.Text = "系统异常,参数不合法!";
                ERRLbl.Visible=true;
                modifybtn.Visible = false;
            }
        }
コード例 #3
0
        protected void Modify_Click(object sender, EventArgs e)
        {
            #region 验证
            if (tb_KeyWord.Text.Equals(""))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "关键字不能为空!");
                return;
            }
            if (tb_Content.Text.Equals(""))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "大纲内容不能为空!");
                return;
            }
            #endregion
            LabMS.BLL.CourseOutLine OutLine = new LabMS.BLL.CourseOutLine();
            LabMS.Model.CourseOutLine model = new LabMS.Model.CourseOutLine();
            model.COutLine_Submiter = tb_Submitter.Text;
            model.COutLine_SubmitTime = DateTime.Parse(tb_Time.Text.Trim());
            model.COutLine_KeyWord = tb_KeyWord.Text.Trim();
            model.COutLine_CourseID = Convert.ToInt32(tb_CourseID.Text.Trim());
            model.COutLine_Course = tb_CourseName.Text;
            model.COutLine_CourseCode = tb_CourseCode.Text;
            model.COutLine_Content = tb_Content.Text;

            if (IsDelCB.Checked)
            {
                int AttachIDTemp=UpLoadFile();
                if (AttachIDTemp == 0 || AttachIDTemp == -1)
                {
                    return;
                }
                else
                {
                    model.COutLine_Attach = AttachIDTemp;
                }
            }
            else
            {
                model.COutLine_Attach = int.Parse(AttachID.Value);
            }
            model.ID = int.Parse(CouOutLinID.Value);
            OutLine.Update(model);
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", "<script type='text/javascript'>alert('更新成功!');window.location.href='CourseOutLinePreview.aspx"+model.ID+"';</script>");
        }
コード例 #4
0
 protected bool GetVisiblityType(object value)
 {
     if (value != null)
     {
         int CoureseID=0;
         if (int.TryParse(value.ToString(), out CoureseID))
         {
             if (CoureseID != 0)
             {
                 LabMS.BLL.CourseOutLine CourseOutLine = new LabMS.BLL.CourseOutLine();
                 LabMS.Model.CourseOutLine model = CourseOutLine.GetModel(CoureseID);
                 if (model != null)
                 {
                     if (model.COutLine_Attach != null)
                     {
                         return true;
                     }
                     else
                     {
                         return false;
                     }
                 }
             }
         }
     }
     return false;
 }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("KCXYM");
            strPageUserType.Add("mana");

            if (Request.QueryString["ID"] == null)
            {

                Common.JShelper.JSAlert(Page, "err", "��������!");
                return;
            }
            int CourseID = 0;
            if (int.TryParse(Request.QueryString["ID"].Trim(), out CourseID))
            {
                hf_QueryString.Value = CourseID.ToString();
            }
            else
            {
                Common.JShelper.JSAlert(Page, "err", "��������!");
                return;
            }

            LabMS.BLL.CourseOutLine courseoutline = new LabMS.BLL.CourseOutLine();
            List<LabMS.Model.CourseOutLine> course = new List<LabMS.Model.CourseOutLine>();
            string strWhere = " COutLine_CourseID=" + CourseID;
            course = courseoutline.GetModelList(strWhere);
            int courseOutLineCount = course.Count;
            if (!Page.IsPostBack)
            {
                DataBinds(CourseID);
                tbID.Value = CourseID.ToString();
                if (courseOutLineCount != 0)
                {
                    btPreviewCourseOutLine.Visible = true;
                }
                else
                {
                    btAddCourseOutLine.Visible = true;
                }
            }
        }
コード例 #6
0
        protected void Save_Click(object sender, EventArgs e)
        {
            LabMS.BLL.CourseOutLine OutLine = new LabMS.BLL.CourseOutLine();
            List<LabMS.Model.CourseOutLine> outlinelist = new List<LabMS.Model.CourseOutLine>();
            LabMS.Model.CourseOutLine model = new LabMS.Model.CourseOutLine();

            #region ��֤

            int TempID=0;
            if (!int.TryParse(tb_CourseID.Text, out TempID))
            {
                if (TempID <= 0)
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('ϵͳ�쳣');window.location.href='../ClassPlan/ProjectCourseList.aspx';</script>");
                }
            }
            int CourseID = TempID;

            if (tb_CourseID.Text.Equals(""))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "�γ����Ʋ���Ϊ��!");
                return;
            }
            if (tb_KeyWord.Text.Equals(""))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "�ؼ��ֲ���Ϊ��!");
                return;
            }
            if (tb_Content.Text.Equals(""))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "������ݲ���Ϊ��!");
                return;
            }
            string strWhere = " COutLine_CourseID=" + CourseID;
            outlinelist = OutLine.GetModelList(strWhere);
            if (outlinelist.Count != 0)
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "��ѡ�γ��Ѵ��ڴ��!");
                return;
            }
            if (string.IsNullOrEmpty(tb_Submitter.Text))
            {
                LabMS.Common.JShelper.JSAlert(Page, "error", "�����Ϊ�գ�����ϵ����Ա");
                return;
            }
            #endregion

            model.COutLine_Submiter = tb_Submitter.Text;
            model.COutLine_SubmitTime = DateTime.Now;
            model.COutLine_KeyWord = tb_KeyWord.Text.Trim();
            model.COutLine_CourseID = CourseID;
            model.COutLine_Course = tb_CourseName.Text;
            model.COutLine_CourseCode = tb_CourseCode.Text;
            model.COutLine_Content = tb_Content.Text;
            int AttachIDTemp = UpLoadFile();

            if (AttachIDTemp > 0)
            {
                model.COutLine_Attach = UpLoadFile();
            }
            try
            {
                OutLine.Add(model);
            }
            catch
            {
                LabMS.Common.JShelper.JSAlert(Page, "AddFailed", "���ʧ��!");
                return;
            }
            LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "��ӳɹ�!", "../../ClassPlan/ProjectCourseList.aspx");
        }