Exemple #1
0
        /// <summary>
        /// 获取指定调查下的所有主题
        /// </summary>
        /// <param name="voteId">调查Id</param>
        /// <returns></returns>
        public List<Model.VoteSubjectInfo> GetItemsByVoteId(int voteId)
        {
            string cmdText = "select * from XY_VoteSubject where voteId =@VoteId";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@VoteId",voteId)
            };

            List<Model.VoteSubjectInfo> list = new List<XYECOM.Model.VoteSubjectInfo>();

            using (SqlDataReader reader = XYECOM.Core.Data.SqlHelper.ExecuteReader(CommandType.Text, cmdText, param))
            {
                while (reader.Read())
                {
                    Model.VoteSubjectInfo info = new XYECOM.Model.VoteSubjectInfo();

                    info.SubjectId = XYECOM.Core.MyConvert.GetInt32(reader["SubjectId"].ToString());
                    info.Subject = reader["Subject"].ToString();
                    info.VoteId = XYECOM.Core.MyConvert.GetInt32(reader["VoteId"].ToString());
                    info.StrType = reader["type"].ToString();

                    list.Add(info);
                }
            }

            return list;
        }
Exemple #2
0
        /// <summary>
        /// 获取问题信息
        /// </summary>
        /// <param name="subjectId">问题Id</param>
        /// <returns></returns>
        public Model.VoteSubjectInfo GetItem(int subjectId)
        {
            string cmdText = "select * from XY_VoteSubject where subjectId =@SubjectId";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@SubjectId",subjectId)
            };

            Model.VoteSubjectInfo info = null;

            using (SqlDataReader reader = XYECOM.Core.Data.SqlHelper.ExecuteReader(CommandType.Text, cmdText, param))
            {
                if (reader.Read())
                {
                    info = new XYECOM.Model.VoteSubjectInfo();

                    info.SubjectId = XYECOM.Core.MyConvert.GetInt32(reader["SubjectId"].ToString());
                    info.Subject = reader["Subject"].ToString();
                    info.StrType = reader["Type"].ToString();
                    info.VoteId = XYECOM.Core.MyConvert.GetInt32(reader["VoteId"].ToString());
                }
            }

            return info;
        }
Exemple #3
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            int voteId = XYECOM.Core.XYRequest.GetQueryInt("voteid", 0);

            backURL = XYECOM.Core.XYRequest.GetString("backURL1");

            if (voteId <= 0)
            {
                Alert("非法参数!", backURL);
            }

            Model.VoteSubjectInfo subject = new XYECOM.Model.VoteSubjectInfo();

            subject.Subject = this.txtSubject.Text.Trim();
            subject.StrType = this.rdolstType.SelectedValue;
            subject.VoteId = voteId;

            int subjectId = 0;

            new Business.VoteSubject().Insert(subject, out subjectId);

            if (subjectId > 0)
            {
                int optionTotal = Core.MyConvert.GetInt32(this.OptionTotal.Value);

                Business.VoteOptions optionBLL = new XYECOM.Business.VoteOptions();
                Model.VoteOptionsInfo optionInfo = null;

                for (int i = 1; i <= optionTotal; i++)
                {
                    string option = XYECOM.Core.XYRequest.GetFormString("option" + i).Trim();

                    if (string.IsNullOrEmpty(option)) continue;

                    optionInfo = new XYECOM.Model.VoteOptionsInfo();
                    optionInfo.Text = option;
                    optionInfo.SubjectId = subjectId;
                    optionInfo.VoteTotal = 0;

                    optionBLL.Insert(optionInfo);
                }
            }

            Response.Redirect(backURL);
        }