//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_company_partner", EnumCollection.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.company_partner bll = new BLL.company_partner(); 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(EnumCollection.ActionEnum.Delete.ToString(), "删除合作伙伴" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", this.keywords)); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_company_partner", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 BLL.company_partner bll = new BLL.company_partner(); Model.company_partner model = bll.GetModel(this.id); model.company_id = Convert.ToInt32(txtcompany_id.Text); model.logo = Convert.ToString(txtlogo.Text); model.title = Convert.ToString(txttitle.Text); model.video_url = Convert.ToString(txtvideo_url.Text); model.video_thumb_img = Convert.ToString(txtvideo_thumb_img.Text); model.details = Convert.ToString(txtdetails.Text); model.is_show = Convert.ToInt32(txtis_show.Text); model.sort = Convert.ToInt32(txtsort.Text); model.add_time = Convert.ToDateTime(txtadd_time.Text); if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改合作伙伴信息,主键:" + id); //记录日志 JscriptMsg("修改合作伙伴信息成功!", "Manage.aspx"); } else { JscriptMsg("保存过程中发生错误!", ""); } }
private void SetPartnerIsShow() { int id = RequestHelper.GetFormInt("id"); BLL.company_partner bll = new BLL.company_partner(); Model.company_partner model = bll.GetModel(id); if (model != null) { if (model.is_show == (int)EnumCollection.YesOrNot.是) { model.is_show = (int)EnumCollection.YesOrNot.否; } else { model.is_show = (int)EnumCollection.YesOrNot.是; } bll.Update(model); HttpContext.Current.Response.Write("1"); HttpContext.Current.Response.End(); } else { HttpContext.Current.Response.Write("0"); HttpContext.Current.Response.End(); } }
private void BindData() { #region 组装查询条件 string whereStr = " 1 = 1 "; string _keywords = keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { if (Utils.IsSafeSqlString(_keywords)) { whereStr += " and (Title like '%" + _keywords + "%')"; } else { JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", "")); return; } } #endregion this.page = RequestHelper.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.company_partner bll = new BLL.company_partner(); this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize); this.rptList.DataBind(); this.totalCount = bll.GetRecordCount(whereStr); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("Manage.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void BindInfo() { BLL.company_partner bll = new BLL.company_partner(); Model.company_partner model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } txtlogo.Text = model.logo + ""; txttitle.Text = model.title + ""; txtvideo_url.Text = model.video_url + ""; this.rbtnIsShow.SelectedValue = model.is_show + ""; txtsort.Text = model.sort + ""; }
protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("_case_list", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 BLL.company_partner bll = new BLL.company_partner(); 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("txtsort")).Text.Trim(), out sortId)) { sortId = 1; } bll.UpdateField(id, "sort=" + sortId.ToString()); } AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "保存合作伙伴排序"); //记录日志 JscriptMsg("保存排序成功!", Utils.CombUrlTxt("case_list.aspx", "keywords={0}", this.keywords)); }
private void BindInfo() { BLL.company_partner bll = new BLL.company_partner(); Model.company_partner model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } txtcompany_id.Text = model.company_id + ""; txtlogo.Text = model.logo + ""; txttitle.Text = model.title + ""; txtvideo_url.Text = model.video_url + ""; txtvideo_thumb_img.Text = model.video_thumb_img + ""; txtdetails.Text = model.details + ""; txtis_show.Text = model.is_show + ""; txtsort.Text = model.sort + ""; txtadd_time.Text = model.add_time + ""; }
private bool DoEdit() { BLL.company_partner bll = new BLL.company_partner(); Model.company_partner model = bll.GetModel(this.id); model.logo = Convert.ToString(txtlogo.Text); model.title = Convert.ToString(txttitle.Text); model.video_url = Convert.ToString(txtvideo_url.Text); model.details = ""; model.is_show = Convert.ToInt32(this.rbtnIsShow.SelectedValue); model.sort = Convert.ToInt32(txtsort.Text); if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改合作伙伴信息,主键:" + id); //记录日志 return(true); } return(false); }
private bool DoAdd() { Model.company_partner model = new Model.company_partner(); BLL.company_partner bll = new BLL.company_partner(); model.company_id = 0; model.logo = Convert.ToString(txtlogo.Text); model.title = Convert.ToString(txttitle.Text); model.video_url = Convert.ToString(txtvideo_url.Text); model.details = ""; model.is_show = Convert.ToInt32(this.rbtnIsShow.SelectedValue); model.sort = Convert.ToInt32(txtsort.Text); model.add_time = System.DateTime.Now; int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加合作伙伴信息,主键:" + id); //记录日志 return(true); } return(false); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = RequestHelper.GetQueryInt("id"); string f = RequestHelper.GetQueryString("f"); switch (f) { case "cp": Model.company_info cp = new BLL.company_info().GetModel(id); if (cp != null) { src = cp.video_url; thumb = cp.video_thumb_img; } break; case "case": Model.common_resource re = new BLL.common_resource().GetModel(id); if (re != null) { src = re.path; thumb = re.cover; } break; case "partner": Model.company_partner partner = new BLL.company_partner().GetModel(id); if (partner != null) { src = partner.video_url; thumb = partner.video_thumb_img; } break; } } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_company_partner", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region string strError = string.Empty; if (txtcompany_id.Text.Trim() == "" || txtcompany_id.Text.Trim().Length > 4) { strError += "公司id为空或超出长度![br]"; } if (txtlogo.Text.Trim() == "" || txtlogo.Text.Trim().Length > 255) { strError += "logo为空或超出长度![br]"; } if (txttitle.Text.Trim() == "" || txttitle.Text.Trim().Length > 50) { strError += "标题为空或超出长度![br]"; } if (txtvideo_url.Text.Trim() == "" || txtvideo_url.Text.Trim().Length > 255) { strError += "视频地址为空或超出长度![br]"; } if (txtvideo_thumb_img.Text.Trim() == "" || txtvideo_thumb_img.Text.Trim().Length > 255) { strError += "视频缩略图地址为空或超出长度![br]"; } if (txtdetails.Text.Trim() == "" || txtdetails.Text.Trim().Length > 16) { strError += "案例详情为空或超出长度![br]"; } if (txtis_show.Text.Trim() == "" || txtis_show.Text.Trim().Length > 4) { strError += "是否显示为空或超出长度![br]"; } if (txtsort.Text.Trim() == "" || txtsort.Text.Trim().Length > 4) { strError += "排序为空或超出长度![br]"; } if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8) { strError += "添加时间为空或超出长度![br]"; } if (strError != string.Empty) { JscriptMsg(strError, "", "Error"); return; } #endregion Model.company_partner model = new Model.company_partner(); BLL.company_partner bll = new BLL.company_partner(); model.company_id = Convert.ToInt32(txtcompany_id.Text); model.logo = Convert.ToString(txtlogo.Text); model.title = Convert.ToString(txttitle.Text); model.video_url = Convert.ToString(txtvideo_url.Text); model.video_thumb_img = Convert.ToString(txtvideo_thumb_img.Text); model.details = Convert.ToString(txtdetails.Text); model.is_show = Convert.ToInt32(txtis_show.Text); model.sort = Convert.ToInt32(txtsort.Text); model.add_time = Convert.ToDateTime(txtadd_time.Text); int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加合作伙伴信息,主键:" + id); //记录日志 JscriptMsg("添加合作伙伴信息成功!", "Manage.aspx", ""); } else { JscriptMsg("保存过程中发生错误!", ""); } }