Asp.net源码专业站
首页->商务办公->Asp.net简单会议事务系统>>addmeeting.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net简单会议事务系统
当前文件:文件类型 SimpleMeeting/addmeeting.aspx.cs[6K,2009-6-12 11:54:08]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12 13//该源码下载自www.51aspx.com(51aspx.com) 14public partial class addmeeting : System.Web.UI.Page 15{ 16 ArrayList year, month, day,hour,m; 17 int i; 18 SqlConnection cn; 19 protected void Page_Load(object sender, EventArgs e) 20 { 21 if (!Page.IsPostBack) 22 { 23 24 cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]); 25 cn.Open(); 26 SqlCommand cmd = new SqlCommand("select * from userinfo",cn); 27 SqlDataReader dr = cmd.ExecuteReader(); 28 this.CheckBoxList1.DataSource = dr; 29 this.CheckBoxList1.DataTextField = "username"; 30 this.CheckBoxList1.DataBind(); 31 dr.Close(); 32 cn.Close(); 33 year = new ArrayList(); 34 month = new ArrayList(); 35 day = new ArrayList(); 36 hour = new ArrayList(); 37 m=new ArrayList (); 38 39 for (i =2000; i <=2100; i++) 40 year.Add(i.ToString()); 41 for (i = 1; i <= 12; i++) 42 month.Add(i.ToString()); 43 for (i = 1; i <= 31; i++) 44 day.Add(i.ToString()); 45 for (i = 1; i <= 24; i++) 46 hour.Add(i.ToString ()); 47 for (i = 00; i <= 59; i++) 48 m.Add(i.ToString()); 49 50 ddlyear.DataSource = year; 51 ddlyear.DataBind(); 52 ddlyear.Text = System.DateTime.Now.Year.ToString (); 53 DropDownList1 . Text = System.DateTime.Now.Year.ToString(); 54 55 ddlmonth.DataSource = month; 56 ddlmonth.DataBind(); 57 ddlmonth.Text = System.DateTime.Now.Month.ToString(); 58 DropDownList2 . Text = System.DateTime.Now.Month.ToString(); 59 60 ddlday.DataSource = day; 61 ddlday.DataBind(); 62 ddlday.Text = System.DateTime.Now.Day.ToString(); 63 DropDownList3 .Text = System.DateTime.Now.Day.ToString(); 64 65 ddlhour.DataSource = hour; 66 ddlhour.DataBind(); 67 ddlhour.Text = System.DateTime.Now.Hour.ToString(); 68 DropDownList4.Text = System.DateTime.Now.Hour.ToString(); 69 ddlm.DataSource = m; 70 ddlm.DataBind(); 71 ddlm.Text = System.DateTime.Now.Minute.ToString(); 72 73 this.DropDownList1.DataSource = year; 74 this.DropDownList1.DataBind(); 75 76 this.DropDownList2.DataSource = month; 77 this.DropDownList2.DataBind(); 78 79 this.DropDownList3.DataSource = day; 80 this.DropDownList3.DataBind(); 81 82 this.DropDownList4.DataSource =hour ; 83 this.DropDownList4.DataBind(); 84 this.DropDownList5.DataSource =m; 85 this.DropDownList5.DataBind(); 86 DropDownList5.Text = System.DateTime.Now.Minute.ToString(); 87 88 } 89 90 } 91 protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) 92 { 93 string adminname = args.Value; 94 cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]); 95 cn.Open(); 96 SqlCommand cmd = new SqlCommand("select count(*)from meeting where name='" + adminname + "'", cn); 97 int count = Convert.ToInt32(cmd.ExecuteScalar()); 98 if (count > 0) 99 { 100 args.IsValid = false; 101 this.Labmessage.Text = ""; 102 103 } 104 else 105 { 106 args.IsValid = true; 107 108 } 109 110 cn.Close(); 111 112 } 113 protected void ddlmonth_SelectedIndexChanged(object sender, EventArgs e) 114 { 115 int[] numbers = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 116 if ((Convert.ToInt32(ddlyear.SelectedItem.Text.ToString()) % 4) == 0) 117 numbers[1] = 29; 118 119 day = new ArrayList(); 120 for (i = 1; i <= numbers[Convert.ToInt32(ddlmonth.SelectedItem.Text.ToString()) - 1]; i++) 121 day.Add(i.ToString()); 122 ddlday.DataSource = day; 123 ddlday.DataBind(); 124 125 } 126 protected void Button2_Click(object sender, EventArgs e) 127 { 128 this.Label1.Text = ""; 129 if (Page.IsValid) 130 { 131 for (int i = 0; i <= CheckBoxList1.Items.Count - 1; i++) 132 { 133 if (this.CheckBoxList1.Items[i].Selected) 134 { 135 this.Label1.Text += this.CheckBoxList1.Items[i].Text.ToString() + ","; 136 } 137 } 138 try 139 { 140 cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]); 141 cn.Open(); 142 SqlCommand cmd = new SqlCommand("insert into meeting(name,addr,begintime,endtime,person,builder,content)values('" + this.txtname.Text.ToString().Trim() + "','" + this.ddlroompos.SelectedItem.Value.ToString() + "','" + this.ddlyear.SelectedItem.Value.ToString() + "-" + this.ddlmonth.SelectedItem.Value.ToString() + "-" + this.ddlday.SelectedItem.Value + " " + this.ddlhour.SelectedItem.Value.ToString() + ":" + this.ddlm.SelectedItem.Value.ToString() + "','" + this.DropDownList1.SelectedItem.Value.ToString() + "-" + this.DropDownList2.SelectedItem.Value.ToString() + "-" + this.DropDownList3.SelectedItem.Value.ToString() + " " + this.DropDownList4.SelectedItem.Value.ToString() + ":" + this.DropDownList5.SelectedItem.Value.ToString() + "','" + this.Label1.Text.Trim() + "','" + Convert.ToString(Session["username"]) + "','" + this.txtnote.Text.Trim() + "')", cn); 143 cmd.ExecuteNonQuery(); 144 this.HyperLink1.Visible = true; 145 this.Labmessage.Text = "添加会议成功"; 146 147 } 148 catch 149 { 150 this.Labmessage.Text = "服务器忙,请一会在试!"; 151 } 152 finally 153 { 154 cn.Close(); 155 } 156 } 157 } 158 protected void Button1_Click(object sender, EventArgs e) 159 { 160 this.txtname.Text = ""; 161 this.txtnote.Text = ""; 162 this.txtname.Focus(); 163 } 164 protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) 165 { 166 int[] numbers = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 167 if ((Convert.ToInt32(this.DropDownList1 .SelectedItem.Text.ToString()) % 4) == 0) 168 numbers[1] = 29; 169 170 day = new ArrayList(); 171 for (i = 1; i <= numbers[Convert.ToInt32(this.DropDownList2 .SelectedItem.Text.ToString()) - 1]; i++) 172 day.Add(i.ToString()); 173 this.DropDownList3 .DataSource = day; 174 this.DropDownList3 .DataBind(); 175 176 } 177} 178
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Asp.net简单会议事务系统
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146