⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paragraphstyle.cs

📁 在线 图书网上购物系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Common;
using System.Web.Management;
	
#region ParagraphStyle
	/// <summary>
	/// This object represents the properties and methods of a ParagraphStyle.
	/// </summary>
	public class ParagraphStyle
	{
		protected int _id;
		protected string _paragraphName = String.Empty;
		protected string _fontName = String.Empty;
		protected double _fontSize;
		protected bool _isBold;
		protected bool _isItalic;

        protected double _lineSpace;
		protected string _lineSpaceMode = String.Empty;
        protected double _rightIndent;
        protected double _leftIndent;
        protected string _alignment=String.Empty;
        protected double _spaceAfter;
        protected double _spaceBefore;
        protected double _lineunitafter;
        protected double _lineunitbefore;
        protected double _charunitleftindent;
        protected double _charunitrightindent;
        protected double _charunitfirstlineindent;

		public ParagraphStyle()
		{
		}
		
		public ParagraphStyle(int id)
		{
            DbDataReader reader = DataAccess.ExecuteDataReader("usp_SelectParagraphStyle", false, new object[] { id });
			
			if (reader.Read()) 
			{
				this.LoadFromReader(reader);
				reader.Close();
			}
			else
			{
				if (!reader.IsClosed) reader.Close();
				throw new ApplicationException("ParagraphStyle does not exist.");
			}
		}
		
		public ParagraphStyle(DbDataReader reader)
		{
			this.LoadFromReader(reader);
		}
		
		protected void LoadFromReader(DbDataReader reader)
		{
			if (reader != null && !reader.IsClosed)
			{
				_id = reader.GetInt32(0);
				if (!reader.IsDBNull(1)) _paragraphName = reader.GetString(1);
				if (!reader.IsDBNull(2)) _fontName = reader.GetString(2);
                if (!reader.IsDBNull(3)) _fontSize = reader.GetDouble(3);
				if (!reader.IsDBNull(4)) _isBold = reader.GetBoolean(4);
				if (!reader.IsDBNull(5)) _isItalic = reader.GetBoolean(5);
		        if (!reader.IsDBNull(6)) _lineSpaceMode = reader.GetString(6);
                if (!reader.IsDBNull(7)) _lineSpace = reader.GetDouble(7);
                if (!reader.IsDBNull(8)) _lineunitafter = reader.GetDouble(8);
                if (!reader.IsDBNull(9)) _lineunitbefore = reader.GetDouble(9);
                if (!reader.IsDBNull(10)) _spaceAfter = reader.GetDouble(10);
                if (!reader.IsDBNull(11)) _spaceBefore = reader.GetDouble(11);
                if (!reader.IsDBNull(12)) _alignment = reader.GetString(12);
                if (!reader.IsDBNull(13)) _rightIndent = reader.GetDouble(13);
                if (!reader.IsDBNull(14)) _leftIndent = reader.GetDouble(14);
                if (!reader.IsDBNull(15)) _charunitleftindent = reader.GetDouble(15);
                if (!reader.IsDBNull(16)) _charunitrightindent = reader.GetDouble(16);
                if (!reader.IsDBNull(17)) _charunitfirstlineindent = reader.GetDouble(17);
			}
		}
		
		#region Public Properties
		public int Id
		{
			get {return _id;}
		}
		
		public string NameLocal
		{
			get {return _paragraphName;}
			set {_paragraphName = value;}
		}

		public string FontName
		{
			get {return _fontName;}
			set {_fontName = value;}
		}

		public double FontSize
		{
			get {return _fontSize;}
			set {_fontSize = value;}
		}

		public bool Bold
		{
			get {return _isBold;}
			set {_isBold = value;}
		}

		public bool Italic
		{
			get {return _isItalic;}
			set {_isItalic = value;}
		}




        public double LineSpacing
		{
			get {return _lineSpace;}
			set {_lineSpace = value;}
		}

		public string LineSpacingRule
		{
			get {return _lineSpaceMode;}
			set {_lineSpaceMode = value;}
		}

        public double RightIndent
		{
			get {return _rightIndent;}
			set {_rightIndent = value;}
		}

        public double LeftIndent
		{
			get {return _leftIndent;}
			set {_leftIndent = value;}
		}

		public string Alignment
		{
			get {return _alignment;}
			set {_alignment = value;}
		}

		public double SpaceAfter
		{
			get {return _spaceAfter;}
			set {_spaceAfter = value;}
		}

		public double SpaceBefore
		{
			get {return _spaceBefore;}
			set {_spaceBefore = value;}
		}


        public double LineUnitBefore
        {
            get { return _lineunitbefore; }
            set { _lineunitbefore = value; }
        }

        public double LineUnitAfter
        {
            get { return _lineunitafter; }
            set { _lineunitafter = value; }
        }



        public double CharacterUnitLeftIndent
        {
            get { return _charunitleftindent; }
            set { _charunitleftindent = value; }
        }

        public double CharacterUnitRightIndent
        {
            get { return _charunitrightindent; }
            set { _charunitrightindent = value; }
        }
        public double CharacterUnitFirstLineIndent
        {
            get { return _charunitfirstlineindent; }
            set { _charunitfirstlineindent = value; }
        }
		#endregion
		
		public static ParagraphStyle GetParagraphStyle(int id)
		{
			return new ParagraphStyle(id);
		}

        public static int Insert(ParagraphStyle ps)
        {
            return DataAccess.ExecuteNonQuery("usp_InsertParagraphStyle", false, new object[]{
            ps.NameLocal,ps.FontName,ps.FontSize,ps.Bold,
            ps.Italic,ps.LineSpacingRule,ps.LineSpacing,
            ps.LineUnitAfter,ps.LineUnitBefore,
            ps.SpaceAfter,ps.SpaceBefore,ps.Alignment,
            ps.LeftIndent,ps.RightIndent,
            ps.CharacterUnitLeftIndent,
            ps.CharacterUnitRightIndent,
            ps.CharacterUnitFirstLineIndent
            });
        }

        public static int update(ParagraphStyle ps)
        {
            return DataAccess.ExecuteNonQuery("usp_UpdateParagraphStyle", false, new object[]{
            ps.Id,
            ps.NameLocal,ps.FontName,ps.FontSize,ps.Bold,
            ps.Italic,ps.LineSpacingRule,ps.LineSpacing,
            ps.LineUnitAfter,ps.LineUnitBefore,
            ps.SpaceAfter,ps.SpaceBefore,ps.Alignment,
            ps.LeftIndent,ps.RightIndent,
            ps.CharacterUnitLeftIndent,
            ps.CharacterUnitRightIndent,
            ps.CharacterUnitFirstLineIndent
            });
        }

        public static int GetIDByNameLocal(string namelocal)
        {
            int id=-1;
            string sql = "select paragraphstyleid from paragraphstyle where namelocal like '" + namelocal + "'";
            DbDataReader reader = DataAccess.ExecuteDataReader(sql);
            if (reader.Read())
            {
                id = reader.GetInt32(0);
            }
            reader.Close();
            return id;
        }

      
	}
	#endregion

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -