usingSystem;usingSystem.Collections;ponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Web;usingSystem.Web.SessionState;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.HtmlControls;usingSystem.Data.SqlClient;usingSystem.Configuration;namespaceOfficeOnline{///<summary>/// Advice 的摘要说明。
///</summary>public class Advice :System.Web.UI.Page{protectedSystem.Web.UI.WebControls.ImageButton ImageButton1; protectedSystem.Web.UI.WebControls.DataGrid dgdadvice;protectedSystem.Web.UI.WebControls.ImageButton ImageButton2; private void Page_Load(objectsender, System.EventArgs e){if (!IsPostBack){//创建数据库连接和命令对象SqlConnection objconn= new SqlConnection(ConfigurationSettings.AppSettings["connstr"]);objconn.Open();stringobjsql="Select * from Advice";SqlDataAdapter da = new SqlDataAdapter(objsql,objconn); //创建并填充DataSetDataSet ds = newDataSet();da.Fill(ds);dgdadvice.DataSource=ds;dgdadvice.DataBind();objconn.Close();}}#region Web 窗体设计器生成的代码override protected voidOnInit(EventArgs e){//// CODEGEN: 该调用是 Web 窗体设计器所必需的。
//InitializeComponent();base.OnInit(e);}///<summary>/// 设计器支持所需的方法- 不要使用代码编辑器修改/// 此方法的内容。
///</summary>private void InitializeComponent(){this.ImageButton1.Click+= newSystem.Web.UI.ImageClickEventHandler(this.ImageButton1_Click); this.ImageButton2.Click+= newSystem.Web.UI.ImageClickEventHandler(this.ImageButton2_Click); this.Load += newSystem.EventHandler(this.Page_Load);}#endregionprivate void ImageButton2_Click(objectsender,System.Web.UI.ImageClickEventArgs e){Response.Redirect("AddAdvice.aspx");}private void ImageButton1_Click(objectsender,System.Web.UI.ImageClickEventArgs e){Response.Redirect("Default.aspx");}}}usingSystem;usingSystem.Collections;ponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Web;usingSystem.Web.SessionState;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.HtmlControls;usingSystem.Data.SqlClient;usingSystem.Configuration ;namespaceOfficeOnline{///<summary>/// SchByDay 的摘要说明。
///</summary>public class SchByDay: System.Web.UI.Page{bel lblErr;protectedSystem.Web.UI.WebControls.ImageButton cmdQuery;protectedSystem.Web.UI.WebControls.DropDownList dropDay;protectedSystem.Web.UI.WebControls.DropDownList dropMonth;protectedSystem.Web.UI.WebControls.DataGrid dgdsch;protectedSystem.Web.UI.WebControls.Button btnadd;protectedSystem.Web.UI.WebControls.Button Button2;protectedSystem.Web.UI.WebControls.TextBox txtYear;private void Page_Load(objectsender, System.EventArgs e){if (!IsPostBack){BindGrid();}}public void BindGrid(){//创建数据库连接和命令对象SqlConnectionobjconn= newSqlConnection(ConfigurationSettings.AppSettings["connstr"]);SqlCommandobjcmd = new SqlCommand("AllSch",objconn);//设定命令类型mandType=CommandType.StoredProcedure ;//添加参数//员工编号SqlParameterparamEmpID= new SqlParameter("@EmpID",SqlDbType.Int);paramEmpID.Value=Convert.ToInt32(Session["EmpID"]);//paramEmpID.Value=1;objcmd.Parameters.Add(paramEmpID);//日程类型SqlParameterparamSchTypeID = new SqlParameter("@SchTypeID", SqlDbType.Int);paramSchTypeID.Direction=ParameterDirection.Output;objcmd.Parameters.Add(paramSchTypeID);//打开数据库连接objconn.Open();SqlDataReaderresult =objcmd.ExecuteReader(CommandBehavior.CloseConnection);dgdsch.DataSource=result;dgdsch.DataBind();}#region Web 窗体设计器生成的代码override protected voidOnInit(EventArgs e){//// CODEGEN: 该调用是 Web 窗体设计器所必需的。
//InitializeComponent();base.OnInit(e);}///<summary>/// 设计器支持所需的方法- 不要使用代码编辑器修改/// 此方法的内容。
///</summary>private void InitializeComponent(){this.cmdQuery.Click+= newSystem.Web.UI.ImageClickEventHandler(this.cmdQuery_Click);this.dgdsch.SelectedIndexChanged+= new System.EventHandler(this.dgdsch_SelectedIndexChanged);this.btnadd.Click += newSystem.EventHandler(this.btnadd_Click);this.Button2.Click += newSystem.EventHandler(this.Button2_Click);this.Load += newSystem.EventHandler(this.Page_Load);}#endregionpublic void DataGrid_Page(Objectsender,DataGridPageChangedEventArgs E) {dgdsch.CurrentPageIndex=E.NewPageIndex ;BindGrid();}private void cmdAddNew_Click(objectsender,System.Web.UI.ImageClickEventArgs e){//Response.Redirect("SchAddUp.aspx?day="&dateVar.ToShortDateString());}private void cmdQuery_Click(objectsender,System.Web.UI.ImageClickEventArgs e){if(txtYear.Text !=""){int year =Int32.Parse(txtYear.Text);intmonth=dropMonth.SelectedIndex+1;int day=Int32.Parse(dropDay.SelectedItem.Text );DateTimedateVar= new DateTime(year,month,day);//Response.Write(dateVar);//创建数据库连接和命令对象SqlConnection objconn= new SqlConnection(ConfigurationSettings.AppSettings["connstr"]);SqlCommand objcmd = new SqlCommand("SelSch",objconn); //设定命令类型mandType=CommandType.StoredProcedure ;//添加参数//员工编号SqlParameter paramEmpID= new SqlParameter("@EmpID",SqlDbType.Int);paramEmpID.Value=Convert.ToInt32(Session["EmpID"]);//paramEmpID.Value=1;objcmd.Parameters.Add(paramEmpID);//日程类型SqlParameter paramSchTypeID= new SqlParameter("@SchTypeID",SqlDbType.Int);paramSchTypeID.Direction=ParameterDirection.Output;objcmd.Parameters.Add(paramSchTypeID);//执行时间SqlParameterparamDate=new SqlParameter("@Date",SqlDbType.DateTime);paramDate.Value=dateVar.ToShortDateString();objcmd.Parameters.Add(paramDate);//打开数据库连接objconn.Open();SqlDataReader result=objcmd.ExecuteReader(CommandBehavior.CloseConnection);dgdsch.DataSource=result;dgdsch.DataBind();}else{lblErr.Text="请输入年份";}}private void btnadd_Click(objectsender, System.EventArgs e){Response.Redirect("AddSch.aspx");private void Button2_Click(objectsender, System.EventArgs e){Response.Redirect("Default.aspx");}private void dgdsch_SelectedIndexChanged(object sender,System.EventArgse){}using System;using Microsoft.Win32;using System.Windows.Forms;namespace mons{/// <summary>/// 注册表操作辅助类/// </summary>public sealed class RegistryHelper{#region 基础操作(读取和保存)private static string Software_Key = @"Software\DeepLand\OrderWater";/// <summary>/// Gets the value by registry key. If the key does not exist, return empty string. /// </summary>/// <param name="key">registry key</param>/// <returns>Returns the value of the specified key.</returns>public static string GetValue(string key){return GetValue(Software_Key, key);}/// <summary>/// Gets the value by registry key. If the key does not exist, return empty string. /// </summary>/// <param name="key">registry key</param>/// <returns>Returns the value of the specified key.</returns>public static string GetValue(string softwareKey, string key){const string parameter = "key";if (null == key){throw new ArgumentNullException(parameter);}string strRet = string.Empty;{RegistryKey regKey = Registry.CurrentUser.OpenSubKey(softwareKey); strRet = regKey.GetValue(key).ToString();}catch{strRet = "";}return strRet;}/// <summary>/// Saves the key and the value to registry./// </summary>/// <param name="key">registry key</param>/// <param name="value">the value of the key</param>/// <returns>Returns true if successful, otherwise return false.</returns> public static bool SaveValue(string key, string value){return SaveValue(Software_Key, key, value);}/// <summary>/// Saves the key and the value to registry./// </summary>/// <param name="key">registry key</param>/// <param name="value">the value of the key</param>/// <returns>Returns true if successful, otherwise return false.</returns> public static bool SaveValue(string softwareKey, string key, string value){const string parameter1 = "key";const string parameter2 = "value";if (null == key){throw new ArgumentNullException(parameter1);}if (null == value){throw new ArgumentNullException(parameter2);}bool bReturn = false;RegistryKey reg;reg = Registry.CurrentUser.OpenSubKey(softwareKey, true);if (null == reg){reg = Registry.CurrentUser.CreateSubKey(softwareKey);}reg.SetValue(key, value);return bReturn;}#endregion#region 自动启动程序设置public static bool CheckStartWithWindows(){RegistryKey regkey =Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion \Run");if (regkey != null && (string)regkey.GetValue(Application.ProductName, "null", RegistryValueOptions.None) != "null"){Registry.CurrentUser.Flush();return true;}Registry.CurrentUser.Flush();return false;}public static void SetStartWithWindows(bool startWin){RegistryKey regkey =Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion \Run", true);if (regkey != null){if (startWin){regkey.SetValue(Application.ProductName, Application.ExecutablePath, RegistryValueKind.String);}else{regkey.DeleteValue(Application.ProductName, false);}Registry.CurrentUser.Flush();}}#endregion}}using System;using System.Collections;using .Sockets;using ;using System.Text;using System.Web;using System.Text.RegularExpressions;using System.Collections.Generic;using System.IO;namespace mons{/// <summary>/// clsPublic 的摘要说明。