private bool DoAdd() { Model.banner model = new Model.banner(); BLL.banner bll = new BLL.banner(); model.site_path = this.ddlSitePath.SelectedValue; model.title = txtTitle.Text.Trim(); model.href_url = txtHref_url.Text; model.href_target = rblHref_target.SelectedValue; model.bg_color = txtBg_color.Text; model.img_src = txtImgUrl.Text; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加Banner:" + model.title); //记录日志 return(true); } return(false); }
private bool DoEdit(int _id) { bool result = false; BLL.banner bll = new BLL.banner(); Model.banner model = bll.GetModel(_id); model.site_path = this.ddlSitePath.SelectedValue; model.title = txtTitle.Text.Trim(); model.href_url = txtHref_url.Text; model.href_target = rblHref_target.SelectedValue; model.bg_color = txtBg_color.Text; model.img_src = txtImgUrl.Text; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改Banner:" + model.title); //记录日志 result = true; } return(result); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_advert", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.banner bll = new BLL.banner(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //删除成功后对应的目录及文件 if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除广告成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", "advert_list.aspx"); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("sys_banner_set", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.banner bll = new BLL.banner(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, string.Format("sort_id={0}", sortId)); } AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存站点排序"); //记录日志 JscriptMsg("保存排序成功!", "channel_list.aspx"); }
private void ShowInfo(int _id) { BLL.banner bll = new BLL.banner(); Model.banner model = bll.GetModel(_id); this.ddlSitePath.SelectedValue = model.site_path; txtTitle.Text = model.title; txtHref_url.Text = model.href_url; rblHref_target.SelectedValue = model.href_target; txtBg_color.Text = model.bg_color; txtSortId.Text = model.sort_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } this.txtImgUrl.Text = model.img_src; }
private void RptBind(string _strWhere) { BLL.banner bll = new BLL.banner(); this.rptList.DataSource = bll.GetList(_strWhere); this.rptList.DataBind(); }