Exemplo n.º 1
0
        /// <summary>
        /// 添加留言提问
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddReception(YouthReception model)
        {
            StringBuilder str = new StringBuilder();

            str.Append(" insert into reception ");
            str.Append(" (reception_name,reception_sex,reception_homepage,reception_email,reception_qq,reception_title,reception_content,reception_time,is_reply,reception_type_id) ");
            str.Append(" values ");
            str.Append(" (@reception_name,@reception_sex,@reception_homepage,@reception_email,@reception_qq,@reception_title,@reception_content,@reception_time,@is_reply,@reception_type_id)  ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@reception_name",     SqlDbType.NVarChar,  25),
                new SqlParameter("@reception_sex",      SqlDbType.VarChar,   10),
                new SqlParameter("@reception_homepage", SqlDbType.NVarChar,  50),
                new SqlParameter("@reception_email",    SqlDbType.NVarChar,  25),
                new SqlParameter("@reception_qq",       SqlDbType.NVarChar,  25),
                new SqlParameter("@reception_title",    SqlDbType.NVarChar,  50),
                new SqlParameter("@reception_content",  SqlDbType.NText),
                new SqlParameter("@reception_time",     SqlDbType.DateTime),
                new SqlParameter("@is_reply",           SqlDbType.VarChar,   10),
                new SqlParameter("@reception_type_id",  SqlDbType.Int, 8)
            };
            parameters[0].Value = model.Reception_name;
            parameters[1].Value = model.Reception_sex;
            parameters[2].Value = model.Reception_homepage;
            parameters[3].Value = model.Reception_email;
            parameters[4].Value = model.Reception_qq;
            parameters[5].Value = model.Reception_title;
            parameters[6].Value = model.Reception_content;
            parameters[7].Value = model.Reception_time;
            parameters[8].Value = model.Is_reply;
            parameters[9].Value = model.Reception_type_id;
            int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters);

            return(rows);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加留言提问
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddReception(YouthReception model)
        {
            int rows = dal.AddReception(model);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        protected void bindData()
        {
            int reception_id = Convert.ToInt32(ViewState["reception_id"].ToString());

            model                   = bll.GetListById(reception_id);
            lblsender.Text          = model.Reception_name;
            lbltitle.Text           = model.Reception_title;
            lblquestioncontent.Text = model.Reception_content;
            YouthSecretary sec_model = huifu_bll.GetListById(reception_id);

            if (sec_model != null)
            {
                txtanswercontent.Text = sec_model.Secretary_content;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据id得到问题实体
        /// </summary>
        /// <param name="reception_id"></param>
        /// <returns></returns>
        public YouthReception GetListById(int reception_id)
        {
            YouthReception model = new YouthReception();
            StringBuilder  str   = new StringBuilder();

            str.Append(" select * from reception ");
            str.Append(" where reception_id=" + reception_id);
            DataSet ds = DbHelperSQL.Query(str.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                if (row["reception_id"] != null)
                {
                    model.Reception_id = Convert.ToInt32(row["reception_id"].ToString());
                }
                if (row["reception_name"] != null)
                {
                    model.Reception_name = row["reception_name"].ToString();
                }
                if (row["reception_sex"] != null)
                {
                    model.Reception_sex = row["reception_sex"].ToString();
                }
                if (row["reception_homepage"] != null)
                {
                    model.Reception_homepage = row["reception_homepage"].ToString();
                }
                if (row["reception_email"] != null)
                {
                    model.Reception_email = row["reception_email"].ToString();
                }
                if (row["reception_qq"] != null)
                {
                    model.Reception_qq = row["reception_qq"].ToString();
                }
                if (row["reception_title"] != null)
                {
                    model.Reception_title = row["reception_title"].ToString();
                }
                if (row["reception_content"] != null)
                {
                    model.Reception_content = row["reception_content"].ToString();
                }
                if (row["reception_time"] != null)
                {
                    model.Reception_time = DateTime.Parse(row["reception_time"].ToString());
                }
                if (row["is_reply"] != null)
                {
                    model.Is_reply = row["is_reply"].ToString();
                }
                if (row["reception_type_id"] != null)
                {
                    model.Reception_type_id = Convert.ToInt32(row["reception_type_id"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }