/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSubmit_Click(object sender, EventArgs e) { #region Validation if (string.IsNullOrEmpty(PlateTitle.Text.Trim())) { WriteBackScript("alert('���������ⲻ��Ϊ��!')"); return; } if (PlateDescripttion.Text.Length > 500) { WriteBackScript("alert('�������������Ȳ��ܳ���500�ַ�!')"); return; } #endregion LabMS.BLL.PostPlate bll = new LabMS.BLL.PostPlate(); LabMS.Model.PostPlate plate = new LabMS.Model.PostPlate(); plate.Description = PlateDescripttion.Text; plate.Name = PlateTitle.Text; if (SectionList.Visible != false) { plate.ParentID = int.Parse(SectionList.SelectedValue); plate.ID = bll.Add(plate); WriteBackScript("alert('��Ӱ��ɹ�!');window.location.href='Index.aspx';"); } else { plate.ParentID = int.Parse(Request.QueryString["sectionID"]); plate.ID = bll.Add(plate); WriteBackScript("alert('��Ӱ��ɹ�!');window.returnValue=true;window.close();"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int id = 0; if (string.IsNullOrEmpty(Request.QueryString["id"])) { WriteBackScript("alert('指定版块分区不存在');window.location.href='Index.aspx';"); return; } if (!int.TryParse(Request.QueryString["id"], out id)) { WriteBackScript("alert('指定版块分区不存在');window.location.href='Index.aspx';"); return; } ExtendBLL.PostPlate pp = new ExtendBLL.PostPlate(); ppInfo = pp.GetModel(id); if (ppInfo == null) { WriteBackScript("alert('指定版块分区不存在');window.location.href='Index.aspx';"); return; } dsPlates = pp.GetSubPlates(id, true); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSubmit_Click(object sender, EventArgs e) { #region Validation if (string.IsNullOrEmpty(SectionTitle.Text.Trim())) { WriteBackScript("alert('���������ⲻ��Ϊ��!')"); return; } if (SectionDescripttion.Text.Length > 500) { WriteBackScript("alert('�������������Ȳ��ܳ���500�ַ�!')"); return; } #endregion LabMS.BLL.PostPlate bll = new LabMS.BLL.PostPlate(); LabMS.Model.PostPlate plate = new LabMS.Model.PostPlate(); plate.Description = SectionDescripttion.Text; plate.Name = SectionTitle.Text; plate.ParentID = 1; plate.ID = bll.Add(plate); WriteBackScript("alert('��ӷ����ɹ�!');window.returnValue=true;window.close();"); }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public LabMS.Model.PostPlate GetModel(int ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 [ID],ParentID,Name,Description from PostPlate "); strSql.Append(" where [ID]=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4)}; parameters[0].Value = ID; LabMS.Model.PostPlate model=new LabMS.Model.PostPlate(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { if(ds.Tables[0].Rows[0]["ID"].ToString()!="") { model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } if(ds.Tables[0].Rows[0]["ParentID"].ToString()!="") { model.ParentID=int.Parse(ds.Tables[0].Rows[0]["ParentID"].ToString()); } model.Name=ds.Tables[0].Rows[0]["Name"].ToString(); model.Description=ds.Tables[0].Rows[0]["Description"].ToString(); return model; } else { return null; } }