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.Xml.Xsl; namespace AeroNet { /// /// Summary description for Color. /// public class Color : Common { protected int ptype; protected int parent; protected string name; protected string CategoryName=""; protected string ParentName=""; protected string Manufacturer=""; protected string logo=""; protected int mnum; protected void GetType (int type) { string strSQL = "SELECT CategoryName FROM V_Category WHERE CategoryType ="+type.ToString(); SqlConnection Conn = new SqlConnection(connString); SqlCommand Command = new SqlCommand(strSQL,Conn); Conn.Open(); try { SqlDataReader Reader; Reader = Command.ExecuteReader(); if(Reader.Read()) { name = Reader.GetString(0); } Reader.Close(); } catch { Response.Redirect("error.aspx",true); } finally { Conn.Close(); } } protected void GetParentType (int type) { string strSQL = "SELECT parent FROM V_Category WHERE CategoryType ="+type.ToString(); SqlConnection Conn = new SqlConnection(connString); SqlCommand Command = new SqlCommand(strSQL,Conn); Conn.Open(); try { SqlDataReader Reader; Reader = Command.ExecuteReader(); if(Reader.Read()) { parent = Reader.GetInt32(0); } Reader.Close(); } catch { Response.Redirect("error.aspx",true); } finally { Conn.Close(); } } protected void PrintManufacturer() { try { XsltArgumentList xslArg = new XsltArgumentList(); xslArg.AddParam("mnum","",mnum.ToString()); Transform("Manufacturer.xml?ptype="+ptype.ToString(),"ColorManufacturer.xsl",xslArg,this.Response,1); } catch { Response.Redirect("error.aspx",true); } } private void Page_Load(object sender, System.EventArgs e) { //Загрузить верхнее меню TopMenu(); try { //Получить ptype из строки запроса if (Request.QueryString["ptype"] == null) { Response.Redirect("Catalog.aspx",true); } else { ptype = Convert.ToInt32(Request.QueryString["ptype"]); GetType (ptype); CategoryName = name.ToString(); GetParentType (ptype); GetType (parent); ParentName = name.ToString(); } //Получить mnum из строки запроса if (Request.QueryString["mnum"] == null) { string strSQL = "SELECT TOP 1 fullname, logo, mnum FROM V_ModelManufacturer WHERE CategoryType = "+ptype.ToString(); SqlConnection Conn = new SqlConnection(connString); SqlCommand Command = new SqlCommand(strSQL,Conn); Conn.Open(); try { SqlDataReader Reader; Reader = Command.ExecuteReader(); if(Reader.Read()) { Manufacturer = Reader.GetString(0); logo = Reader.GetString(1); mnum = Reader.GetInt32(2); } Reader.Close(); } catch { Response.Redirect("error.aspx",true); } finally { Conn.Close(); } } else { mnum = Convert.ToInt32(Request.QueryString["mnum"]); string strSQL = "SELECT fullname, logo FROM V_ModelManufacturer WHERE mnum = "+mnum.ToString(); SqlConnection Conn = new SqlConnection(connString); SqlCommand Command = new SqlCommand(strSQL,Conn); Conn.Open(); try { SqlDataReader Reader; Reader = Command.ExecuteReader(); if(Reader.Read()) { Manufacturer = Reader.GetString(0); logo = Reader.GetString(1); } Reader.Close(); } catch { Response.Redirect("error.aspx",true); } finally { Conn.Close(); } } } catch { Response.Redirect("Catalog.aspx",true); } } #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 } }