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;
namespace AeroNet
{
///
/// Summary description for Airlines.
///
public class Airlines : Common
{
protected string L;
protected string id;
protected string txtName;
protected string txtIATA;
protected string txtICAO;
protected string txtNote;
protected string txtBase;
protected string txtAddress;
protected string txtCity;
protected string txtCountry;
protected string txtPhone;
protected string txtFax;
protected string txtSITA;
protected string txtEmail;
protected string txtWeb;
protected string txtAircraft;
protected string ErrorString;
protected void PrintAirlines()
{
//Вывод кода IATA
if (txtIATA != "")
{Response.Write ("
Код IATA : | "+txtIATA+" | |
");
}
//Вывод кода ICAO
if (txtICAO != "")
{Response.Write ("Код ICAO : | "+txtICAO+" | |
");
}
//Вывод Note
if (txtNote != "")
{Response.Write ("О компании : | "+txtNote+" | |
");
}
//Вывод Base
if (txtBase != "")
{Response.Write (" | "+txtBase+" | |
");
}
//Вывод Address
if (txtAddress != "")
{
Response.Write ("Адрес : | "+txtAddress+" ");
//Вывод City
if (txtCity != "")
{Response.Write (""+txtCity+" ");}
//Вывод Country
if (txtCountry != "")
{Response.Write (""+txtCountry+" ");}
Response.Write (" | |
");
}
//Вывод Phone
if (txtPhone != "")
{
Response.Write ("Телефон : | "+txtPhone+" | |
");
}
//Вывод Fax
if (txtFax != "")
{
Response.Write ("Факс : | "+txtFax+" | |
");
}
//Вывод SITA
if (txtSITA != "")
{
Response.Write ("SITA : | "+txtSITA+" | |
");
}
//Вывод Email
if (txtEmail != "")
{
Response.Write ("E-mail : | "+txtEmail+" | |
");
}
//Вывод Web
if (txtWeb != "")
{
Response.Write ("Web : | "+txtWeb+" | |
");
}
//Вывод списка самолетов
if (txtAircraft != "")
{
Response.Write ("Парк ВС : | "+txtAircraft+" | |
");
}
}
protected void PrintAccidentAirlines()
{
Transform("AccidentAirlines.xml?id="+id.ToString(),"AccidentAirlines.xsl",this.Response,1);
}
private void Page_Load(object sender, System.EventArgs e)
{
//Загрузить верхнее меню
TopMenu();
//Получить L из строки запроса
if (Request.QueryString["L"] == null)
{
L = "A";
}
else
{
L = Request.QueryString["L"];
}
//Получить id из строки запроса
if (Request.QueryString["ID"] == null)
{
id = "";
}
else
{
id = Request.QueryString["ID"];
}
// Соединение с SQL-сервером
SqlConnection connAirlines = new SqlConnection(connString);
//Создать команду
SqlCommand cmdAirlines = new SqlCommand(("SELECT * FROM V_Airlines WHERE ID='"+id+"'"), connAirlines);
//Открыть соединение
connAirlines.Open();
//Создать DataReader и считать данные
SqlDataReader drAirlines;
drAirlines = cmdAirlines.ExecuteReader();
if (drAirlines.Read())
{
txtName = drAirlines["Name"].ToString();
if (drAirlines["IATA"] != null)
{txtIATA = drAirlines["IATA"].ToString();}
if (drAirlines["ICAO"] != null)
{txtICAO = drAirlines["ICAO"].ToString();}
if (drAirlines["Note"] != null)
{txtNote = drAirlines["Note"].ToString();}
if (drAirlines["Base"] != null)
{txtBase = drAirlines["Base"].ToString();}
if (drAirlines["Address"] != null)
{txtAddress = drAirlines["Address"].ToString();}
if (drAirlines["City"] != null)
{txtCity = drAirlines["City"].ToString();}
if (drAirlines["Country"] != null)
{txtCountry = drAirlines["Country"].ToString();}
if (drAirlines["Phone"] != null)
{txtPhone = drAirlines["Phone"].ToString();}
if (drAirlines["Fax"] != null)
{txtFax = drAirlines["Fax"].ToString();}
if (drAirlines["SITA"] != null)
{txtSITA = drAirlines["SITA"].ToString();}
if (drAirlines["Email"] != null)
{txtEmail = drAirlines["Email"].ToString();}
if (drAirlines["Web"] != null)
{txtWeb = drAirlines["Web"].ToString();}
if (drAirlines["Aircraft"] != null)
{txtAircraft = drAirlines["Aircraft"].ToString();}
}
else
{
ErrorString = "Ошибка сервера ...
";
}
//Закрываем DataReader и соединение
drAirlines.Close();
connAirlines.Close();
}
#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
}
}