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 Force.
///
public class Force : Common
{
protected string countryid;
protected string countryRus;
protected string image;
protected int forcetype;
protected string aircraftid;
protected string href;
protected void PrintForce()
{
SqlConnection connForce = new SqlConnection(connString);
SqlCommand cmdForce = new SqlCommand(("SELECT * FROM V_Force WHERE countryid='"+countryid+"'"), connForce);
connForce.Open();
SqlDataReader drForce;
drForce = cmdForce.ExecuteReader();
Response.Write ("
");
if (drForce.Read())
{
Response.Write ("| ");
Response.Write (" "+drForce["ForceName"].ToString()+"
|
|
");
forcetype = Convert.ToInt32(drForce["ForceType"]);
if (drForce["AircraftID"].ToString() != "")
{
href = " "+drForce["ACName"].ToString()+"";
}
else
{
href = " "+drForce["ACName"].ToString();
}
Response.Write (""+href+" | ");
Response.Write (""+drForce["number"].ToString()+" | |
");
while (drForce.Read())
{
if (forcetype != Convert.ToInt32(drForce["ForceType"]))
{
Response.Write (" |
|
| ");
Response.Write (" "+drForce["ForceName"].ToString()+"
|
|
");
forcetype = Convert.ToInt32(drForce["ForceType"]);
if (drForce["AircraftID"].ToString() != "")
{
href = " "+drForce["ACName"].ToString()+"";
}
else
{
href = " "+drForce["ACName"].ToString();
}
Response.Write (""+href+" | ");
Response.Write (""+drForce["number"].ToString()+" | |
");
}
else
{
if (drForce["AircraftID"].ToString() != "")
{
href = " "+drForce["ACName"].ToString()+"";
}
else
{
href = " "+drForce["ACName"].ToString();
}
Response.Write (""+href+" | ");
Response.Write (""+drForce["number"].ToString()+" | |
");
}
}
}
else
{
Response.Write ("Отсутствуют данные | ");
}
Response.Write (" |
");
drForce.Close();
connForce.Close();
}
protected void PrintAccidentForce()
{
Transform("AccidentForce.xml?CountryForce="+countryid.ToString(),"AccidentForce.xsl",this.Response,1);
}
private void Page_Load(object sender, System.EventArgs e)
{
//Загрузить верхнее меню
TopMenu();
//Получить countryid из строки запроса
if (Request.QueryString["countryid"] == null)
{
Response.Redirect("CountryForce.aspx");
}
else
{
countryid = Request.QueryString["countryid"].ToString();
}
SqlConnection connCountry = new SqlConnection(connString);
SqlCommand cmdCountry = new SqlCommand(("SELECT countryRus, image FROM V_Force WHERE countryid='"+countryid+"'"), connCountry);
connCountry.Open();
SqlDataReader drCountry;
drCountry = cmdCountry.ExecuteReader();
if (drCountry.Read())
{
countryRus = drCountry["countryRus"].ToString();
image = drCountry["image"].ToString();
}
else
{
Response.Write ("Ошибка на сервере");
}
drCountry.Close();
connCountry.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
}
}