/// <summary> ///绑定列表 /// </summary> private void BindResult() { //组合查询条件 string strSqlWhere = string.Empty; if (this.txtCXNR.Text != "") { strSqlWhere += " and STBMC like '%" + this.txtCXNR.Text.Trim() + "%'"; } if (this.txtDY.Text != "") { strSqlWhere += " and STF > " + this.txtDY.Text.Trim() + ""; } if (this.txtXY.Text != "") { strSqlWhere += " and STF <= " + this.txtXY.Text.Trim() + ""; } T_STB modelList = new T_STB(); DataTable dt = modelList.GetListINFO(strSqlWhere).Tables[0]; if (dt != null) { this.gvData.DataKeyNames = new string[] { "STBID" }; this.gvData.DataSource = dt; this.gvData.DataBind(); ShowStats(dt.Rows.Count.ToString()); } }
/// <summary> /// 绑定社团信息 /// </summary> /// <param name="STBID"></param> private void ShowInfo(int STBID) { T_STB model = new T_STB(); model = model.GetModel(STBID); if (model != null) { this.txtSTBMC.Text = model.STBMC; this.txtSTF.Text = model.STF.ToString(); } }
/// <summary> /// 社团绑定 /// </summary> private void STXX() { T_STB modelList = new T_STB(); DataTable dt = modelList.GetList("").Tables[0]; if (dt != null && dt.Rows.Count > 0) { this.ddlST.DataTextField = "STBMC"; this.ddlST.DataValueField = "STBID"; this.ddlST.DataSource = dt; this.ddlST.DataBind(); this.ddlST.Items.Insert(0, ""); } }
/// <summary> /// 显示信息 /// </summary> /// <param name="STBID"></param> private void ShowInfo(int STBID) { T_STB model = new T_STB(); model = model.GetModel(STBID); if (model != null) { this.lblSTBMC.Text = model.STBMC; this.lblBZID.Text = model.BZID.ToString(); this.lblCYRS.Text = model.CYRS.ToString(); this.lblMOBILE.Text = model.MOBILE; this.lblSTZN.Text = model.STZN; this.lblBZ.Text = model.BZ; this.lblSTF.Text = model.STF.ToString(); } }
/// <summary> /// 绑定社团信息 /// </summary> /// <param name="STBID"></param> private void ShowInfo(int STBID) { T_STB model = new T_STB(); model = model.GetModel(STBID); if (model != null) { this.txtSTBMC.Text = model.STBMC; if (model.BZID != null) { this.ddlBZ.SelectedValue = model.BZID.ToString(); } this.txtCYRS.Text = model.CYRS.ToString(); this.txtMOBILE.Text = model.MOBILE; this.txtSTZN.Text = model.STZN; this.txtBZ.Text = model.BZ; this.txtSTF.Text = model.STF.ToString(); } }
/// <summary> /// 编辑社团 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { T_STB model = new T_STB(); int STF = 0; if (this.txtSTF.Text != "") { STF = int.Parse(this.txtSTF.Text); } model.STF = STF; if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { //修改 model.STBID = Convert.ToInt32(Request.Params["id"]); if (model.Update(model) <= 0) { ResponseMessage(this, "修改失败、请检查输入是否正确!"); return; } } Response.Redirect("HFXXXG.aspx"); }
/// <summary> /// 单击行事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e) { int num = int.Parse(e.CommandArgument.ToString()); if (e.CommandName == "Sel") { string strUrl = "STEdit.aspx?id=" + gvData.DataKeys[num]["STBID"].ToString(); PageBase.OpenWebForm(strUrl); } else if (e.CommandName == "Del") { //删除记录 string strKey = gvData.DataKeys[num]["STBID"].ToString(); T_STB model = new T_STB(); if (model.Delete(int.Parse(strKey)) <= 0) { ResponseMessage(this.Page, "删除失败,请重试!"); return; } BindResult(); } }
/// <summary> /// 编辑社团 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (this.txtSTBMC.Text == "") { ResponseMessage(this, "社团名称不能为空! "); return; } if (this.txtSTF.Text != "") { if (!IsPlusInt(this.txtSTF.Text)) { ResponseMessage(this, "社团费用类型错误!"); return; } } T_STB model = new T_STB(); string STBMC = this.txtSTBMC.Text; int BZID = 0; if (this.ddlBZ.SelectedValue != "") { BZID = int.Parse(this.ddlBZ.SelectedValue); } int CYRS = 0; if (this.txtCYRS.Text != "") { CYRS = int.Parse(this.txtCYRS.Text); } string MOBILE = this.txtMOBILE.Text; string STZN = this.txtSTZN.Text; string BZ = this.txtBZ.Text; int STF = 0; if (this.txtSTF.Text != "") { STF = int.Parse(this.txtSTF.Text); } model.STBMC = STBMC; model.BZID = BZID; model.CYRS = CYRS; model.MOBILE = MOBILE; model.STZN = STZN; model.BZ = BZ; model.STF = STF; if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { //修改 model.STBID = Convert.ToInt32(Request.Params["id"]); if (model.Update(model) <= 0) { ResponseMessage(this, "修改失败、请检查输入是否正确!"); return; } } else { if (model.ExistsBYNAME(this.txtSTBMC.Text)) { ResponseMessage(this, "社团重名!"); return; } //添加 if (model.Add(model) <= 0) { ResponseMessage(this, "添加社团失败!"); return; } } if (Request.Params["t"] != null) { Response.Redirect("~/XXXG/STXXXG.aspx"); } else { Response.Redirect("STGL.aspx"); } }