Example #1
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.txtName.Text))
     {
         MessageBox.ShowFailTip(this, Poll.ErrorOptionsNotNull);
     }
     else
     {
         string text = this.txtName.Text;
         int num = int.Parse(this.lblTopicID.Text);
         int num2 = this.chkisChecked.Checked ? 1 : 0;
         Maticsoft.Model.Poll.Options model = new Maticsoft.Model.Poll.Options {
             Name = text,
             TopicID = new int?(num),
             isChecked = new int?(num2),
             SubmitNum = 0
         };
         if (this.blloption.Exists(num, text))
         {
             MessageBox.ShowFailTip(this, Poll.ErrorOptionsExists);
         }
         else
         {
             this.blloption.Add(model);
             this.Session["strWhereOptions"] = " TopicID= " + this.lblTopicID.Text;
             this.gridView.OnBind();
         }
     }
 }
Example #2
0
 public Maticsoft.Model.Poll.Options GetModel(int ID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select  top 1 ID,Name,TopicID,isChecked,SubmitNum from Poll_Options ");
     builder.Append(" where ID=@ID ");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Int, 4) };
     cmdParms[0].Value = ID;
     Maticsoft.Model.Poll.Options options = new Maticsoft.Model.Poll.Options();
     DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if (set.Tables[0].Rows[0]["ID"].ToString() != "")
     {
         options.ID = int.Parse(set.Tables[0].Rows[0]["ID"].ToString());
     }
     options.Name = set.Tables[0].Rows[0]["Name"].ToString();
     if (set.Tables[0].Rows[0]["TopicID"].ToString() != "")
     {
         options.TopicID = new int?(int.Parse(set.Tables[0].Rows[0]["TopicID"].ToString()));
     }
     if (set.Tables[0].Rows[0]["isChecked"].ToString() != "")
     {
         options.isChecked = new int?(int.Parse(set.Tables[0].Rows[0]["isChecked"].ToString()));
     }
     if (set.Tables[0].Rows[0]["SubmitNum"].ToString() != "")
     {
         options.SubmitNum = new int?(int.Parse(set.Tables[0].Rows[0]["SubmitNum"].ToString()));
     }
     return options;
 }