コード例 #1
0
        public TicketPageVM() {
            _types = TicketType.getAll();
            _tickets = Ticket.getAll();
            foreach (TicketType tt in _types){
                _totaalAantal = _totaalAantal + tt.AvailableTickets;
            }
            int TotAantal = _totaalAantal;
            foreach (Ticket t in _tickets){
                TotAantal = TotAantal - t.Amount;
                _aantal = TotAantal;
            }
            _ticketNumber = 0;
            _soortAantal = 0;
            _newTicket = new Ticket();

        }
コード例 #2
0
ファイル: Ticket.cs プロジェクト: RubenDewyngaert/BusinessApp
 public static void EditTicket(Ticket ticket, string TTID)
 {
     String sql = "UPDATE Ticket Set Ticketholder=@Ticketholder, TicketholderEmail=@TicketholderEmail, TicketType=@TicketType, Amount=@Amount WHERE ID=@ID";
     DbParameter par1 = Database.AddParameter("@ID", ticket.ID);
     DbParameter par2 = Database.AddParameter("@Ticketholder", ticket.Ticketholder);
     DbParameter par3 = Database.AddParameter("@TicketholderEmail", ticket.TicketholderEmail);
     DbParameter par4 = Database.AddParameter("@TicketType", TTID);
     DbParameter par5 = Database.AddParameter("@Amount", ticket.Amount);
     if (par2.Value == null) par2.Value = DBNull.Value;
     if (par3.Value == null) par3.Value = DBNull.Value;
     if (par4.Value == null) par4.Value = DBNull.Value;
     if (par5.Value == null) par5.Value = DBNull.Value;
     Database.ModifyData(sql, par1, par2, par3, par4, par5);
 }
コード例 #3
0
ファイル: Ticket.cs プロジェクト: RubenDewyngaert/BusinessApp
 public static void DeleteTicket(Ticket ticket)
 {
     String sql = "DELETE FROM Ticket WHERE ID = @ID";
     DbParameter par1 = Database.AddParameter("@ID", ticket._ID);
     if (par1.Value == null) par1.Value = DBNull.Value;
     Database.ModifyData(sql, par1);
 }
コード例 #4
0
ファイル: Ticket.cs プロジェクト: RubenDewyngaert/BusinessApp
 public static void NewTicket(Ticket ticket, string TTID)
 {
     String sql = "INSERT INTO Ticket VALUES(@Ticketholder, @TicketholderEmail, @TicketType, @Amount)";
     DbParameter par1 = Database.AddParameter("@Ticketholder", ticket.Ticketholder);
     DbParameter par2 = Database.AddParameter("@TicketholderEmail", ticket.TicketholderEmail);
     DbParameter par3 = Database.AddParameter("@TicketType", TTID);
     DbParameter par4 = Database.AddParameter("@Amount", ticket.Amount);
     if (par1.Value == null) par1.Value = DBNull.Value;
     if (par2.Value == null) par2.Value = DBNull.Value;
     if (par3.Value == null) par3.Value = DBNull.Value;
     if (par4.Value == null) par4.Value = DBNull.Value;
     Database.ModifyData(sql, par1, par2, par3, par4);
 }
コード例 #5
0
ファイル: Ticket.cs プロジェクト: RubenDewyngaert/BusinessApp
        //string IDataErrorInfo.Error
        //{
        //    get { return "Model not valid"; }
        //}

        //string IDataErrorInfo.this[string columnName]
        //{
        //    get
        //    {
        //        try
        //        {
        //            object value = this.GetType().GetProperty(columnName).GetValue(this);
        //            Validator.ValidateProperty(value, new ValidationContext(this, null, null)
        //            {
        //                MemberName = columnName
        //            });
        //        }
        //        catch (ValidationException ex)
        //        {
        //            return ex.Message;
        //        }
        //        return String.Empty;
        //    }
        //}

        #endregion


        public static ObservableCollection<Ticket> getAll()
        {
            ObservableCollection<Ticket> lijst = new ObservableCollection<Ticket>();

            String sSQL = "SELECT * FROM Ticket";
            DbDataReader reader = Database.GetData(sSQL);
            while (reader.Read())
            {
                Ticket aNew = new Ticket();
                aNew.ID = reader["ID"].ToString();
                aNew.Ticketholder = reader["Ticketholder"].ToString();
                aNew.TicketholderEmail = reader["TicketholderEmail"].ToString();
                aNew.Amount = Int32.Parse(reader["Amount"].ToString());
                string ttID = reader["TicketType"].ToString();
                aNew.TicketType = TicketType.getByID(ttID);
                lijst.Add(aNew);
            }


            return lijst;
        }