//設定操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { //ChkAdminLevel("channel_" + this.channel_name + "_list", TWEnums.ActionEnum.Edit.ToString()); //檢查權限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.about bll = new BLL.about(); Model.about model = bll.GetModel(id); switch (e.CommandName) { case "lbtnIsMsg": if (model.is_msg == 1) { bll.UpdateField(id, "is_msg=0"); } else { bll.UpdateField(id, "is_msg=1"); } break; case "lbtnIsSlide": if (model.is_slide == 1) { bll.UpdateField(id, "is_slide=0"); } else { bll.UpdateField(id, "is_slide=1"); } break; } this.RptBind(this.channel_id, this.category_id, "id>0" + CombSqlTxt(this.keywords, this.property, this.status), "sort_id desc,add_time desc,id desc"); }
private bool DoEdit(int _id) { bool result = false; BLL.about bll = new BLL.about(); Model.about model = bll.GetModel(_id); model.user_name = ddlFabu.SelectedValue; model.channel_id = this.channel_id; model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //内容摘要提取内容前255个字符 if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim())) { model.zhaiyao = Utils.DropHTML(txtContent.Value, 255); } else { model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255); } model.content = txtContent.Value; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.status = Utils.StrToInt(rblStatus.SelectedValue, 0); model.is_msg = 0; model.is_slide = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_slide = 1; } model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); DateTime _end_time; if (DateTime.TryParse(txtEndTime.Text.Trim(), out _end_time)) { model.update_time = _end_time; } if (bll.Update(model)) { AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.title); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.about bll = new BLL.about(); Model.about model = bll.GetModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txtCallIndex.Text = model.call_index; txtTitle.Text = model.title; txtLinkUrl.Text = model.link_url; //不是相册图片就绑定 string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1); if (!filename.StartsWith("thumb_")) { txtImgUrl.Text = model.img_url; } txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; txtZhaiyao.Text = model.zhaiyao; txtContent.Value = model.content; txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); rblStatus.SelectedValue = model.status.ToString(); ddlFabu.SelectedValue = model.user_name; if (action == TWEnums.ActionEnum.Edit.ToString()) { txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd"); } if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_slide == 1) { cblItem.Items[1].Selected = true; } if (model.update_time != null) { txtEndTime.Text = model.update_time.GetValueOrDefault().ToString("yyyy-M-d"); } }