Exemple #1
0
        public IBarCode CreateBarCode(IBarCode barCode)
        {
            var returnBarCode = _storage.CreateBarCode(barCode);

            _isDirty = true;
            return(returnBarCode);
        }
Exemple #2
0
        private async System.Threading.Tasks.Task DeleteBarCode(IBarCode barCode)
        {
            if (_isDialogActive)
            {
                return;
            }
            var dialog = new ContentDialog
            {
                Title   = "Delete Transaction",
                Content = $"Delete {barCode.Code}?",
                IsPrimaryButtonEnabled   = true,
                IsSecondaryButtonEnabled = true,
                PrimaryButtonText        = "Delete",
                SecondaryButtonText      = "Cancel"
            };

            _isDialogActive = true;
            var res = await dialog.ShowAsync();

            _isDialogActive = false;
            if (res == ContentDialogResult.Secondary)
            {
                return;
            }
            ViewModel.DeleteBarCode(barCode);
        }
Exemple #3
0
 public override IBarCode CreateBarCode(IBarCode barCode)
 {
     try
     {
         return(_storageEngine.Create(barCode) as IBarCode);
     }
     catch (ArgumentException e)
     {
         throw new StorageException($"{e.Message}");
     }
 }
Exemple #4
0
        public override IBarCode CreateBarCode(IBarCode barCode)
        {
            _table.InitializeDatabase();
            if (barCode.Id == 0)
            {
                barCode.Id = _table.AddData(ObjectToIBarCodeConvertor.ConvertToKeyValuePair(barCode));
            }
            else
            {
                _table.AddData(ObjectToIBarCodeConvertor.ConvertToKeyValuePairWithId(barCode));
            }

            return(barCode);
        }
Exemple #5
0
        public Image DrawBarcode()
        {
            if (string.IsNullOrEmpty(this.data))
            {
                throw new Exception("BarcodeGenerator: Input data can not be empty.");
            }
            if (this.SymbologyType == SymbologyType.UNSPECIFIED)
            {
                throw new Exception("BarcodeGenerator: Symbology Type can not be unspecified.");
            }


            switch (this._SymbologyType)
            {
            case SymbologyType.Codabar:
                ibarcode = new Codabar(this.data, this._Width, this.Height, this._ForeColor, this._BackColor, this._Scale);
                break;

            case SymbologyType.UPCA:
                ibarcode = new UPCA(this.data, this._Width, this.Height, this._ForeColor, this._BackColor, this._Scale);
                break;

            case SymbologyType.UPCE:
                ibarcode = new UPCE(this.data, this._Width, this.Height, this._ForeColor, this._BackColor, this._Scale);
                break;

            case SymbologyType.EAN8:
                ibarcode = new EAN8(this.data, this._Width, this.Height, this._ForeColor, this._BackColor, this._Scale);
                break;

            case SymbologyType.EAN13:
                ibarcode = new EAN13(this.data, this._Width, this.Height, this._ForeColor, this._BackColor, this._Scale);
                break;

            default:
                break;
            }

            this.data = ibarcode.Data;


            return(ibarcode.Image);
        }
Exemple #6
0
 public override void DeleteBarCode(IBarCode barCode)
 {
     _storageEngine.Delete(barCode);
 }
Exemple #7
0
 public override void UpdateBarCode(IBarCode barCode)
 {
 }
Exemple #8
0
 public abstract void DeleteBarCode(IBarCode barCode);
Exemple #9
0
        public static IEnumerable <KeyValuePair <string, object> > ConvertToKeyValuePair(IBarCode barCode)
        {
            var returnList = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>("transactionId", barCode.Transaction?.Id),
                new KeyValuePair <string, object>("code", barCode.Code),
                new KeyValuePair <string, object>("isWeight", barCode.IsWeight?1:0),
                new KeyValuePair <string, object>("numberOfDigits", barCode.NumberOfDigitsForWeight),
            };

            return(returnList);
        }
Exemple #10
0
 public override void UpdateBarCode(IBarCode barCode)
 {
     _table.InitializeDatabase();
     _table.UpdateData(ObjectToIBarCodeConvertor.ConvertToKeyValuePair(barCode), barCode.Id);
 }
Exemple #11
0
 public override void DeleteBarCode(IBarCode barCode)
 {
     _table.InitializeDatabase();
     _table.DeleteRecordById(barCode.Id);
 }
Exemple #12
0
 public void InverseIsWeight(IBarCode barCode)
 {
     barCode.IsWeight = !barCode.IsWeight;
     _storage.UpdateBarCode(barCode);
     LoadBarCodes();
 }
Exemple #13
0
 public void DeleteBarCode(IBarCode barCode)
 {
     _storage.DeleteBarCode(barCode);
     _barCodes.Remove(barCode);
 }
Exemple #14
0
 public abstract void UpdateBarCode(IBarCode barCode);
Exemple #15
0
 public void DeleteBarCode(IBarCode barCode)
 {
     _storage.DeleteBarCode(barCode);
     _isDirty = true;
 }
Exemple #16
0
        public static IEnumerable <KeyValuePair <string, object> > ConvertToKeyValuePairWithId(IBarCode barCode)
        {
            var returnList = ConvertToKeyValuePair(barCode).ToList();

            returnList.Add(new KeyValuePair <string, object>("id", barCode.Id));
            return(returnList);
        }
Exemple #17
0
 public void UpdateBarCode(IBarCode barCode)
 {
     _storage.UpdateBarCode(barCode);
     _isDirty = true;
 }
Exemple #18
0
 public abstract IBarCode CreateBarCode(IBarCode barCode);