Beispiel #1
0
 private void UpdateLabelsUsed()
 {
     PdfEngine engine = new PdfEngine(m_PageLayout, m_SelectedSource.Callsign, 0);
     var contactsToPrint = m_ContactStore.GetContactsToQsl(m_SelectedSource.SourceID, m_QslMethod.Text);
     int labelsUsed = 0;
     foreach (var contacts in contactsToPrint.GroupBy(c => c.Callsign))
     {
         labelsUsed += engine.CalculateLabelCount(contacts.ToList());
     }
     m_LabelsUsed = labelsUsed;
     m_UpdateLabelsUsed.Text = string.Format("&Labels used: {0}", labelsUsed);
 }
Beispiel #2
0
        private void m_MarkSelectedAsReceived_Click(object sender, EventArgs e)
        {
            if (m_VisibleContacts == null || m_VisibleContacts.Count == 0)
                return;

            PdfEngine engine = new PdfEngine(m_PageLayout, m_SelectedSource.Callsign, 0);
            List<Contact> contactsToPrint = new List<Contact>();
            for (int row = 0; row < m_VisibleContacts.Count; row++)
            {
                DataGridViewRow gridRow = m_ContactsGrid.Rows[row];
                bool selected = (bool)gridRow.Cells[0].Value;
                if (selected)
                {
                    Contact c = m_VisibleContacts[row];
                    c.QslRxDate = DateTime.UtcNow;
                    c.QslTxDate = null; // Need to mark as "not sent" again, or it won't get reprinted
                    c.QslMethod = m_QslMethod.Text;
                    m_ContactStore.SaveContact(c);
                    contactsToPrint.Add(c);
                }
            }
            m_LabelsUsed += engine.CalculateLabelCount(contactsToPrint);
            m_UpdateLabelsUsed.Text = string.Format("&Labels used: {0}", m_LabelsUsed);

            UpdateGrid();
            m_TxtCallsign.Text = string.Empty;
            m_TxtCallsign.Focus();
        }