Example #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;
        }
Example #2
0
        public void EqualsShouldReturnFalseForInstancesWhereSecondIsNotLiftId()
        {
            var a = new LiftId(new Id(0), new Id(1));
            var b = new Id(0);

            var result = a.Equals(b);

            Assert.AreEqual(false, result);
        }
Example #3
0
        public void EqualsShouldReturnFalseForInstancesWithSamePersonButDifferentJourneyIds()
        {
            var a = new LiftId(new Id(0), new Id(2));
            var b = new LiftId(new Id(1), new Id(2));

            var result = a.Equals(b);

            Assert.AreEqual(false, result);
        }
Example #4
0
        public void EqualsShouldReturnTrueForInstancesWithSameJourneyAndPersonIds()
        {
            var a = new LiftId(new Id(0), new Id(1));
            var b = new LiftId(new Id(0), new Id(1));

            var result = a.Equals(b);

            Assert.AreEqual(true, result);
        }
Example #5
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;
            }
        }
Example #6
0
 private bool Equals(LiftId other)
 {
     return(Equals(_personId, other._personId) &&
            Equals(_journeyId, other._journeyId));
 }