Example #1
0
        /// <summary>
        /// Print collection, comment, and (collection or aliquot) labels
        /// </summary>
        protected static void printLabels(ImmutableOrderData immutableOrderData, string printer, 
            SetupTableData setupTableData, IEnumerable<DataRow> orderedTests, LabelPrintMode testPrintMode)
        {
            Func<LabelData, LabelData> configureLabels = labelData =>
               {  //print collection label
                   //print collection label
                   labelData.LabelAppendDemographic(immutableOrderData.collectionTime, "", "");
                   labelData.LabelAppendDemographic(immutableOrderData.collectionTime, "", "");
                   //print comment label
                   labelData.LabelAppendComment(immutableOrderData.comment, "CMT", "");

                   var testBySpecimen = orderedTests.GroupBy(x =>
                       //group test DataRows by the SpecimenType
              new Tuple2<string,string> (x["Tube"].ToString(),  x["Extension"].ToString() ))
              .ToDictionary(
                grouped => grouped.Key,
                grouped => grouped.ToList().Select(dr => dr["Id"].ToString()).mkString(" ")
              );
                   testBySpecimen.forEach(specimenTest =>
                        labelData.AppendTestLabel(immutableOrderData.getPriority,
                        testPrintMode, specimenTest.Value,
                       specimenTest.Key._1, specimenTest.Key._2));

                   return labelData;
               };

               _printLabels(immutableOrderData, printer, setupTableData, configureLabels);
        }
Example #2
0
        public void AppendTestLabel(Priority priority, LabelPrintMode labelPrintMode, string test, string specimenType, string specimenExtension)
        {
            if (labelPrintMode == LabelPrintMode.Collection)
            {
                this.LabelAppendCollection(test, specimenType, specimenExtension);
            }
            else if (labelPrintMode == LabelPrintMode.Demographic)
            {
                this.LabelAppendDemographic(test, specimenType, specimenExtension);
            }
            else if (labelPrintMode == LabelPrintMode.Comment)
            {
                this.LabelAppendComment(test, specimenType, specimenExtension);
            }
            else if (labelPrintMode == LabelPrintMode.Aliquot)
            {
                if (priority == Priority.Routine)
                {
                    this.LabelAppendAliquotRoutine(test, specimenType, specimenExtension);
                }
                else if (priority == Priority.Stat)
                {
                    this.LabelAppendAliquotStat(test, specimenType, specimenExtension);
                }

            }
            else
            {
                throw new Exception("Unknown LabelPrintMode");
            }
        }