/// <summary> /// Reprint the selected labels /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbReprintSelectLabelTypes_Click(object sender, EventArgs e) { var fileGuids = hfLabelFileGuids.Value.SplitDelimitedValues().AsGuidList(); var personId = hfSelectedPersonId.ValueAsInt(); var selectedAttendanceIds = hfSelectedAttendanceIds.Value.SplitDelimitedValues().AsIntegerList(); List <string> messages = ZebraPrint.ReprintZebraLabels(fileGuids, personId, selectedAttendanceIds, pnlReprintResults, this.Request); pnlReprintResults.Visible = true; pnlReprintSelectedPersonLabels.Visible = false; hfLabelFileGuids.Value = string.Empty; hfSelectedPersonId.Value = string.Empty; lReprintResultsHtml.Text = messages.JoinStrings("<br>"); }
/// <summary> /// Handles sending the selected labels off to the selected printer. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void mdReprintLabels_PrintClick(object sender, EventArgs e) { var personId = hfPersonId.ValueAsInt(); if (personId == 0) { return; } if (string.IsNullOrWhiteSpace(cblLabels.SelectedValue)) { nbReprintLabelMessages.Visible = true; nbReprintLabelMessages.Text = "Please select at least one label."; return; } if (ddlPrinter.SelectedValue == null || ddlPrinter.SelectedValue == None.IdValue) { nbReprintLabelMessages.Visible = true; nbReprintLabelMessages.Text = "Please select a printer."; return; } // Get the person Id from the Guid var selectedAttendanceIds = hfCurrentAttendanceIds.Value.SplitDelimitedValues().AsIntegerList(); var fileGuids = cblLabels.SelectedValues.AsGuidList(); var reprintLabelOptions = new ReprintLabelOptions { PrintFrom = PrintFrom.Server, ServerPrinterIPAddress = ddlPrinter.SelectedValue }; // Now, finally, re-print the labels. List <string> messages = ZebraPrint.ReprintZebraLabels(fileGuids, personId, selectedAttendanceIds, nbReprintMessage, this.Request, reprintLabelOptions); nbReprintMessage.Visible = true; nbReprintMessage.Text = messages.JoinStrings("<br>"); mdReprintLabels.Hide(); }
/// <summary> /// Handles sending the selected labels off to the selected printer. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void mdReprintLabels_PrintClick(object sender, EventArgs e) { var personId = hfPersonId.ValueAsInt(); if (personId == 0) { return; } if (string.IsNullOrWhiteSpace(cblLabels.SelectedValue)) { nbReprintLabelMessages.Visible = true; nbReprintLabelMessages.Text = "Please select at least one label."; return; } var selectedPrinterGuid = ddlPrinter.SelectedValue.AsGuidOrNull(); if (!selectedPrinterGuid.HasValue) { nbReprintLabelMessages.Visible = true; nbReprintLabelMessages.Text = "Please select a printer."; return; } var selectedAttendanceIds = hfCurrentAttendanceIds.Value.SplitDelimitedValues().AsIntegerList(); var fileGuids = cblLabels.SelectedValues.AsGuidList(); ReprintLabelOptions reprintLabelOptions; string selectedPrinterIPAddress; if (selectedPrinterGuid == Guid.Empty) { reprintLabelOptions = new ReprintLabelOptions { PrintFrom = PrintFrom.Client }; } else { selectedPrinterIPAddress = new DeviceService(new RockContext()).GetSelect(selectedPrinterGuid.Value, s => s.IPAddress); reprintLabelOptions = new ReprintLabelOptions { PrintFrom = PrintFrom.Server, ServerPrinterIPAddress = selectedPrinterIPAddress }; } CheckinManagerHelper.SaveSelectedLabelPrinterToCookie(selectedPrinterGuid); // Now, finally, re-print the labels. List <string> messages = ZebraPrint.ReprintZebraLabels(fileGuids, personId, selectedAttendanceIds, nbReprintMessage, this.Request, reprintLabelOptions); nbReprintMessage.Visible = true; nbReprintMessage.Text = messages.JoinStrings("<br>"); mdReprintLabels.Hide(); }