private bool DoAdd() { Rain.Model.channel_site model = new Rain.Model.channel_site(); Rain.BLL.channel_site channelSite = new Rain.BLL.channel_site(); model.title = this.txtTitle.Text.Trim(); model.build_path = this.txtBuildPath.Text.Trim(); model.domain = this.txtDomain.Text.Trim(); model.sort_id = Utils.StrToInt(this.txtSortId.Text.Trim(), 99); model.is_default = !this.cbIsDefault.Checked ? 0 : 1; model.name = this.txtName.Text.Trim(); model.logo = this.txtLogo.Text.Trim(); model.company = this.txtCompany.Text.Trim(); model.address = this.txtAddress.Text.Trim(); model.tel = this.txtTel.Text.Trim(); model.fax = this.txtFax.Text.Trim(); model.email = this.txtEmail.Text.Trim(); model.crod = this.txtCrod.Text.Trim(); model.seo_title = this.txtSeoTitle.Text.Trim(); model.seo_keyword = this.txtSeoKeyword.Text.Trim(); model.seo_description = Utils.DropHTML(this.txtSeoDescription.Text); model.copyright = this.txtCopyright.Text.Trim(); if (channelSite.Add(model) <= 0) { return(false); } CacheHelper.Remove("dt_cache_http_domain"); this.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加站点:" + model.title); return(true); }
protected void btnDelete_Click(object sender, EventArgs e) { this.ChkAdminLevel("sys_site_manage", DTEnums.ActionEnum.Delete.ToString()); int num1 = 0; int num2 = 0; Rain.BLL.channel_site channelSite = new Rain.BLL.channel_site(); for (int index = 0; index < this.rptList.Items.Count; ++index) { int int32 = Convert.ToInt32(((HiddenField)this.rptList.Items[index].FindControl("hidId")).Value); if (((CheckBox)this.rptList.Items[index].FindControl("chkId")).Checked) { if (new Rain.BLL.channel().GetCount("site_id=" + (object)int32) > 0) { ++num2; } else { Rain.Model.channel_site model = channelSite.GetModel(int32); if (channelSite.Delete(int32)) { ++num1; Utils.DeleteDirectory(this.siteConfig.webpath + "aspx/" + model.build_path); Utils.DeleteDirectory(this.siteConfig.webpath + "html/" + model.build_path); } else { ++num2; } } } } this.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除站点成功" + (object)num1 + "条,失败" + (object)num2 + "条"); this.JscriptMsg("删除成功" + (object)num1 + "条,失败" + (object)num2 + "条!", Utils.CombUrlTxt("site_list.aspx", "keywords={0}", this.keywords), "parent.loadMenuTree"); }
private void TreeBind() { DataTable table = new Rain.BLL.channel_site().GetList(0, "", "sort_id asc,id desc").Tables[0]; this.ddlSiteId.Items.Clear(); this.ddlSiteId.Items.Add(new ListItem("所有站点", "")); foreach (DataRow row in (InternalDataCollectionBase)table.Rows) { this.ddlSiteId.Items.Add(new ListItem(row["title"].ToString(), row["id"].ToString())); } }
protected void btnSave_Click(object sender, EventArgs e) { this.ChkAdminLevel("sys_site_manage", DTEnums.ActionEnum.Edit.ToString()); Rain.BLL.channel_site channelSite = new Rain.BLL.channel_site(); for (int index = 0; index < this.rptList.Items.Count; ++index) { int int32 = Convert.ToInt32(((HiddenField)this.rptList.Items[index].FindControl("hidId")).Value); int result; if (!int.TryParse(((TextBox)this.rptList.Items[index].FindControl("txtSortId")).Text.Trim(), out result)) { result = 99; } channelSite.UpdateSort(int32, result); } this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存站点排序"); this.JscriptMsg("保存排序成功!", Utils.CombUrlTxt("site_list.aspx", "keywords={0}", this.keywords), "parent.loadMenuTree"); }
private void TreeBind() { DataTable table = new Rain.BLL.channel_site().GetList(0, "", "sort_id asc,id desc").Tables[0]; this.ddlSitePath.Items.Clear(); this.ddlSitePath.Items.Add(new ListItem("生成模板到", "")); foreach (DataRow row in (InternalDataCollectionBase)table.Rows) { if (string.IsNullOrEmpty(row["templet_path"].ToString())) { this.ddlSitePath.Items.Add(new ListItem("├ " + row["title"].ToString(), row["build_path"].ToString())); } else { this.ddlSitePath.Items.Add(new ListItem("├ " + row["title"].ToString() + "(当前模板:" + row["templet_path"].ToString() + ")", row["build_path"].ToString())); } } }
private void ShowInfo(int _id) { Rain.Model.channel_site model = new Rain.BLL.channel_site().GetModel(_id); this.txtTitle.Text = model.title; this.txtBuildPath.Text = model.build_path; this.txtBuildPath.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=channel_site_validate&old_build_path=" + Utils.UrlEncode(model.build_path)); this.txtBuildPath.Focus(); this.txtDomain.Text = model.domain; this.txtSortId.Text = model.sort_id.ToString(); this.cbIsDefault.Checked = model.is_default == 1; this.txtName.Text = model.name; this.txtLogo.Text = model.logo; this.txtCompany.Text = model.company; this.txtAddress.Text = model.address; this.txtTel.Text = model.tel; this.txtFax.Text = model.fax; this.txtEmail.Text = model.email; this.txtCrod.Text = model.crod; this.txtSeoTitle.Text = model.seo_title; this.txtSeoKeyword.Text = model.seo_keyword; this.txtSeoDescription.Text = model.seo_description; this.txtCopyright.Text = model.copyright; }