protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.txtName.Text)) { MessageBox.ShowFailTip(this, Poll.ErrorFormsNameNull); } else if (string.IsNullOrWhiteSpace(this.txtDescription.Text)) { MessageBox.ShowFailTip(this, Poll.ErrorFormsExplainNull); } else { string text = this.txtName.Text; string str2 = this.txtDescription.Text; Maticsoft.Model.Poll.Forms model = new Maticsoft.Model.Poll.Forms { Name = text, Description = str2 }; int num = new Maticsoft.BLL.Poll.Forms().Add(model); if (num > 0) { base.Response.Redirect("../Topics/Index.aspx?fid=" + num.ToString()); } else { MessageBox.ShowFailTip(this, "保存失败!"); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.txtName.Text)) { MessageBox.ShowFailTip(this, Poll.ErrorFormsNameNull); } else if (string.IsNullOrWhiteSpace(this.txtDescription.Text)) { MessageBox.ShowFailTip(this, Poll.ErrorFormsExplainNull); } else { string text = this.txtName.Text; string str2 = this.txtDescription.Text; Maticsoft.Model.Poll.Forms model = new Maticsoft.Model.Poll.Forms { Name = text, Description = str2, IsActive = this.chkIsActive.Checked }; Maticsoft.BLL.Poll.Forms forms2 = new Maticsoft.BLL.Poll.Forms(); if (forms2.Add(model) > 0) { MessageBox.ShowSuccessTip(this, Site.TooltipAddSuccess); } else { MessageBox.ShowFailTip(this, Site.TooltipSaveError); } this.gridView.OnBind(); } }
public List<Maticsoft.Model.Poll.Forms> GetModelList(string strWhere) { DataSet set = this.dal.GetList(strWhere); List<Maticsoft.Model.Poll.Forms> list = new List<Maticsoft.Model.Poll.Forms>(); int count = set.Tables[0].Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Maticsoft.Model.Poll.Forms item = new Maticsoft.Model.Poll.Forms(); if (set.Tables[0].Rows[i]["FormID"].ToString() != "") { item.FormID = int.Parse(set.Tables[0].Rows[i]["FormID"].ToString()); } item.Name = set.Tables[0].Rows[i]["Name"].ToString(); item.Description = set.Tables[0].Rows[i]["Description"].ToString(); if ((set.Tables[0].Rows[0]["IsActive"] != null) && (set.Tables[0].Rows[0]["IsActive"].ToString() != "")) { if ((set.Tables[0].Rows[0]["IsActive"].ToString() == "1") || (set.Tables[0].Rows[0]["IsActive"].ToString().ToLower() == "true")) { item.IsActive = true; } else { item.IsActive = false; } } list.Add(item); } } return list; }
protected void btnAdd_Click(object sender, EventArgs e) { this.btnAdd.Enabled = false; this.btnCancle.Enabled = false; if (string.IsNullOrWhiteSpace(this.txtName.Text)) { this.btnAdd.Enabled = true; this.btnCancle.Enabled = true; MessageBox.ShowFailTip(this, Poll.ErrorFormsNameNull); } else if (string.IsNullOrWhiteSpace(this.txtDescription.Text)) { this.btnAdd.Enabled = true; this.btnCancle.Enabled = true; MessageBox.ShowFailTip(this, Poll.ErrorFormsExplainNull); } else { string text = this.txtName.Text; string str2 = this.txtDescription.Text; Maticsoft.Model.Poll.Forms model = new Maticsoft.Model.Poll.Forms { Name = text, Description = str2, FormID = this.Fid, IsActive = this.chkIsActive.Checked }; if (this.bll.Update(model) > 0) { MessageBox.ShowSuccessTip(this, "保存成功!", "index.aspx"); } else { this.btnAdd.Enabled = true; this.btnCancle.Enabled = true; MessageBox.ShowFailTip(this, "保存失败!"); } } }
public Maticsoft.Model.Poll.Forms GetModel(int FormID) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 * from Poll_Forms "); builder.Append(" where FormID=@FormID "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@FormID", SqlDbType.Int, 4) }; cmdParms[0].Value = FormID; Maticsoft.Model.Poll.Forms forms = new Maticsoft.Model.Poll.Forms(); DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms); if (set.Tables[0].Rows.Count <= 0) { return null; } if (set.Tables[0].Rows[0]["FormID"].ToString() != "") { forms.FormID = int.Parse(set.Tables[0].Rows[0]["FormID"].ToString()); } forms.Name = set.Tables[0].Rows[0]["Name"].ToString(); forms.Description = set.Tables[0].Rows[0]["Description"].ToString(); if ((set.Tables[0].Rows[0]["IsActive"] != null) && (set.Tables[0].Rows[0]["IsActive"].ToString() != "")) { if ((set.Tables[0].Rows[0]["IsActive"].ToString() == "1") || (set.Tables[0].Rows[0]["IsActive"].ToString().ToLower() == "true")) { forms.IsActive = true; return forms; } forms.IsActive = false; } return forms; }