Ejemplo n.º 1
0
 public List<Maticsoft.Model.Poll.Topics> GetModelList(string strWhere)
 {
     DataSet set = this.dal.GetList(strWhere);
     List<Maticsoft.Model.Poll.Topics> list = new List<Maticsoft.Model.Poll.Topics>();
     int count = set.Tables[0].Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Poll.Topics item = new Maticsoft.Model.Poll.Topics();
             if (set.Tables[0].Rows[i]["ID"].ToString() != "")
             {
                 item.ID = int.Parse(set.Tables[0].Rows[i]["ID"].ToString());
             }
             item.Title = set.Tables[0].Rows[i]["Title"].ToString();
             if (set.Tables[0].Rows[i]["Type"].ToString() != "")
             {
                 item.Type = new int?(int.Parse(set.Tables[0].Rows[i]["Type"].ToString()));
             }
             if (set.Tables[0].Rows[i]["FormID"].ToString() != "")
             {
                 item.FormID = new int?(int.Parse(set.Tables[0].Rows[i]["FormID"].ToString()));
             }
             if (set.Tables[0].Rows[i]["RowNum"].ToString() != "")
             {
                 item.RowNum = int.Parse(set.Tables[0].Rows[i]["RowNum"].ToString());
             }
             list.Add(item);
         }
     }
     return list;
 }
Ejemplo n.º 2
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     string text = this.txtTitle.Text;
     int num = int.Parse(this.radbtnType.SelectedValue);
     int num2 = int.Parse(this.lblFormID.Text);
     Maticsoft.Model.Poll.Topics model = new Maticsoft.Model.Poll.Topics {
         Title = text,
         Type = new int?(num),
         FormID = new int?(num2)
     };
     Maticsoft.BLL.Poll.Topics topics2 = new Maticsoft.BLL.Poll.Topics();
     if (topics2.Exists(num2, text))
     {
         MessageBox.ShowFailTip(this, Poll.ErrorTopicExists);
     }
     else
     {
         if (topics2.Add(model) > 0)
         {
             MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
         }
         else
         {
             MessageBox.ShowFailTip(this, Site.TooltipSaveError);
         }
         this.Session["strWhereTopics"] = " FormID= " + this.lblFormID.Text;
         this.gridView.OnBind();
     }
 }
Ejemplo n.º 3
0
 public Maticsoft.Model.Poll.Topics GetModel(int ID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select  top 1 ID,Title,Type,FormID from Poll_Topics ");
     builder.Append(" where ID=@ID ");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Int, 4) };
     cmdParms[0].Value = ID;
     Maticsoft.Model.Poll.Topics topics = new Maticsoft.Model.Poll.Topics();
     DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if (set.Tables[0].Rows[0]["ID"].ToString() != "")
     {
         topics.ID = int.Parse(set.Tables[0].Rows[0]["ID"].ToString());
     }
     topics.Title = set.Tables[0].Rows[0]["Title"].ToString();
     if (set.Tables[0].Rows[0]["Type"].ToString() != "")
     {
         topics.Type = new int?(int.Parse(set.Tables[0].Rows[0]["Type"].ToString()));
     }
     if (set.Tables[0].Rows[0]["FormID"].ToString() != "")
     {
         topics.FormID = new int?(int.Parse(set.Tables[0].Rows[0]["FormID"].ToString()));
     }
     return topics;
 }
Ejemplo n.º 4
0
 public List<Maticsoft.Model.Poll.Topics> GetModelList(int Top, int formid)
 {
     Maticsoft.Model.Poll.Forms modelByCache = new Maticsoft.BLL.Poll.Forms().GetModelByCache(formid);
     if ((modelByCache == null) || !modelByCache.IsActive)
     {
         return null;
     }
     DataSet set = this.dal.GetList(Top, string.Format(" Type in (0,1) and  FormID={0} ", formid), "  ORDER BY ID ASC ");
     List<Maticsoft.Model.Poll.Topics> list = new List<Maticsoft.Model.Poll.Topics>();
     int count = set.Tables[0].Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Poll.Topics item = new Maticsoft.Model.Poll.Topics();
             if (set.Tables[0].Rows[i]["ID"].ToString() != "")
             {
                 item.ID = int.Parse(set.Tables[0].Rows[i]["ID"].ToString());
             }
             item.Title = set.Tables[0].Rows[i]["Title"].ToString();
             if (set.Tables[0].Rows[i]["Type"].ToString() != "")
             {
                 item.Type = new int?(int.Parse(set.Tables[0].Rows[i]["Type"].ToString()));
             }
             if (set.Tables[0].Rows[i]["FormID"].ToString() != "")
             {
                 item.FormID = new int?(int.Parse(set.Tables[0].Rows[i]["FormID"].ToString()));
             }
             list.Add(item);
         }
     }
     return list;
 }