예제 #1
0
        public static LabelTemplate CreateOBLabelTemplate(string labelType, string printerType)
        {
            //Create an outbound label
            OBLabelTemplate labelTemplate = null;

            try {
                if (LabelTemplateCached != null && labelType == LabelType)
                {
                    labelTemplate = LabelTemplateCached;
                }
                else
                {
                    DataSet ds = Mediator.FillDataset(USP_OBLABEL_DETAIL, TBL_OBLABEL_DETAIL, new object[] { labelType, printerType });
                    if (ds.Tables[TBL_OBLABEL_DETAIL].Rows.Count == 0)
                    {
                        throw new ApplicationException("Outbound label " + labelType + " (" + printerType + ")" + " not found.");
                    }
                    else
                    {
                        LabelDS labelDS = new LabelDS();
                        labelDS.Merge(ds);
                        labelTemplate = new OBLabelTemplate(labelDS.LabelDetailTable[0]);
                    }
                    LabelType           = labelType;
                    LabelTemplateCached = labelTemplate;
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while creating outbound label.", ex); }
            return(labelTemplate);
        }
예제 #2
0
        public static OutboundLabel GetOutboundLabel(string labelType, string printerType)
        {
            //Get an outbound label
            OutboundLabel label = null;

            try {
                DataSet ds = App.Mediator.FillDataset(USP_LABEL_TEMPLATE, TBL_LABEL_DETAIL, new object[] { labelType, printerType });
                if (ds == null || ds.Tables[TBL_LABEL_DETAIL].Rows.Count == 0)
                {
                    throw new ApplicationException("Label " + labelType + " not found for a " + printerType + "printer.");
                }
                else
                {
                    LabelDS labelDS = new LabelDS();
                    labelDS.Merge(ds);
                    label = new OutboundLabel(labelDS.LabelDetailTable[0]);
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error getting an outbound label for label " + labelType + " on a " + printerType + " printer.", ex); }
            return(label);
        }