/// <summary> /// 列表上的项删除事件 /// </summary> protected void btnRemove_Click(object sender, EventArgs e) { try { LinkButton btnRemove = (LinkButton)sender; if (btnRemove != null && !String.IsNullOrEmpty(btnRemove.CommandArgument)) { mTips.IsPostBack = true; FontDB FontItem = new FontDBHelper(this).Find(btnRemove.CommandArgument); if (FontItem != null && !String.IsNullOrEmpty(FontItem.PrimaryGuid)) { if (FontItem.IsSystem.HasValue && !FontItem.IsSystem.Value) { new FontDBHelper(this).Delete(FontItem.PrimaryGuid); mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { FontItem.Alias }); } else { //这是系统内置的字体不允许删除 mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { FontItem.Alias }); } BindDataList(); } } } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 更新内容 /// </summary> protected void cmdUpdate_Click(object sender, EventArgs e) { try { //演示站点需要锁定功能 if (IsAdministrator || !DemoLock) { FontDB FontItem = new FontDBHelper(this).Find(PrimaryGuid); FontItem.Alias = txtFontAlias.Text; FontItem.FontUrl = txtFontUrl.Text; FontItem.Bold = txtFontBold.Text; FontItem.Family = txtFontFamily.Text; FontItem.Subset = txtFontSubset.Text; FontItem.Enable = cbEnable.Checked; if (String.IsNullOrEmpty(FontItem.PrimaryGuid)) { FontItem.IsSystem = false; FontItem.IsFontLink = true; } new FontDBHelper(this).SaveCommit(FontItem); } mTips.LoadMessage("CopySkinSuccess", EnumTips.Success, this, new String[] { }); Response.Redirect(xUrl("", "", "Fonts"), false); } catch (Exception exc) { ProcessModuleLoadException(exc); } }
/// <summary> /// 绑定列表 /// </summary> private void BindDataList() { QueryParam qp = new QueryParam(); #region "分页的一系列代码" int RecordCount = 0; int pagesize = qp.PageSize = 10; qp.PageIndex = PageIndex; #endregion FontDB SearchFont = new FontDB(); //查询的方法 if (!String.IsNullOrEmpty(Search_Title)) { SearchFont.Alias = Search_Title; txtSearch.Text = Search_Title; } if (IsFontLink >= 0) { SearchFont.IsFontLink = IsFontLink == 1; } List <FontDB> FontList = new FontDBHelper(this).FindAll(SearchFont, qp.PageIndex, qp.PageSize, out RecordCount); FontList.Sort(delegate(FontDB x, FontDB y) { if (!x.IsFontLink.HasValue || !y.IsFontLink.HasValue) { return(0); } else { return(y.IsFontLink.Value.CompareTo(x.IsFontLink.Value)); } }); qp.RecordCount = RecordCount; RecordPages = qp.Pages; lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages")); gvCommentList.DataSource = FontList; gvCommentList.DataBind(); BindGridViewEmpty <FontDB>(gvCommentList, new FontDB()); }
/// <summary> /// 绑定元素到页面 /// </summary> private void BindItemToPage() { FontDB FontItem = new FontDBHelper(this).Find(PrimaryGuid); txtFontAlias.Text = FontItem.Alias; txtFontUrl.Text = FontItem.FontUrl; txtFontBold.Text = FontItem.Bold; txtFontFamily.Text = FontItem.Family; txtFontSubset.Text = FontItem.Subset; cbEnable.Checked = FontItem.Enable; if (FontItem.IsSystem.HasValue && FontItem.IsSystem.Value) { cmdUpdate.Visible = false; } }
/// <summary> /// 绑定元素到页面 /// </summary> private void BindItemToPage() { FontDB FontItem = new FontDBHelper(this).Find(PrimaryGuid); txtFontAlias.Text = FontItem.Alias; txtFontBold.Text = FontItem.Bold; txtFontFamily.Text = FontItem.Family; txtFontSubset.Text = FontItem.Subset; cbEnable.Checked = FontItem.Enable; //绑定字体 BindFileUploadStyle("FontEot", FontItem.Font_File_Eot); BindFileUploadStyle("FontSvg", FontItem.Font_File_Svg); BindFileUploadStyle("FontTtf", FontItem.Font_File_Ttf); BindFileUploadStyle("FontWoff", FontItem.Font_File_Woff); }
/// <summary> /// 状态应用按钮事件 /// </summary> protected void btnApply_Click(object sender, EventArgs e) { try { Int32 Status = WebHelper.GetIntParam(Request, ddlStatus.UniqueID, -1); if (Status >= 0) { string Checkbox_Value = WebHelper.GetStringParam(Request, "Checkbox", ""); string[] Checkbox_Value_Array = Checkbox_Value.Split(','); String IDX = String.Empty; mTips.IsPostBack = true; for (int i = 0; i < Checkbox_Value_Array.Length; i++) { if (!String.IsNullOrEmpty(Checkbox_Value_Array[i])) { FontDB FontItem = new FontDBHelper(this).Find(Checkbox_Value_Array[i]); if (FontItem != null && !String.IsNullOrEmpty(FontItem.PrimaryGuid)) { if (FontItem.IsSystem.HasValue && !FontItem.IsSystem.Value) { new FontDBHelper(this).Delete(FontItem.PrimaryGuid); mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { FontItem.Alias }); } else { //这是系统内置的字体不允许删除 mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { FontItem.Alias }); } } } } BindDataList(); } } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 打印引用到的字体库 /// </summary> /// <returns></returns> public void ViewFamilyFonts_link() { List <FontDB> fonts = new FontDBHelper(this).FindAll(); //遍历打印所有需要引用的字体库 foreach (FontDB font in fonts) { if (!String.IsNullOrEmpty(font.PrimaryGuid) && font.Enable) { if (font.IsFontLink.HasValue && font.IsFontLink.Value) { if (!String.IsNullOrEmpty(font.FontUrl)) { LoadStyle(String.Format("fontcss_{0}", font.PrimaryGuid), font.FontUrl); //sb.AppendFormat("<link href='{0}' rel='stylesheet' type='text/css'>", font.FontUrl).AppendLine(); } } } } }