예제 #1
0
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            int content_id = Convert.ToInt32(ViewState["content_id"].ToString());
            YouthSpecialSubContent original_model = bll.GetListById(content_id);

            model.Content_id           = content_id;
            model.Special_id           = Convert.ToInt32(ddl_special.SelectedValue);
            model.Sub_id               = Convert.ToInt32(ddl_sub.SelectedValue);
            model.Content_title        = txtTitle.Text.ToString();
            model.Content_content      = txtContent.Text.ToString();
            model.Content_publisher    = txt_publisher.Text.ToString();
            model.Content_phone        = txt_phone.Text.ToString();
            model.Content_email        = txt_email.Text.ToString();
            model.Content_publish_time = original_model.Content_publish_time;
            model.Content_click_times  = Convert.ToInt32(txt_click.Text.ToString());
            model.Content_source       = Convert.ToInt32(ddl_source.SelectedValue);
            model.Last_updater         = Session[Constant.adminName].ToString();
            model.Last_update_time     = DateTime.Today;
            model.Is_check             = "N";
            model.Checker              = "";
            model.Check_time           = original_model.Check_time;
            model.Rechecker            = "";
            model.Recheck_time         = original_model.Recheck_time;
            if (bll.UpdContent(model))
            {
                MyUtil.ShowMessageRedirect(this.Page, "编辑成功", "spe_sub_conItemList.aspx");
            }
            else
            {
                MyUtil.ShowMessage(this.Page, "编辑失败");
            }
        }
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            YouthSpecialSubContent model = new YouthSpecialSubContent();

            model.Special_id           = Convert.ToInt32(ddl_special.SelectedValue);
            model.Sub_id               = Convert.ToInt32(ddl_sub.SelectedValue);
            model.Content_title        = txtTitle.Text.ToString();
            model.Content_content      = txt_content.Text.ToString();
            model.Content_publisher    = txt_publisher.Text.ToString();
            model.Content_email        = txt_email.Text.ToString();
            model.Content_phone        = txt_phone.Text.ToString();
            model.Content_publish_time = DateTime.Today;
            model.Content_click_times  = 0;
            model.Content_source       = Convert.ToInt32(ddl_source.SelectedValue);
            model.Last_updater         = "";
            model.Last_update_time     = DateTime.Today;
            model.Is_check             = "N";
            model.Checker              = "";
            model.Check_time           = DateTime.Today;
            model.Rechecker            = "";
            model.Recheck_time         = DateTime.Today;
            if (bll.AddContent(model))
            {
                MyUtil.ShowMessageRedirect(this.Page, "添加成功", "spe_sub_conItemList.aspx");
            }
            else
            {
                MyUtil.ShowMessage(this.Page, "添加失败");
            }
        }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         content_id = Convert.ToInt32(Request.QueryString["content_id"].ToString());
         bll.AddReadCount(content_id);
         model = bll.GetListById(content_id);
     }
 }
예제 #4
0
        /// <summary>
        /// 审核或者取消审核
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool CheckCon(YouthSpecialSubContent model)
        {
            int rows = dal.CheckCon(model);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        /// <summary>
        /// 更新内容
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdContent(YouthSpecialSubContent model)
        {
            int rows = dal.UpdContent(model);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 添加内容
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddContent(YouthSpecialSubContent model)
        {
            StringBuilder str = new StringBuilder();

            str.Append(" insert into special_sub_content ");
            str.Append("(special_id,sub_id,content_title,content_content,content_publisher,content_email,content_phone,content_publish_time,content_click_times,content_source,last_updater,last_update_time,is_check,checker,check_time,rechecker,recheck_time )");
            str.Append(" values ");
            str.Append("(@special_id,@sub_id,@content_title,@content_content,@content_publisher,@content_email,@content_phone,@content_publish_time,@content_click_times,@content_source,@last_updater,@last_update_time,@is_check,@checker,@check_time,@rechecker,@recheck_time )");
            SqlParameter[] parameters =
            {
                new SqlParameter("@special_id",           SqlDbType.Int,        8),
                new SqlParameter("@sub_id",               SqlDbType.Int,        8),
                new SqlParameter("@content_title",        SqlDbType.NVarChar,  50),
                new SqlParameter("@content_content",      SqlDbType.NText),
                new SqlParameter("@content_publisher",    SqlDbType.NVarChar,  50),
                new SqlParameter("@content_email",        SqlDbType.NVarChar,  50),
                new SqlParameter("@content_phone",        SqlDbType.NVarChar,  50),
                new SqlParameter("@content_publish_time", SqlDbType.DateTime),
                new SqlParameter("@content_click_times",  SqlDbType.Int,        8),
                new SqlParameter("@content_source",       SqlDbType.Int,        8),
                new SqlParameter("@last_updater",         SqlDbType.NVarChar,  50),
                new SqlParameter("@last_update_time",     SqlDbType.DateTime),
                new SqlParameter("@is_check",             SqlDbType.VarChar,   10),
                new SqlParameter("@checker",              SqlDbType.NVarChar,  50),
                new SqlParameter("@check_time",           SqlDbType.DateTime),
                new SqlParameter("@rechecker",            SqlDbType.NVarChar,  50),
                new SqlParameter("@recheck_time",         SqlDbType.DateTime)
            };
            parameters[0].Value  = model.Special_id;
            parameters[1].Value  = model.Sub_id;
            parameters[2].Value  = model.Content_title;
            parameters[3].Value  = model.Content_content;
            parameters[4].Value  = model.Content_publisher;
            parameters[5].Value  = model.Content_email;
            parameters[6].Value  = model.Content_phone;
            parameters[7].Value  = model.Content_publish_time;
            parameters[8].Value  = model.Content_click_times;
            parameters[9].Value  = model.Content_source;
            parameters[10].Value = model.Last_updater;
            parameters[11].Value = model.Last_update_time;
            parameters[12].Value = model.Is_check;
            parameters[13].Value = model.Checker;
            parameters[14].Value = model.Check_time;
            parameters[15].Value = model.Rechecker;
            parameters[16].Value = model.Recheck_time;
            int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters);

            return(rows);
        }
예제 #7
0
        protected void bindSpeSubCon()
        {
            int content_id = Convert.ToInt32(ViewState["content_id"].ToString());

            model = bll.GetListById(content_id);
            ddl_special.Items.FindByValue(model.Special_id.ToString()).Selected = true;
            ddl_sub.Items.FindByValue(model.Sub_id.ToString()).Selected         = true;
            txtTitle.Text      = model.Content_title;
            txtContent.Text    = model.Content_content;
            txt_click.Text     = model.Content_click_times.ToString();
            txt_publisher.Text = model.Content_publisher;
            txt_phone.Text     = model.Content_phone;
            txt_email.Text     = model.Content_email;
            ddl_source.Items.FindByValue(model.Content_source.ToString()).Selected = true;
            //应该把所有元素都取到,这样在下面的修改保存中可以保持一致性
        }
        /// <summary>
        /// 取消审核
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int ReCheckCon(YouthSpecialSubContent model)
        {
            StringBuilder str = new StringBuilder();

            str.Append(" update special_sub_content set ");
            str.Append(" is_check=@is_check, ");
            str.Append(" rechecker=@rechecker,");
            str.Append(" recheck_time=@recheck_time ");
            str.Append(" where content_id=@content_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@is_check",     SqlDbType.VarChar,   10),
                new SqlParameter("@rechecker",    SqlDbType.NVarChar,  25),
                new SqlParameter("@recheck_time", SqlDbType.DateTime),
                new SqlParameter("@content_id",   SqlDbType.Int, 8)
            };
            parameters[0].Value = model.Is_check;
            parameters[1].Value = model.Rechecker;
            parameters[2].Value = model.Recheck_time;
            parameters[3].Value = model.Content_id;
            int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters);

            return(rows);
        }
        /// <summary>
        /// 根据id得到内容实体
        /// </summary>
        /// <param name="content_id"></param>
        /// <returns></returns>
        public YouthSpecialSubContent GetListById(int content_id)
        {
            YouthSpecialSubContent model = new YouthSpecialSubContent();
            StringBuilder          str   = new StringBuilder();

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                if (row["content_id"] != null)
                {
                    model.Content_id = Convert.ToInt32(row["content_id"].ToString());
                }
                if (row["special_id"] != null)
                {
                    model.Special_id = Convert.ToInt32(row["special_id"].ToString());
                }
                if (row["sub_id"] != null)
                {
                    model.Sub_id = Convert.ToInt32(row["sub_id"].ToString());
                }
                if (row["content_title"] != null)
                {
                    model.Content_title = row["content_title"].ToString();
                }
                if (row["content_content"] != null)
                {
                    model.Content_content = row["content_content"].ToString();
                }
                if (row["content_publisher"] != null)
                {
                    model.Content_publisher = row["content_publisher"].ToString();
                }
                if (row["content_email"] != null)
                {
                    model.Content_email = row["content_email"].ToString();
                }
                if (row["content_phone"] != null)
                {
                    model.Content_phone = row["content_phone"].ToString();
                }
                if (row["content_publish_time"] != null)
                {
                    model.Content_publish_time = DateTime.Parse(row["content_publish_time"].ToString());
                }
                if (row["content_click_times"] != null)
                {
                    model.Content_click_times = Convert.ToInt32(row["content_click_times"].ToString());
                }
                if (row["content_source"] != null)
                {
                    model.Content_source = Convert.ToInt32(row["content_source"].ToString());
                }
                if (row["last_updater"] != null)
                {
                    model.Last_updater = row["last_updater"].ToString();
                }
                if (row["last_update_time"] != null)
                {
                    model.Last_update_time = DateTime.Parse(row["last_update_time"].ToString());
                }
                if (row["is_check"] != null)
                {
                    model.Is_check = row["is_check"].ToString();
                }
                if (row["checker"] != null)
                {
                    model.Checker = row["checker"].ToString();
                }
                if (row["check_time"] != null)
                {
                    model.Check_time = DateTime.Parse(row["check_time"].ToString());
                }
                if (row["rechecker"] != null)
                {
                    model.Rechecker = row["rechecker"].ToString();
                }
                if (row["recheck_time"] != null)
                {
                    model.Recheck_time = DateTime.Parse(row["recheck_time"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 更新内容
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdContent(YouthSpecialSubContent model)
        {
            StringBuilder str = new StringBuilder();

            str.Append(" update special_sub_content set ");
            str.Append(" special_id=@special_id,");
            str.Append(" sub_id=@sub_id,");
            str.Append(" content_title=@content_title,");
            str.Append("content_content=@content_content,");
            str.Append(" content_publisher=@content_publisher,");
            str.Append(" content_email=@content_email,");
            str.Append(" content_phone=@content_phone,");
            str.Append(" content_publish_time=@content_publish_time,");
            str.Append(" content_click_times=@content_click_times,");
            str.Append("content_source=@content_source,");
            str.Append(" last_updater=@last_updater,");
            str.Append("last_update_time=@last_update_time,");
            str.Append("is_check=@is_check,");
            str.Append(" checker=@checker,");
            str.Append(" check_time=@check_time,");
            str.Append(" rechecker=@rechecker,");
            str.Append(" recheck_time=@recheck_time ");
            str.Append(" where content_id=@content_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@special_id",           SqlDbType.Int,        8),
                new SqlParameter("@sub_id",               SqlDbType.Int,        8),
                new SqlParameter("@content_title",        SqlDbType.NVarChar,  50),
                new SqlParameter("@content_content",      SqlDbType.NText),
                new SqlParameter("@content_publisher",    SqlDbType.NVarChar,  50),
                new SqlParameter("@content_email",        SqlDbType.NVarChar,  50),
                new SqlParameter("@content_phone",        SqlDbType.NVarChar,  50),
                new SqlParameter("@content_publish_time", SqlDbType.DateTime),
                new SqlParameter("@content_click_times",  SqlDbType.Int,        8),
                new SqlParameter("@content_source",       SqlDbType.Int,        8),
                new SqlParameter("@last_updater",         SqlDbType.NVarChar,  50),
                new SqlParameter("@last_update_time",     SqlDbType.DateTime),
                new SqlParameter("@is_check",             SqlDbType.VarChar,   10),
                new SqlParameter("@checker",              SqlDbType.NVarChar,  50),
                new SqlParameter("@check_time",           SqlDbType.DateTime),
                new SqlParameter("@rechecker",            SqlDbType.NVarChar,  50),
                new SqlParameter("@recheck_time",         SqlDbType.DateTime),
                new SqlParameter("@content_id",           SqlDbType.Int, 8)
            };
            parameters[0].Value  = model.Special_id;
            parameters[1].Value  = model.Sub_id;
            parameters[2].Value  = model.Content_title;
            parameters[3].Value  = model.Content_content;
            parameters[4].Value  = model.Content_publisher;
            parameters[5].Value  = model.Content_email;
            parameters[6].Value  = model.Content_phone;
            parameters[7].Value  = model.Content_publish_time;
            parameters[8].Value  = model.Content_click_times;
            parameters[9].Value  = model.Content_source;
            parameters[10].Value = model.Last_updater;
            parameters[11].Value = model.Last_update_time;
            parameters[12].Value = model.Is_check;
            parameters[13].Value = model.Checker;
            parameters[14].Value = model.Check_time;
            parameters[15].Value = model.Rechecker;
            parameters[16].Value = model.Recheck_time;
            parameters[17].Value = model.Content_id;
            int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters);

            return(rows);
        }