using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.SqlClient; 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.Globalization; namespace AeroNet { /// /// Summary description for CountryForce. /// public class Accident : Common { protected int type; protected int category; protected int id; protected int i; protected int j; protected string y; protected string images = ""; protected string PageTitle1 = ""; protected string PageTitle2 = ""; protected System.Web.UI.HtmlControls.HtmlForm Form1; protected string CrashPhoto="ftp://195.146.82.35/files/vit/crash/"; protected void PrintAccidentTitle() { Transform("AccidentTitle.xml?type="+type.ToString()+"&category="+category.ToString()+"&y="+y.ToString(),"AccidentTitle.xsl",this.Response,1); } protected void PrintAccident() { Transform("Accident.xml?id="+id.ToString(),"Accident.xsl",this.Response,1); } protected void PrintAccidentPhoto() { // Соединение с SQL-сервером SqlConnection connAccidentPhoto = new SqlConnection(connString); //Создать команду SqlCommand cmdAccidentPhoto = new SqlCommand(("SELECT ImagesCounter FROM V_Accident WHERE AccidentID="+id.ToString()), connAccidentPhoto); //Открыть соединение connAccidentPhoto.Open(); //Создать DataReader и считать данные SqlDataReader drAccidentPhoto; drAccidentPhoto = cmdAccidentPhoto.ExecuteReader(); if (drAccidentPhoto.Read()) { j = Convert.ToInt32(drAccidentPhoto["ImagesCounter"]); } //Закрываем DataReader и соединение drAccidentPhoto.Close(); connAccidentPhoto.Close(); for (i = 1; i <= j; i++) { Response.Write ("


"); } } protected void PrintAccidentNews() { Transform("AccidentNews.xml?id="+id.ToString(),"AccidentNews.xsl",this.Response,1); } private void Page_Load(object sender, System.EventArgs e) { //Загрузить верхнее меню TopMenu(); //Получить type (катастрофа/авария) из строки запроса if (Request.QueryString["type"] == null) { type = 1; } else { type = Convert.ToInt32(Request.QueryString["type"]); } //Получить category (авиация гражданская/военная/общего назначения) из строки запроса if (Request.QueryString["category"] == null) { category = 1; } else { category = Convert.ToInt32(Request.QueryString["category"]); } //Получить y (год) из строки запроса if (Request.QueryString["y"] == null) { y = "2004"; } else { y = Request.QueryString["y"].ToString(); } //Получить id (Accident ID) из строки запроса if (Request.QueryString["id"] != null) { id = Convert.ToInt32(Request.QueryString["id"]); } else { id = 0; } if (type == 1 & category == 1) { images = "civil-2.jpg"; PageTitle1 = "Гражданская авиация"; PageTitle2 = "Катастрофы"; } if (type == 2 & category == 1) { images = "civil-4.jpg"; PageTitle1 = "Гражданская авиация"; PageTitle2 = "Аварии"; } if (type == 1 & category == 2) { images = "military-3.jpg"; PageTitle1 = "Военная авиация"; PageTitle2 = "Катастрофы"; } if (type == 2 & category == 2) { images = "military-4.jpg"; PageTitle1 = "Военная авиация"; PageTitle2 = "Аварии"; } if (type == 1 & category == 3) { images = "general-3.jpg"; PageTitle1 = "Авиация общего назначения"; PageTitle2 = "Катастрофы"; } if (type == 2 & category == 3) { images = "general-4.jpg"; PageTitle1 = "Авиация общего назначения"; PageTitle2 = "Аварии"; } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }