Esempio n. 1
0
 //raise domain event (AlterationResourceCreated) and run validations on created objects
 public static TicketAlterationResource CreateTicketAlterationResource(List<TicketAlterationResourceItem> alterations)
 {
     TicketAlterationResource alterationResource = new TicketAlterationResource
     {
         Alterations = alterations
     };
     return alterationResource;
 }
Esempio n. 2
0
        public void DeleteAndReinsertAlterations(TicketAlterationResource alterationResource, int ticketId)
        {
            DBConnector deleteConnector = new DBConnector();
            MySqlCommand deleteCommand = new MySqlCommand();
            deleteCommand.Connection = deleteConnector.connection;
            deleteCommand.CommandText = @"DELETE from Ticket_Alterations WHERE ticket_id = @ticket_id";
            deleteCommand.Parameters.AddWithValue("@ticket_id", ticketId);
            try
            {
                deleteCommand.ExecuteNonQuery();
                deleteConnector.CloseConnection();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("There was an error deleting alterations. Contact Jay with this message: " + ex.Message + " error code: " + ex.Number);
            }

            InsertAlterations(alterationResource);
        }
Esempio n. 3
0
        public void InsertAlterations(TicketAlterationResource alterationResource)
        {
            DBConnector connector = new DBConnector();

            int orderIndex = 0;
            foreach (TicketAlterationResourceItem alteration in alterationResource.Alterations)
            {
                MySqlCommand insertCommand = new MySqlCommand();
                insertCommand.Connection = connector.connection;
                insertCommand.CommandText = @"INSERT into Ticket_Alterations (ticket_alteration_id, ticket_id, quantity, description, price, taxable, order_index) values (@ticket_alteration_id, @ticket_id, @quantity, @description, @price, @taxable, @order_index)";
                insertCommand.Parameters.AddWithValue("@ticket_alteration_id", alteration.TicketAlterationID);
                insertCommand.Parameters.AddWithValue("@ticket_id", alteration.TicketId);
                insertCommand.Parameters.AddWithValue("@quantity", alteration.Quantity);
                insertCommand.Parameters.AddWithValue("@description", alteration.Description);
                insertCommand.Parameters.AddWithValue("@price", alteration.Price);
                insertCommand.Parameters.AddWithValue("@taxable", alteration.Taxable);
                insertCommand.Parameters.AddWithValue("@order_index", orderIndex);
                orderIndex++;
                try
                {
                    insertCommand.ExecuteNonQuery();
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show("There was an error. Contact Jay with this message: " + ex.Message + " error code: " + ex.Number);
                }
            }
            connector.CloseConnection();
        }
Esempio n. 4
0
        public AlterationForm(TicketResource ticketResource, TicketAlterationResource alterationResource)
            : this(ticketResource)
        {
            List<TicketAlterationResourceItem> gridItems = alterationResource.Alterations;
            for (int i = 0; i < gridItems.Count; i++)
            {
                String quantity = gridItems[i].Quantity == 0 ? "" : gridItems[i].Quantity.ToString();
                String description = gridItems[i].Description;
                String price = gridItems[i].Price == 0 ? "" : gridItems[i].Price.ToString();
                AlterationGrid.Rows.Add(quantity, description, price, gridItems[i].Taxable);
            }

            UpdateTotalDepositAndBalance();
        }