Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckAccount();
            if (!IsPostBack)
            {
                App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
                List <string> s  = db.GetIdU();
                IdU.DataSource = s;
                IdU.DataBind();
                if (s.Count > 0)
                {
                    IdU.SelectedIndex = 0;
                }
                IdU_SelectedIndexChanged(sender, e);
            }

            if (!IsPostBack)
            {
                App_Code.Base db    = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
                List <string> areas = db.GetWZAreas();
                Area.DataSource = areas;
                Area.DataBind();
                Area.SelectedIndex = 0;
                List <string> nodes = db.GetWZNodes(Area.SelectedValue);
                Node.DataSource = nodes;
                Node.DataBind();
                Node.SelectedIndex = 0;
                List <string> poz = db.GetWZPozition(Area.SelectedValue, Node.SelectedValue);
                Pozition.DataSource = poz;
                Pozition.DataBind();
                Pozition.SelectedIndex = 0;
            }
            if (!IsPostBack)
            {
                using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
                {
                    conn.Open();
                    //выбор производителя и модели
                    SqlCommand cmd;
                    cmd = new SqlCommand("select Manufacturer, Model from PhisicalAddr " +
                                         "where LiftID=@lift", conn);
                    cmd.Parameters.AddWithValue("lift", LiftId.SelectedValue);
                    SqlDataReader dr = cmd.ExecuteReader();
                    //     dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        Disp.Text = dr[0].ToString() + "-" + dr[1].ToString() + ":";
                    }
                    string mf = dr[0].ToString(); string md = dr[1].ToString();
                    dr.Close();
                }
            }
        }