コード例 #1
0
 public bool PasswordChange(RPassenger p)
 {
     try
     {
         string query  = "UPDATE Passenger SET Password = '******'WHERE Id ='" + p.Id + "' ";
         string query1 = "UPDATE Login SET Password = '******'WHERE Id ='" + p.Id + "' ";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         int y = dcc.ExecuteSQL(query1);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #2
0
 public bool PassengerAdd(RPassenger p)
 {
     try
     {
         string query  = "INSERT into Passenger VALUES ('" + p.Id + "', '" + p.Name + "', '" + p.Password + "', '" + p.Dateofbirth + "', '" + p.Gender + "', '" + p.Nationality + "', " + p.Type + ")";
         string query2 = "INSERT into Login VALUES ('" + p.Id + "','" + p.Name + "',  '" + p.Password + "', " + p.Type + ")";
         DatabaseConnectionClass dcc = new DatabaseConnectionClass();
         dcc.ConnectWithDB();
         int x = dcc.ExecuteSQL(query);
         int y = dcc.ExecuteSQL(query2);
         dcc.CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #3
0
        public RPassenger Profile(string id)
        {
            string     query            = "SELECT * from Passenger WHERE Id = '" + id + "'";
            RPassenger p                = null;
            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                p             = new RPassenger();
                p.Id          = sdr["Id"].ToString();
                p.Name        = sdr["Name"].ToString();
                p.Dateofbirth = sdr["Dateofbirth"].ToString();
                p.Password    = sdr["Password"].ToString();
                p.Gender      = sdr["Gender"].ToString();
                p.Nationality = sdr["Nationality"].ToString();
                p.Type        = Convert.ToInt32(sdr["Type"]);
            }
            dcc.CloseConnection();
            return(p);
        }
コード例 #4
0
        public List <RPassenger> GetAllPassengers()
        {
            string            query = "SELECT * from Passenger";
            List <RPassenger> pList = new List <RPassenger>();

            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                RPassenger p = new RPassenger();
                p.Id   = sdr["Id"].ToString();
                p.Name = sdr["Name"].ToString();
                //p.Password = sdr[""].ToString();
                p.Dateofbirth = sdr["DateOfbirth"].ToString();
                p.Gender      = sdr["Gender"].ToString();
                p.Nationality = sdr["Nationality"].ToString();
                pList.Add(p);
            }
            dcc.CloseConnection();
            return(pList);
        }
コード例 #5
0
        public List <RPassenger> SearchPassenger(string text)
        {
            string            query = "SELECT * from Passenger Where Id like'%" + text + "%' or Name like'%" + text + "%' or Dateofbirth like'%" + text + "%' or Nationality like'%" + text + "%'";
            List <RPassenger> plist = new List <RPassenger>();

            DatabaseConnectionClass dcc = new DatabaseConnectionClass();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                RPassenger p = new RPassenger();
                p.Id   = sdr["Id"].ToString();
                p.Name = sdr["Name"].ToString();
                //p.Password = sdr[""].ToString();
                p.Dateofbirth = sdr["DateOfbirth"].ToString();
                p.Gender      = sdr["Gender"].ToString();
                p.Nationality = sdr["Nationality"].ToString();
                plist.Add(p);
            }
            dcc.CloseConnection();
            return(plist);
        }