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; } }
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; } } }
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"); }