Esempio n. 1
0
        protected void IdM_SelectedIndexChanged(object sender, EventArgs e)
        {
            App_Code.Base db     = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
            List <string> liftId = db.GetLiftId(IdU.SelectedValue, IdM.SelectedValue);

            LiftId.DataSource = liftId;
            LiftId.DataBind();
            LiftId.SelectedIndex = 0;
        }
Esempio n. 2
0
        protected void Address_TextChanged(object sender, EventArgs e)
        {
            if (Address.SelectedItem == null)
            {
                return;
            }
            string a = Address.SelectedItem.Value;

            adr = a;
            using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
            {
                conn.Open();

                SqlCommand cmd;
                if (_role == "ODS")
                {
                    cmd = new SqlCommand("select lt.LiftId from LiftsTtx lt " +
                                         "join ODSLifts o on o.LiftId=lt.LiftId " +
                                         "join Users u on u.UserId=o.UserId " +
                                         "join Ttx tt on tt.Id=lt.TtxId " +
                                         "where tt.TtxTitleId=1 and u.UserName=@userName and tt.Ttx=@t", conn);
                    cmd.Parameters.AddWithValue("userName", User.Identity.Name);
                }
                else
                {
                    cmd = new SqlCommand("select lt.LiftId from LiftsTtx lt " +
                                         "join Ttx tt on tt.Id=lt.TtxId " +
                                         "where tt.TtxTitleId=1 and tt.Ttx=@t", conn);
                }
                cmd.Parameters.AddWithValue("t", a);
                List <string> lifts = new List <string>();
                SqlDataReader dr    = cmd.ExecuteReader();
                while (dr.Read())
                {
                    lifts.Add(dr[0].ToString());
                }
                dr.Close();
                LiftId.DataSource = lifts;
                LiftId.DataBind();
                LiftId.SelectedIndex = 0;
            }
        }