//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_company_info", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 BLL.company_info bll = new BLL.company_info(); Model.company_info model = bll.GetModel(this.id); model.logo = Convert.ToString(txtlogo.Text); model.title = Convert.ToString(txttitle.Text); model.img_url = Convert.ToString(txtimg_url.Text); model.video_thumb_img = Convert.ToString(txtvideo_thumb_img.Text); model.video_url = Convert.ToString(txtvideo_url.Text); model.about_us = Convert.ToString(txtabout_us.Text); model.who_are_we_img = Convert.ToString(txtwho_are_we_img.Text); model.who_are_we = Convert.ToString(txtwho_are_we.Text); model.what_can_we_do = Convert.ToString(txtwhat_can_we_do.Text); model.what_can_we_do_img = Convert.ToString(txtwhat_can_we_do_img.Text); model.we_team_img = Convert.ToString(txtwe_team_img.Text); model.we_team = Convert.ToString(txtwe_team.Text); model.contact_us = Convert.ToString(txtcontact_us.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 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_info bll = new BLL.company_info(); 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); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_company_info", EnumCollection.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.company_info bll = new BLL.company_info(); 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 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; } } }
private void BindInfo() { BLL.company_info bll = new BLL.company_info(); Model.company_info model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } txtlogo.Text = model.logo + ""; txttitle.Text = model.title + ""; txtimg_url.Text = model.img_url + ""; txtvideo_thumb_img.Text = model.video_thumb_img + ""; txtvideo_url.Text = model.video_url + ""; txtabout_us.Text = model.about_us + ""; txtwho_are_we_img.Text = model.who_are_we_img + ""; txtwho_are_we.Text = model.who_are_we + ""; txtwhat_can_we_do.Text = model.what_can_we_do + ""; txtwhat_can_we_do_img.Text = model.what_can_we_do_img + ""; txtwe_team_img.Text = model.we_team_img + ""; txtwe_team.Text = model.we_team + ""; txtcontact_us.Text = model.contact_us + ""; txtadd_time.Text = model.add_time + ""; }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_company_info", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region string strError = string.Empty; if (txtlogo.Text.Trim() == "" || txtlogo.Text.Trim().Length > 255) { strError += "logo为空或超出长度![br]"; } if (txttitle.Text.Trim() == "" || txttitle.Text.Trim().Length > 50) { strError += "标题为空或超出长度![br]"; } if (txtimg_url.Text.Trim() == "" || txtimg_url.Text.Trim().Length > 255) { strError += "封面图为空或超出长度![br]"; } if (txtvideo_thumb_img.Text.Trim() == "" || txtvideo_thumb_img.Text.Trim().Length > 255) { strError += "视频缩略图为空或超出长度![br]"; } if (txtvideo_url.Text.Trim() == "" || txtvideo_url.Text.Trim().Length > 255) { strError += "视频为空或超出长度![br]"; } if (txtabout_us.Text.Trim() == "" || txtabout_us.Text.Trim().Length > 16) { strError += "关于我们为空或超出长度![br]"; } if (txtwho_are_we_img.Text.Trim() == "" || txtwho_are_we_img.Text.Trim().Length > 255) { strError += "我们是谁左侧图为空或超出长度![br]"; } if (txtwho_are_we.Text.Trim() == "" || txtwho_are_we.Text.Trim().Length > 255) { strError += "我们是谁文字为空或超出长度![br]"; } if (txtwhat_can_we_do.Text.Trim() == "" || txtwhat_can_we_do.Text.Trim().Length > 4000) { strError += "我们能做什么文字[[中文,英文],[中文,英文],[中文,英文],[中文,英文]]为空或超出长度![br]"; } if (txtwhat_can_we_do_img.Text.Trim() == "" || txtwhat_can_we_do_img.Text.Trim().Length > 255) { strError += "我们能做什么右侧图为空或超出长度![br]"; } if (txtwe_team_img.Text.Trim() == "" || txtwe_team_img.Text.Trim().Length > 255) { strError += "我们的团队左侧图为空或超出长度![br]"; } if (txtwe_team.Text.Trim() == "" || txtwe_team.Text.Trim().Length > 500) { strError += "我们的团队文字为空或超出长度![br]"; } if (txtcontact_us.Text.Trim() == "" || txtcontact_us.Text.Trim().Length > 16) { 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_info model = new Model.company_info(); BLL.company_info bll = new BLL.company_info(); model.logo = Convert.ToString(txtlogo.Text); model.title = Convert.ToString(txttitle.Text); model.img_url = Convert.ToString(txtimg_url.Text); model.video_thumb_img = Convert.ToString(txtvideo_thumb_img.Text); model.video_url = Convert.ToString(txtvideo_url.Text); model.about_us = Convert.ToString(txtabout_us.Text); model.who_are_we_img = Convert.ToString(txtwho_are_we_img.Text); model.who_are_we = Convert.ToString(txtwho_are_we.Text); model.what_can_we_do = Convert.ToString(txtwhat_can_we_do.Text); model.what_can_we_do_img = Convert.ToString(txtwhat_can_we_do_img.Text); model.we_team_img = Convert.ToString(txtwe_team_img.Text); model.we_team = Convert.ToString(txtwe_team.Text); model.contact_us = Convert.ToString(txtcontact_us.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("保存过程中发生错误!", ""); } }