Esempio n. 1
0
        public LabelTemplate Item(string labelType, string printerType)
        {
            //Return an existing template object from the label templates collection
            LabelTemplate label = null;

            try {
                //Merge from collection (dataset)
                if (labelType != "" && printerType != "")
                {
                    DataRow[] rows = this.mLabels.LabelDetailTable.Select("LABEL_TYPE='" + labelType + "' AND PrinterType='" + printerType + "'");
                    if (rows.Length == 0)
                    {
                        throw new Exception("Label template for label type " + labelType + ", printer type " + printerType + " does not exist in this store!\n");
                    }
                    LabelDataset.LabelDetailTableRow row = (LabelDataset.LabelDetailTableRow)rows[0];
                    label = NewLabelTemplate(row);                      //, this.mMediator);
                    label.TemplateChanged += new EventHandler(OnTemplateChanged);
                }
                else
                {
                    label = Item();
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while getting existing label.", ex); }
            return(label);
        }
Esempio n. 2
0
 //Interface
 public Label(LabelTemplate labelTemplate, LabelMaker labelMaker)
 {
     //Constructor
     try {
         //Format the label template using the specified label maker
         this.mLabelFormat = labelMaker.FormatLabelTemplate(labelTemplate.Template);
     }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new Label instance.", ex); }
 }
Esempio n. 3
0
        public bool Add(LabelTemplate template)
        {
            //Add a new label template
            bool ret = false;

            try {
                ret = template.Create();
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while adding new label.", ex); }
            return(ret);
        }
Esempio n. 4
0
        public bool Remove(LabelTemplate template)
        {
            //Remove the specified label template
            bool ret = false;

            try {
                ret = template.Delete();
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while removing existing label.", ex); }
            return(ret);
        }
Esempio n. 5
0
        public LabelTemplate Item()
        {
            //Return a new blank label template object
            LabelTemplate template = null;

            try {
                template = NewLabelTemplate();
                template.TemplateChanged += new EventHandler(OnTemplateChanged);
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while getting existing label.", ex); }
            return(template);
        }
Esempio n. 6
0
        public dlgLabelTemplate(LabelTemplate template)
        {
            //Constructor
            try {
                //Required designer support
                InitializeComponent();

                //Set command button and menu identities (used for onclick handler)
                this.btnOK.Text     = CMD_OK;
                this.btnCancel.Text = CMD_CANCEL;

                //Initialize members
                this.mLabelTemplate = template;
                this.Text           = (this.mLabelTemplate.LabelType.Length > 0) ? "Label Template (" + this.mLabelTemplate.LabelType + ")" : "Label Template (New)";
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new Label Template dialog instance.", ex); }
        }