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 System.Data.SqlClient;

namespace yn165.admin
{
	/// <summary>
	/// ad_viewmoney_send 的摘要说明。
	/// </summary>
	public class ad_viewmoney_send : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.ImageButton ImageButton1;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.Label Label5;
		protected System.Web.UI.WebControls.Label Label6;
		protected System.Web.UI.WebControls.Label Label7;
		protected System.Web.UI.WebControls.Label Label8;
		protected System.Web.UI.WebControls.Label Label9;
		protected System.Web.UI.WebControls.Label Label10;
		protected System.Web.UI.WebControls.Label Label11;
		protected System.Web.UI.WebControls.Label Label12;
		protected System.Web.UI.WebControls.DropDownList state;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack)
			{
				SqlConnection conn = new SqlConnection("server=211.155.254.117;database=yn165;uid=yn165;pwd=159753");
				conn.Open();
				string sql ="select * from money_send where id=" + Request["id"];
				SqlCommand cmd = new SqlCommand(sql,conn);
				SqlDataReader reader = cmd.ExecuteReader();
				if (reader.Read())
				{
					this.Label2.Text=reader.GetValue(1).ToString();
					this.Label3.Text=reader.GetValue(2).ToString();
					this.Label4.Text=reader.GetValue(3).ToString();
					this.Label5.Text=reader.GetValue(4).ToString();
					this.Label6.Text=reader.GetValue(5).ToString();
					this.Label7.Text=reader.GetValue(6).ToString();
					this.Label8.Text=reader.GetValue(7).ToString();
					this.Label9.Text=reader.GetValue(8).ToString();
					if (reader.GetValue(9).ToString()!="")
					{
						this.Label10.Text=reader.GetValue(9).ToString();
					}
					else
					{
						this.Label10.Text=reader.GetValue(10).ToString();
					}
					this.Label11.Text=reader.GetValue(11).ToString();
					this.Label12.Text=reader.GetValue(13).ToString();
					if(reader.GetValue(12).ToString()=="未确认")
					{
						this.state.SelectedIndex=0;
					}
					else
					{
						this.state.SelectedIndex=1;
					}
						

				}



		}
			// 在此处放置用户代码以初始化页面
		}

		#region Web Form Designer generated code
		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.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			string state="";
			if (this.state.SelectedIndex==0)
			{
				state="未确认";
			}
			else
			{
				state="已确认";
			}

			SqlConnection conn = new SqlConnection("server=211.155.254.117;database=yn165;uid=yn165;pwd=159753");
			conn.Open();
			string sql ="update money_send set state='" + state + "' where id=" + Request["id"];
			SqlCommand cmd1 = new SqlCommand(sql,conn);
			cmd1.ExecuteNonQuery();
			cmd1.Dispose();
			conn.Close();
			this.Response.Redirect("004.aspx");
		
		}
	}
}
