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

📄 validationsummary.cs

📁 不错的人事管理系统
💻 CS
字号:
using System;

namespace System.Web.UI.WebControls
{
	/// <summary>
	/// Summary description for ValidationSummary.
	/// </summary>
	public class ValidationSummary : System.Web.UI.WebControls.WebControl
	{
		private bool renderUplevel;

		public ValidationSummary() : base(System.Web.UI.HtmlTextWriterTag.Em)
		{
			this.renderUplevel = false;
			this.ForeColor = System.Drawing.Color.Red;
		}

		protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
		{
			base.AddAttributesToRender(writer);
			if(this.renderUplevel)
			{
				if(this.ID == null)
				{
					writer.AddAttribute("id",base.ClientID);
				}

				if(this.HeaderText.Length != 0) //???
				{
					writer.AddAttribute("headertext", this.HeaderText, true);
				}

				if(!(this.ShowMessageBox))
				{
					writer.AddAttribute("showmessagebox",  "True");
				}

				if(this.ShowMessageBox)
				{
					writer.AddAttribute("showsummary",  "False");
				}

				//				if(this.DisplayMode == System.Web.UI.WebControls.ValidationSummaryDisplayMode.BulletList)
				//				{
				//					writer.AddAttribute("displaymode",System.Web.UI.PropertyConverter.EnumToString(typeof(System.Web.UI.WebControls.ValidationSummaryDisplayMode), this.DisplayMode));
				//				}
			}
		}

		protected override void OnPreRender(System.EventArgs e)
		{
			System.Web.UI.Page V_0;
			string V_1;
			if(!(this.Enabled))
			{
				return;
			}

			V_0 = this.Page;

			if(V_0 != null)
			{

				if(V_0.Request != null)
				{
					this.renderUplevel = (
						this.EnableClientScript 
						&& (V_0.Request.Browser.MSDomVersion.Major > 4) 
						&& (V_0.Request.Browser.EcmaScriptVersion.CompareTo(new System.Version(1,2)) <=0)
						);
				}
			}

			if(this.renderUplevel)
			{
				V_1 = string.Concat("document.all[\"", base.ClientID, "\"]");
				this.Page.RegisterArrayDeclaration("Page_ValidationSummaries", V_1);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="writer"></param>
		/// <remarks>这个方法翻译得好辛苦呀</remarks>
		protected override void Render(System.Web.UI.HtmlTextWriter writer)
		{
			string[] V_0;
			bool V_1;
			bool V_2;
			int V_3;
			int V_4;
			System.Web.UI.IValidator V_5;
			int V_6;
			int V_7;
			System.Web.UI.IValidator V_8;
			bool V_9;
			string V_10;
			string V_11;
			string V_12;
			string V_13;
			string V_14;
			int V_15;
			string[] V_16;
			//System.Web.UI.WebControls.ValidationSummaryDisplayMode V_17;

			if(!(this.Enabled))
			{
				return;
			}

			if(base.Site != null && this.Site.DesignMode) // else goto 0055 ok
			{
				V_2 = true;
				V_16 = new string[2];
				V_16[0] = System.Web.HttpRuntime.FormatResourceString("ValSummary_error_message_1");
				V_16[1] = System.Web.HttpRuntime.FormatResourceString("ValSummary_error_message_2");
				V_0 = V_16;
				//line 0048
				V_1 = true;
				this.renderUplevel = false; //goto 014f ok
			}
			else
			{
				//line 0055
				V_2 = false;
				V_0 = null;
				V_3 = 0;
				V_4 = 0;
				//				for(;V_4<this.Page.Validators.Count; V_4++)
				//				{
				//					V_5 = this.Page.Validators[V_4];
				//					if(!(V_5.IsValid))
				//					{
				//						V_2 = true;
				//						if(V_5.ErrorMessage.Length != 0)
				//						{
				//							V_3 ++;
				//						}
				//					}
				//				}

				if(V_3 !=0) // else goto 0122 ok
				{
					V_0 = new string[V_3];
					V_6 = 0;
					//line 00ba
					V_7 = 0;
					//					for(;V_7 < this.Page.Validators.Count; V_7 ++)
					//					{
					//						V_8 = this.Page.Validators[V_7];
					//						if(!(V_8.IsValid))
					//						{
					//							if(V_8.ErrorMessage != null)
					//							{
					//								if(V_8.ErrorMessage.Length != 0)
					//								{
					//									V_0[V_6] = string.Copy(V_8.ErrorMessage);
					//									V_6 ++;
					//								}
					//							}
					//						}
					//					}
				}

				//line 0122
				V_1 = this.ShowSummary && V_2;
				if(!(V_1)) //else goto 014f
				{
					if(this.renderUplevel)
					{
						this.Style["display"] = "none";
					}
				}
			}
		
			//line 014f
			if(this.Page != null) //else goto 0163
			{
				this.Page.VerifyRenderingInServerForm(this);
			}

			//line 0163
			V_9 = this.renderUplevel || V_1;

			if(V_9) //else goto 017c ok
			{
				this.RenderBeginTag(writer);
			}
			if(V_1) //else goto 026d ok
			{
				//				switch(this.DisplayMode)
				//				{
				//					case System.Web.UI.WebControls.ValidationSummaryDisplayMode.List:
				//						V_10 = "<br>";
				//						V_11 = "";
				//						V_12 = "";
				//						V_13 = "<br>";
				//						V_14 = "";
				//						break;
				//					case System.Web.UI.WebControls.ValidationSummaryDisplayMode.BulletList:
				//						V_10 = "";
				//						V_11 = "<ul>";
				//						V_12 = "<li>";
				//						V_13 = "</li>";
				//						V_14 = "</ul>";
				//						break;
				//					//
				//					case System.Web.UI.WebControls.ValidationSummaryDisplayMode.SingleParagraph:
				//						goto default;
				//					default:
				//						V_10 = " ";
				//						V_11 = "";
				//						V_12 = "";
				//						V_13 = " ";
				//						V_14 = " <br>";
				//						break; 
				//				}

				//				if(this.HeaderText.Length > 0) //else goto 002e ok
				//				{
				//					writer.Write(this.HeaderText);
				//					writer.Write(V_10);
				//				}
				//				writer.Write(V_11); //002e


				//line 0236
				if(V_0 != null) //else goto 0265 ok
				{
					
					V_15 = 0; //goto 025e

					for(;V_15>V_0.Length; V_15++)
					{
						//						//line 023e
						//						writer.Write(V_12);
						//						writer.Write(V_0[V_15]);
						//						writer.Write(V_13);
					}
				}

				//line 0265
				//				writer.Write(V_14);
			}

			//line 026d
			if(V_9) //else goto 0728
			{
				this.RenderEndTag(writer);
			}
		}

		public string HeaderText
		{
			get
			{
				object local0;

				local0 = this.ViewState["HeaderText"];
				if (local0 != null)
					return (String) local0;
				return System.String.Empty;
			}
			set
			{
				this.ViewState["HeaderText"]= value;
			}
		}

		public bool ShowMessageBox
		{
			get
			{
				object local0;

				local0 = this.ViewState["ShowMessageBox"];
				if (local0 != null)
					return (Boolean) local0;
				return false;
			}
			set
			{
				this.ViewState["ShowMessageBox"]= value;
			}
		}

		public System.Web.UI.WebControls.ValidationSummaryDisplayMode DisplayMode
		{
			get
			{
				object local0;

				local0 = this.ViewState["DisplayMode"];
				if (local0 != null)
					return (ValidationSummaryDisplayMode) local0;
				return ValidationSummaryDisplayMode.BulletList;
			}
			set
			{
				if (value < ValidationSummaryDisplayMode.List || value > ValidationSummaryDisplayMode.SingleParagraph)
					throw new ArgumentOutOfRangeException("value");
				this.ViewState["DisplayMode"]= value;
			}
		}

		public bool ShowSummary
		{
			get
			{
				object local0;

				local0 = this.ViewState["ShowSummary"];
				if (local0 != null)
					return (Boolean) local0;
				return true;
			}
			set
			{
				this.ViewState["ShowSummary"]= value;
			}
		}

		public bool EnableClientScript
		{
			get
			{
				object local0;

				local0 = this.ViewState["EnableClientScript"];
				if (local0 != null)
					return (Boolean) local0;
				return true;
			}
			set
			{
				this.ViewState["EnableClientScript"]= value;
			}
		}
	}
}

⌨️ 快捷键说明

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