private void button2_Click(object sender, EventArgs e)
        {
            ServiceReference1.MiidWebServiceSoapClient client = new ServiceReference1.MiidWebServiceSoapClient();
            Global.TicketClasses = TicketClassRepository.DeserialiseString(client.GetTicketClassesForEvent(Global.EventID.ToString(), true));

            CashRegister form = new CashRegister(Global.TicketClasses, Global.UserID);
            form.Show();
            this.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string templatePath = "";
            string templateFolder = ConfigurationManager.AppSettings["TEMPLATE_DIRECTORY"].ToString();// TEMPLATE_DIRECTORY;
            string templateFrame = ConfigurationManager.AppSettings["TEMPLATE_FRAME"].ToString();// TEMPLATE_FRAME;

            string applicationDirectory = Application.ExecutablePath;

            templatePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(applicationDirectory), @"LabelTemplates\TicketBarcode.lbx");

            try
            {
                bpac.DocumentClass doc = new bpac.DocumentClass();

                if (doc.Open(templatePath) != false)
                {
                    foreach (Ticket s1 in myTicketsSb)
                    {
                        TicketPrintViewModel s = new TicketPrintViewModel(s1, Global.TicketClasses);

                        doc.GetObject("objBarCode").Text = "TIC" + s.TicketNumber;
                        doc.GetObject("objEventName").Text = s.EventName;
                        doc.GetObject("objTicketClass").Text = s.Description;
                        doc.GetObject("objPrice").Text = String.Format("R {0}.00", s.Price);
                        doc.GetObject("objStartDateTime").Text = s.StartDate.ToString("dd MMM yyyy HH:mm");
                        doc.StartPrint("", bpac.PrintOptionConstants.bpoDefault);
                        doc.PrintOut(1, bpac.PrintOptionConstants.bpoDefault);
                        doc.EndPrint();

                    }
                    doc.Close();

                }
                else
                {
                    // MsgBox("Open() Error: " + doc.ErrorCode);
                }
                //clear tickets
                myTicketsSb = null;
                this.richTextBox1.Clear();

                ServiceReference1.MiidWebServiceSoapClient client = new ServiceReference1.MiidWebServiceSoapClient();
                Global.TicketClasses = TicketClassRepository.DeserialiseString(client.GetTicketClassesForEvent(Global.EventID.ToString(), true));

                CashRegister form1 = new CashRegister(Global.TicketClasses, Global.UserID);
                form1.Show();
                this.Close();

            }
            catch (Exception e2)
            {
                this.lblError.Visible = true;
                this.lblError.Text = e2.Message;

            }
        }
        private void btnGetTicketClassesForEvent_Click(object sender, EventArgs e)
        {
            try
            {
                //Get ticket classes from Webservice
                ServiceReference1.MiidWebServiceSoapClient client = new ServiceReference1.MiidWebServiceSoapClient();
                bool IsBoxOffice = true;
                Global.TicketClasses = TicketClassRepository.DeserialiseString(client.GetTicketClassesForEvent(txtEventCode.Text, IsBoxOffice));

                dataGridView1.DataSource = Global.TicketClasses;
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text    = "Web service offline: " + ex.Message;
            }
        }