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

📄 addresslistadd.aspx.cs

📁 很不错的公文流转系统
💻 CS
字号:
/**************************************************************************************
作者:蒲丰. 
创建日期:2003-11-24
修改者:
修改日期:
修改部分:
类功能: 通讯录的增加功能.
****************************/

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;

namespace OI.AddressList
{
	/// <summary>
	/// AddressListAdd 的摘要说明。
	/// </summary>
	public class AddressListAdd : OI.PageBase 
	{
		protected System.Web.UI.WebControls.TextBox TextBoxReletioner;
		protected System.Web.UI.WebControls.TextBox TextBoxAddress;
		protected System.Web.UI.WebControls.TextBox TextBoxTel;
		protected System.Web.UI.WebControls.TextBox TextBoxEmail;
		protected System.Web.UI.WebControls.TextBox TextBoxCompany;
		protected System.Web.UI.WebControls.DropDownList DropDownListsex;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
		protected System.Web.UI.WebControls.ImageButton ImageButton1;
		protected System.Web.UI.WebControls.ImageButton ImageButton2;
		protected System.Web.UI.WebControls.ImageButton ImageButton3;
	    protected OI.DatabaseOper.DatabaseConnect Dbc=new OI.DatabaseOper.DatabaseConnect (); 
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面		
			if (Session["userid"]==null)
			{
				Response.Write ("<script>alert('超时,请重新登录');top.location.href='../userpass.aspx';</script>");
				return ;
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
			this.ImageButton2.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton2_Click);
			this.ImageButton3.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton3_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button1_Click(object sender, System.EventArgs e)
		{
			

			
		}
		private void ADD()
		{
			string str ="select count(*) from AddressList where Reletioner ='"+TextBoxReletioner.Text .Replace ("'","''") +"'";
			if (int.Parse (Dbc.GetValueBySql(str) )>0)
			{
				Page.RegisterStartupScript ("","<script>alert('这个联系人己经存在!')</script>");
				return ;
			}
			str = " insert AddressList values('"+TextBoxReletioner.Text .Replace ("'","''")+"',";
			str +=   DropDownListsex.SelectedValue+  ",";
			str +=  "'"+TextBoxAddress.Text .Replace ("'","''")+"',";
			str +=  "'"+TextBoxTel.Text+"',";
			str +=  "'"+TextBoxEmail.Text+"',";
			str += "'" +TextBoxCompany.Text.Replace ("'","''")+"',";
			str += Session["userid"] ; 	
			str +=")";
			Dbc.ExecuteSQL (str);
		}

		private void ButtonSaveView_Click(object sender, System.EventArgs e)
		{
			
		}

		private void ButtonSaveAdd_Click(object sender, System.EventArgs e)
		{
		    ADD();
			Response.Redirect ("AddressListAdd.aspx");
		}

		private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			ADD();
			Response.Redirect ("AddressList.aspx");
		}

		private void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			ADD();
			string str ="select ListID from AddressList where Reletioner ='"+TextBoxReletioner.Text .Replace ("'","''") +"'";
			object o=Dbc.GetValueBySql(str) ;
			
			Response.Redirect ("AddressListView.aspx?id="+o.ToString() );
		}

		private void ImageButton3_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			ADD();
			Response.Redirect ("AddressListAdd.aspx");
		}
	}
}

⌨️ 快捷键说明

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