Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BuildingTableAdapter    bu  = new BuildingTableAdapter();
            SensorTableAdapter      ss  = new SensorTableAdapter();
            Type_sensorTableAdapter Tys = new Type_sensorTableAdapter();

            if (Request.QueryString["NameFarm"] != null)
            {
                //  Label1.Text = " : " + Request.QueryString["NameFarm"].ToString();
                Label2.Text = Request.QueryString["NameBu"].ToString();
                Label3.Text = "ชื่อเจ้าหน้าที่ : " + Request.QueryString["NameOF"].ToString();

                Session["S_Bu"] = bu.GetDataBy2(Request.QueryString["NameBu"].ToString()).Rows[0][4].ToString();
                string idbu = bu.GetDataBy2(Request.QueryString["NameBu"].ToString()).Rows[0][0].ToString();
                Session["ID_Bu"] = idbu;
                int ns = Convert.ToInt32(ss.ScalarQuery(idbu));
                Session["fr"]      = ns;
                Session["Pic_bui"] = bu.GetDataBy2(Request.QueryString["NameBu"].ToString()).Rows[0][6].ToString();
                for (int i = 0; i < ns; i++)
                {
                    Session["ID_Sensor" + i]   = ss.GetDataBy1(idbu).Rows[i][0].ToString();
                    Session["Name_Sensor" + i] = ss.GetDataBy1(idbu).Rows[i][1].ToString();
                    Session["Type_Sensor" + i] = ss.GetDataBy1(idbu).Rows[i][3].ToString();
                    Session["Unit_Ty" + i]     = Tys.GetDataBy(Session["Type_Sensor" + i].ToString()).Rows[0][2].ToString();
                }
                Session["In_Ch"] = bu.GetDataBy2(Request.QueryString["NameBu"].ToString()).Rows[0][2].ToString();
                Session["ChhhD"] = bu.GetDataBy2(Request.QueryString["NameBu"].ToString()).Rows[0][9].ToString();
                Label1.Text      = bu.GetDataBy2(Request.QueryString["NameBu"].ToString()).Rows[0][9].ToString() + " ตัว";
            }
            else
            {
            }
        }
Beispiel #2
0
        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            BuildingTableAdapter    buu = new BuildingTableAdapter();
            SensorTableAdapter      ssn = new SensorTableAdapter();
            Type_sensorTableAdapter tys = new Type_sensorTableAdapter();
            string idbu = buu.GetDataBy2(DropDownList2.SelectedItem.Text).Rows[0][0].ToString();
            int    iss  = Convert.ToInt32(ssn.ScalarQuery(idbu));

            Session["iss"] = iss;
            for (int i = 0; i < iss; i++)
            {
                Session["name_sensor" + i] = ssn.GetDataBy1(idbu).Rows[i][1].ToString();
                Session["de_sensor" + i]   = ssn.GetDataBy1(idbu).Rows[i][2].ToString();
                string dd = ssn.GetDataBy1(idbu).Rows[i][3].ToString();
                Session["idtype_sensor" + i] = dd;
                Session["type_sensor" + i]   = tys.GetDataBy(dd).Rows[0][1].ToString();
                Session["unit_sensor" + i]   = tys.GetDataBy(dd).Rows[0][2].ToString();
            }
        }