protected void GdvPagerList_RowCommand(object sender, CommandEventArgs e) { bool flag = false; string commandName = e.CommandName; if (commandName != null) { if (!(commandName == "Deleted")) { if (commandName == "Copy") { flag = PagerManage.Copy(e.CommandArgument.ToString()); goto Label_0050; } } else { flag = PagerManage.Delete(e.CommandArgument.ToString()); goto Label_0050; } } flag = false; Label_0050: if (flag) { this.GdvPagerList.DataBind(); BasePage.ResponseRedirect("PagerManage.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { string str = BasePage.RequestStringToLower("action"); this.TxtTemplate.Attributes.Add("onmouseup", "dragend(this)"); this.TxtTemplate.Attributes.Add("onClick", "savePos(this)"); this.TxtTemplate.Attributes.Add("onmousemove", "DragPos(this)"); this.RegTxtFileName.ValidationExpression = "^[^\\\\\\./:\\*\\?\\\"<>\\|]{1}[^\\\\/:\\*\\.\\?\\\"<>\\|]{0,254}\\.[^\\\\/:\\*\\.\\?\\\"<>\\|]{1,8}$"; this.RegTxtFileName.ErrorMessage = "文件名格式不正确"; if (!base.IsPostBack) { ListItem item = new ListItem(); item.Text = "全部分类"; this.DropLabelList.DataSource = LabelManage.GetLabelTypeList(); this.DropLabelList.DataTextField = "Name"; this.DropLabelList.DataValueField = "Name"; this.DropLabelList.DataBind(); this.DropLabelList.Items.Insert(0, item); this.DropPagerList.DataSource = PagerManage.GetPagerTypeList(); this.DropPagerList.DataTextField = "Name"; this.DropPagerList.DataValueField = "Name"; this.DropPagerList.DataBind(); this.DropPagerList.Items.Insert(0, item); this.BuildLabelList(string.Empty); this.BuildPagerList(string.Empty); } if ((str == "modify") && !base.IsPostBack) { this.BindDataToControls(); } }
protected void BuildPagerList(string typename) { this.LblPageList.Text = string.Empty; foreach (PagerManageInfo info in PagerManage.GetPagerList(typename)) { string text = this.LblPageList.Text; this.LblPageList.Text = text + "<div onclick=\"cit()\" outype=\"2\" class=\"spanfixdiv\" alt=\"" + info.Intro + "\">" + info.Name + "</div>"; } }
private void FillData() { this.ViewState["PagerName"] = BasePage.RequestString("Name"); PagerManageInfo pagerByName = PagerManage.GetPagerByName(this.ViewState["PagerName"].ToString()); this.TxtLabelName.Text = pagerByName.Name; this.ViewState["oldlabelname"] = pagerByName.Name; this.TxtLabelType.Text = pagerByName.Type; this.TxtLabelTemplate.Text = pagerByName.Template.ToString(); this.TxtLabelIntro.Text = pagerByName.Intro; }
private void InitDropLabelType() { this.DropLabelType.DataSource = PagerManage.GetPagerTypeList(); this.DropLabelType.DataTextField = "Name"; this.DropLabelType.DataValueField = "Name"; this.DropLabelType.DataBind(); ListItem item = new ListItem(); item.Text = "全部分类"; item.Value = "全部分类"; this.DropLabelType.Items.Insert(0, item); }
protected void BtnSubmit_Click(object sender, EventArgs e) { if (!this.Page.IsValid) { return; } if (this.ViewState["action"].ToString() == "add") { if (PagerManage.Exists(this.TxtLabelName.Text)) { AdminPage.WriteErrMsg("标签名重复"); } } else if ((string.Compare(this.ViewState["oldlabelname"].ToString(), this.TxtLabelName.Text, StringComparison.OrdinalIgnoreCase) > 0) && PagerManage.Exists(this.TxtLabelName.Text)) { AdminPage.WriteErrMsg("您不能修改成已存在的标签名"); } PagerManageInfo ainfo = new PagerManageInfo(); ainfo.Name = this.TxtLabelName.Text; ainfo.Type = this.TxtLabelType.Text; ainfo.Template = new StringBuilder(this.TxtLabelTemplate.Text); ainfo.Intro = this.TxtLabelIntro.Text; bool flag = false; string str = this.ViewState["action"].ToString(); if (str != null) { if (!(str == "add")) { if (str == "modify") { flag = PagerManage.Update(ainfo, this.ViewState["oldlabelname"].ToString()); goto Label_0148; } } else { flag = PagerManage.Add(ainfo); goto Label_0148; } } flag = PagerManage.Add(ainfo); Label_0148: if (flag) { BasePage.ResponseRedirect("PagerManage.aspx"); } }
protected void BtnDel_Click(object sender, EventArgs e) { StringBuilder selectList = this.GdvPagerList.SelectList; if (selectList.Length == 0) { AdminPage.WriteErrMsg("<li>对不起,您还没选择要删除的标签!</li>"); } else if (PagerManage.Delete(selectList.ToString())) { this.GdvPagerList.DataBind(); BasePage.ResponseRedirect("PagerManage.aspx"); } else { AdminPage.WriteErrMsg("删除失败!", "PagerManage.aspx"); } }
protected void InitPage() { this.m_action = BasePage.RequestString("Action", "Add"); this.ValeTxtFileName.ValidationExpression = "^[^\\/ :*?\"<>|.]+\\.html$"; string str = BasePage.RequestString("Dir").Replace("..", string.Empty); this.currentPath = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + str; this.currentPath = this.currentPath.Replace("/", @"\"); if (!this.Page.IsPostBack) { string str2 = "TemplateManage.aspx"; if (!string.IsNullOrEmpty(str)) { if (str.IndexOf('.') > 0) { str2 = str2 + "?Dir=" + base.Server.UrlEncode(str.Substring(0, str.LastIndexOf('/'))); } else { str2 = str2 + "?Dir=" + base.Server.UrlEncode(str); } } this.ViewState["UrlReferrer"] = str2; if (this.m_action == "Modify") { this.LblFileName.Text = str; this.TxtFileName.Visible = false; this.ValrTxtFileName.Visible = false; this.ValeTxtFileName.Enabled = false; try { this.TxtTemplate.Text = FileSystemObject.ReadFile(this.currentPath); } catch (FileNotFoundException) { AdminPage.WriteErrMsg("文件未找到", this.ViewState["UrlReferrer"].ToString()); } catch (UnauthorizedAccessException) { AdminPage.WriteErrMsg("<li>读取文件失败!检查您的服务器是否给模板文件夹写入权限。</li>", this.ViewState["UrlReferrer"].ToString()); } } if (this.m_action == "Add") { this.LblFileName.Text = str + "/"; } ListItem item = new ListItem(); item.Text = "全部分类"; this.DropLabelList.DataSource = LabelManage.GetLabelTypeList(); this.DropLabelList.DataTextField = "Name"; this.DropLabelList.DataValueField = "Name"; this.DropLabelList.DataBind(); this.DropLabelList.Items.Insert(0, item); this.DropPagerList.DataSource = PagerManage.GetPagerTypeList(); this.DropPagerList.DataTextField = "Name"; this.DropPagerList.DataValueField = "Name"; this.DropPagerList.DataBind(); this.DropPagerList.Items.Insert(0, item); this.BuildLabelList(string.Empty); this.BuildPagerList(string.Empty); } }