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

📄 demo.aspx.cs

📁 可供共享学习.net环境下生产管理的实现
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Botheighten.Yanghui.BusinessFacade;
using Botheighten.Yanghui.Framework;
using Botheighten.Yanghui.BusinessRules;

namespace Botheighten.Yanghui.Web
{
	/// <summary>
	/// Demo 的摘要说明。
	/// </summary>
	public class Demo : BasePage
	{
		protected System.Web.UI.WebControls.Label lblTitle;
		protected System.Web.UI.WebControls.Label lblCode;
		protected System.Web.UI.WebControls.TextBox txtCode;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.TextBox txtActive;
		protected System.Web.UI.WebControls.Button btnActive;
		protected System.Web.UI.WebControls.Button btnDemo;
		protected System.Web.UI.WebControls.ValidationSummary ErrorSummary;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
		protected System.Web.UI.WebControls.Label lblExpire;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Label lblMessage;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			this.lblMessage.Visible=false;
			if(Application["Expire"]!=null && Application["Expire"].ToString()=="Y")
				this.lblExpire.Text ="此试用版已经过期,请联系版权所有进获取激活码";
			else if(Application["Author"]!=null && Application["Author"].ToString()=="Y")
				this.lblExpire.Text="此版本已经激活,谢谢对本系统的支持";
			else
				this.lblExpire.Text="";
			
			if(!Page.IsPostBack)
			{
				this.txtCode.Text = Enc.GetCPUInfo();
				if(Application["Author"]!=null && Application["Author"].ToString()=="Y")
				{
					Config config=ConfigSystem.GetConfig();
					if(config!=null)
						this.txtActive.Text =config.Author; 
					this.btnDemo.Enabled=false;
				}
				else
				{
					this.btnDemo.Enabled=true;
				}
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			this.DemoCheck=false;
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.btnActive.Click += new System.EventHandler(this.btnActive_Click);
			this.btnDemo.Click += new System.EventHandler(this.btnDemo_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void btnActive_Click(object sender, System.EventArgs e)
		{
			string act=this.txtActive.Text.Trim();
			string cpu=Enc.GetCPUInfo();
			string re=Enc.GetActive(cpu);
			if(act==re)
			{
				Config config=ConfigSystem.GetConfig();
				if(config!=null)
				{
					config.Author=act;
					config.Save();
				}
				else
				{
					config=new Config();
					config.Id="1";
					config.IsFirst="Y";
					config.PrintCount=20;
					config.UserDate=Enc.Encrypt(System.DateTime.Now.ToShortDateString(),Enc.EncKey(cpu));
					config.Save();
				}
				Application["Author"]="Y";
				this.lblMessage.Text="激活成功,感谢你对本系统的支持";
				this.lblMessage.Visible=true;
			}
			else
			{
				this.lblMessage.Text="您的激活码不正确";
				this.lblMessage.Visible=true;
			}
		}

		private void btnDemo_Click(object sender, System.EventArgs e)
		{
			Config config=ConfigSystem.GetConfig();
			string cpu=Enc.GetCPUInfo();
			if(config!=null)
			{
				if(config.UserDate=="")
				{
					config.UserDate=Enc.Encrypt(System.DateTime.Now.ToShortDateString(),Enc.EncKey(cpu));
					config.Save();
				}
			}
			else
			{
				
				config=new Config();
				config.Id="1";
				config.IsFirst="Y";
				config.PrintCount=20;
				config.UserDate=Enc.Encrypt(System.DateTime.Now.ToShortDateString(),Enc.EncKey(cpu));
				config.Save();
			}
			Application["Demo"]="Y";
			Response.Redirect("Welcome.aspx",true);
		}
	}
}

⌨️ 快捷键说明

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