Example #1
0
 internal void AssignInitialValue(BarcodeModel _barcode)
 {
     try
     {
         Barcode = string.Format(" Barcode {0} ", _barcode.Barcode);
         //AltBarcode = _barcode.Barcode;
         Ownername = _barcode?.Kegs?.Partners?.FirstOrDefault()?.FullName;
         try
         {
             Size = _barcode?.Tags[3]?.Value;
         }
         catch (Exception ex)
         {
             Size = _barcode?.Kegs.Sizes.FirstOrDefault();
             Crashes.TrackError(ex);
         }
         Contents = _barcode.Contents;
         Batch    = _barcode.Kegs.Batches.FirstOrDefault();
         Location = _barcode.Kegs.Locations.FirstOrDefault().Name;
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }
 private async void LabelItemTappedCommandRecieverAsync(BarcodeModel model)
 {
     try
     {
         if (model.Kegs.Partners.Count > 1)
         {
             List <BarcodeModel> modelList = new List <BarcodeModel>
             {
                 model
             };
             await NavigateToValidatePartner(modelList);
         }
         else
         {
             ConstantManager.IsFromScanned = true;
             await _navigationService.NavigateAsync("AddTagsView", new NavigationParameters
             {
                 { "viewTypeEnum", ViewTypeEnum.BulkUpdateScanView }
             }, animated : false);
         }
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }
Example #3
0
        // GET: Home
        public ActionResult Index()
        {
            BarcodeModel barcodeModel = new BarcodeModel();

            barcodeModel.LabelLeftMargin   = CmToInc(0);
            barcodeModel.LabelRightMargin  = CmToInc(0.3m);
            barcodeModel.LabelTopMargin    = CmToInc(0.3m);
            barcodeModel.LabelBottomMargin = CmToInc(0);

            barcodeModel.LabelLeftPadding   = CmToInc(0.1m);
            barcodeModel.LabelRightPadding  = CmToInc(0.1m);
            barcodeModel.LabelTopPadding    = CmToInc(0.1m);
            barcodeModel.LabelBottomPadding = CmToInc(0.1m);

            barcodeModel.LabelWidth  = CmToInc(6.4m);
            barcodeModel.LabelHeight = CmToInc(3.8m);

            barcodeModel.PageWidth        = CmToInc(21);
            barcodeModel.PageLeftMargin   = CmToInc(0.7m);
            barcodeModel.PageRightMargin  = CmToInc(0.7m);
            barcodeModel.PageTopMargin    = CmToInc(1);
            barcodeModel.PageBottomMargin = CmToInc(1);

            for (int i = 0; i < 21; i++)
            {
                BarcodeItem barcodeItem = new BarcodeItem();
                barcodeItem.BarcodeData     = (new Random().Next(12345, 99999).ToString() + i).PadLeft(8, '0');
                barcodeItem.BarcodeTopText  = "KKK KUTUPHANESI";
                barcodeItem.BarcodeLeftText = "KKT 11-120 (A) </br> N567y </br> 2017";
                barcodeModel.BarcodeList.Add(barcodeItem);
            }

            return(View(barcodeModel));
        }
 private async void IconItemTappedCommandRecieverAsync(BarcodeModel model)
 {
     try
     {
         if (model.Kegs.Partners.Count > 1)
         {
             List <BarcodeModel> modelList = new List <BarcodeModel>
             {
                 model
             };
             await NavigateToValidatePartner(modelList);
         }
         else
         {
             await _navigationService.NavigateAsync("ScanInfoView", new NavigationParameters
             {
                 { "model", model }
             }, animated : false);
         }
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }
Example #5
0
        private BarcodeModel CaricaODL(string barcode, decimal colli)
        {
            if (string.IsNullOrEmpty(barcode))
            {
                return(null);
            }

            using (TrasferimentiBusiness bTrasferimenti = new TrasferimentiBusiness())
            {
                if (!_ds.USR_PRD_MOVFASI.Any(x => x.BARCODE == barcode))
                {
                    bTrasferimenti.FillUSR_PRD_MOVFASI(_ds, barcode);
                }

                TrasferimentiDS.USR_PRD_MOVFASIRow odl = _ds.USR_PRD_MOVFASI.Where(x => x.BARCODE == barcode).FirstOrDefault();
                if (odl == null)
                {
                    return(null);
                }
                //   AnagraficaDS.MAGAZZRow articolo = _anagrafica.GetMAGAZZ(odl.IDMAGAZZ);

                BarcodeModel barcodeM = new BarcodeModel()
                {
                    Barcode    = odl.IsBARCODENull() ? string.Empty : odl.BARCODE,
                    Nummovfase = odl.IsNUMMOVFASENull() ? string.Empty : odl.NUMMOVFASE,
                    Reparto    = odl.IsCODICECLIFONull() ? string.Empty : odl.CODICECLIFODEST,
                    Quantità   = odl.QTA.ToString()
                };

                return(barcodeM);
            }
        }
Example #6
0
        //  Commit to database - new product
        private void saveNewProductInformationToDb()
        {
            //Save the product that was just created. Check whether the product saved correctly.
            int id = SqliteDAProduct.SaveProductAndGetId(this.product);

            if (id != 0)
            {
                DialogResult dialogResult = MessageBox.Show("New product created successfully", "New Product",
                                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (dialogResult == DialogResult.OK)
                {
                    //Set the product id variable equal to the product id saved to the database. The forms product id can be accessed by other forms that need it.
                    this.product.Id = id;
                    if (barcodeComboBox.Text != "")
                    {
                        BarcodeModel barcode = new BarcodeModel();
                        barcode.Barcode   = barcodeComboBox.Text;
                        barcode.ProductId = id;
                        SqliteDataAccessBarcode.SaveBarcode(barcode);
                    }
                    this.Close();
                }
            }
            else if (id == 0)
            {
                MessageBox.Show("Something went wrong. New product could not be saved.\nCheck the error log for more information.", "New Product Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BarcodeViewModel"/> class.
        /// </summary>
        /// <param name="patientManager">Patient manager object</param>
        /// <param name="barcodeTraceabilityManager">Barcode traceability manager</param>
        public BarcodeViewModel(IPatientManager patientManager, IBarcodeTraceabilityManager barcodeTraceabilityManager)
        {
            this.patientManager        = patientManager;
            BarcodeTraceabilityManager = barcodeTraceabilityManager;
            SaveArbitraryCommand       = new RelayCommand(OnSaveArbitraryCommand);

            Barcode = new BarcodeModel()
            {
                ProductionDate = null, ExpiryDate = new DateTime()
            };
            ArbitraryBarcode = new BarcodeModel()
            {
                QualifyLevel     = (int)QualifyType.Unknown,
                QualifyLevelType = (int)QualifyLevelType.Other,
                ProductionDate   = null,
                ExpiryDate       = null
            };

            patientManager.PatientContext.PropertyChanged += OnDependentPropertyChanged;

            barcodeTraceabilityManager.PropertyChanged   += OnDependentPropertyChanged;
            barcodeTraceabilityManager.IsBypassUsed       = false;
            barcodeTraceabilityManager.IsScanning         = false;
            barcodeTraceabilityManager.NewConsumableCount = 0;

            SaveCommand         = new RelayCommand(OnSaveCommand);
            AddArbitraryCommand = new RelayCommand(OnAddArbitraryCommand);

            BypassCommand        = new RelayCommand(OnBypassCommand);
            RemoveBarcodeCommand = new RelayCommand <int>(OnRemoveBarcodeCommand);
        }
 private async void LabelItemTappedCommandRecieverAsync(BarcodeModel model)
 {
     try
     {
         if (model.Kegs.Partners.Count > 1)
         {
             List<BarcodeModel> modelList = new List<BarcodeModel>
             {
                 model
             };
             await NavigateToValidatePartner(modelList);
         }
         else
         {
             await _navigationService.NavigateAsync("AddTagsView", new NavigationParameters
             {
                 {"viewTypeEnum",ViewTypeEnum.FillScanView },
                 {"AddTagsViewInitialValue",model }
             }, animated: false);
         }
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }
Example #9
0
 public IEnumerable <오류목록Model> GetErrorModel(BarcodeModel model, int cnt)
 {
     return(new List <오류목록Model> {
         new 오류목록Model {
             No = ++cnt, 형 = "보험구분", 메세지 = "의료급여 1종 바코드는 보험구분이 2이고 의료급여종별은 2이여야 합니다."
         }
     });
 }
 public IEnumerable <오류목록Model> GetErrorModel(BarcodeModel model, int cnt)
 {
     return(new List <오류목록Model> {
         new 오류목록Model {
             No = ++cnt, 형 = "보험구분", 메세지 = "자동차보험 바코드는 보험구분이 4, 공상및보훈구분에 값이 없어야합니다."
         }
     });
 }
Example #11
0
 public IEnumerable <오류목록Model> GetErrorModel(BarcodeModel model, int cnt)
 {
     return(new List <오류목록Model> {
         new 오류목록Model {
             No = ++cnt, 형 = "보험구분", 메세지 = "공무원상해 바코드는 보험구분이 1이고 공상및보훈구분이 1이여야 합니다."
         }
     });
 }
        public void addOrUpdateProduct(object parameter)
        {
            ProductModel model   = new ProductModel();
            BarcodeModel barcode = new BarcodeModel();

            barcode.Value.value = Barcode;

            model.Name.value           = Name;
            model.ProductGroupID.value = 1;
            model.Code.value           = Code;
            model.Barcode.value        = Barcode;
            model.Description.value    = Description;
            model.Price.value          = Price;
            model.Cost.value           = Cost;
            model.IsService.value      = IsService;
            model.DateCreated.value    = DateTime.Now;
            model.DateUpdated.value    = DateTime.Now;

            if (this.UpdateOrCreate == "Create")
            {
                try {
                    validate();

                    ProductAccess.singleton.addProduct(model);
                    HomeViewModel.ProductsUpdated = true;
                    this.AddProductView.Close();
                    CoreApp.logger.log("Product model successfully uploaded.(AddProductViewModel)");
                    this.HomeViewModel.setNotification("Product details added successfully!", true);
                }
                catch (EmptyFieldException) {
                    this.HomeViewModel.setNotification("Required fields cannot be empty.", false);
                }
                catch (Exception ex) {
                    CoreApp.logger.log($"Unexpected error while adding product details.(AddProductViewModel): {ex}", Logger.LogLevel.LEVEL_ERROR);
                    this.HomeViewModel.setNotification("Some unexpected error occured while adding product details.", false);
                }
            }
            else
            {
                try {
                    validate();

                    ProductAccess.singleton.updateProduct(model, this.ID);
                    HomeViewModel.ProductsUpdated = true;
                    this.AddProductView.Close();
                    CoreApp.logger.log("Product model successfully updated.(AddProductViewModel)");
                    this.HomeViewModel.setNotification("Product details updated successfully!", true);
                }
                catch (EmptyFieldException) {
                    this.HomeViewModel.setNotification("Required fields cannot be empty.", false);
                }
                catch (Exception ex) {
                    CoreApp.logger.log($"Unexpected error while updating product details.(AddProductViewModel): {ex}", Logger.LogLevel.LEVEL_ERROR);
                    this.HomeViewModel.setNotification("Some unexpected error occured while updating product details.", false);
                }
            }
        }
Example #13
0
        /// <summary>
        /// Get Consumable Type according the item number
        /// </summary>
        /// <param name="barcode">the barcode</param>
        /// <returns>Consumable Type</returns>
        public ConsumableType GetConsumableType(BarcodeModel barcode)
        {
            if (BarcodeModel.IsGtinValid(barcode.GTIN))
            {
                return((ConsumableData?.ConsumableTypes)?.FirstOrDefault(x =>
                                                                         x.CompanyCode.Equals(barcode.CompanyCode) && x.ItemNumber == barcode.ItemNo));
            }

            return(null);
        }
        private void DisplayData(BarcodeModel parsedModel)
        {
            if (parsedModel == null)
            {
                return;
            }

            SetLabelInfo(parsedModel);
            SetDrugInfo(parsedModel);
        }
        public BarcodeItemPage(INavigation Navigation = null, BarcodeModel barcode = null)
        {
            InitializeComponent();

            var vm = new BarcodeItemViewModel(barcode);

            vm.Navigation = Navigation;

            BindingContext = vm;
        }
Example #16
0
        private bool ValidateConsumableIfDuplicate(BarcodeModel consumableModel, IEnumerable <BarcodeModel> barcodeList)
        {
            var newBarcodeGtin = Convert.ToInt64(consumableModel.GTIN);

            var existingBarcode = barcodeList.FirstOrDefault(b =>
                                                             Convert.ToInt64(b.GTIN) == newBarcodeGtin &&
                                                             b.Color == consumableModel.Color);

            return(existingBarcode == null);
        }
Example #17
0
        private bool ValidateRequiredConsumables(BarcodeModel consumableModel, IEnumerable <InvestigationConsumable> requiredConsumables)
        {
            var consumableType = consumableHelper.GetConsumableType(consumableModel);

            if (consumableType?.QualifyLevel == QualifyType.Qualified)
            {
                if (requiredConsumables != null)
                {
                    var investigationConsumables = requiredConsumables.ToList();

                    if (consumableModel.Color == (int)ColorEnums.Yellow && consumableType.PuraCatheter)
                    {
                        var puraConsumable = investigationConsumables.FirstOrDefault(c =>
                                                                                     c.IsScanned == false && c.RequiredCategory.Category == ConsumableCategory.PuraCatheter);

                        return(puraConsumable != null);
                    }
                    else
                    {
                        foreach (var consumable in investigationConsumables)
                        {
                            if (IsConsumableTypeMatched(consumableModel, consumable.RequiredCategory, consumableType) ==
                                QualifyType.Unknown)
                            {
                                continue;
                            }

                            // if all this consumable and its alternative consumables are not scanned, the consumableType is needed
                            if (!consumable.IsScanned)
                            {
                                var requiredCategory = consumable.RequiredCategory;

                                var alternativeConsumables = investigationConsumables.Where(x =>
                                                                                            x.RequiredCategory.Exclusive &&
                                                                                            x.RequiredCategory.InvestigationType == requiredCategory.InvestigationType &&
                                                                                            x.RequiredCategory.ChannelType == requiredCategory.ChannelType &&
                                                                                            x.RequiredCategory.Category != requiredCategory.Category);

                                if (!alternativeConsumables.Any(x => x.IsScanned))
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                return(true);
            }

            return(false);
        }
        private void OnDidScan(ScanSession session)
        {
            var firstCode = session.NewlyRecognizedCodes.First();
            var message   = "";

            if (session.NewlyRecognizedCodes.Count() == 1)
            {
                message = firstCode.Data;
            }
            else if (session.NewlyRecognizedCodes.Count() > 1)
            {
                var secondCode = session.NewlyRecognizedCodes.ElementAt(1);
                message = secondCode.Data;
            }

            // Because this event handler is called from an scanner-internal thread,
            // you must make sure to dispatch to the main thread for any UI work.
            Device.BeginInvokeOnMainThread(() =>
            {
                var check = models.Any(x => x.Barcode == message);
                if (!check)
                {
                    BottonText         = "Last scan: " + message;
                    BarcodeModel model = new BarcodeModel()
                    {
                        Barcode = message,
                        TagsStr = TagsStr,
                        Icon    = Cloud
                    };

                    if (Tags != null)
                    {
                        foreach (var item in Tags)
                        {
                            model.Tags.Add(item);
                        }
                    }
                    models.Add(model);
                    if (PageName == ViewTypeEnum.PalletizeView.ToString())
                    {
                        ScannerToPalletAssign scannerToPalletAssign = new ScannerToPalletAssign
                        {
                            Barcode = models.LastOrDefault().Barcode
                        };
                        MessagingCenter.Send(scannerToPalletAssign, "ScannerToPalletAssign");
                    }
                    try
                    {
                        Loader.Toast("Last scan: " + message);
                    }
                    catch { }
                }
            });
        }
Example #19
0
 private void AddProductToInvoice()
 {
     productId = Convert.ToInt32(row.Cells["Id"].Value);
     if (barcode != "")
     {
         BarcodeModel barcode = new BarcodeModel();
         barcode.Barcode   = this.barcode;
         barcode.ProductId = productId;
         SqliteDataAccessBarcode.SaveBarcode(barcode);
     }
     this.Close();
 }
        public async Task ValidateBarcodeInsertIntoLocalDB(IList <string> _barcodeId, string _page)
        {
            IMoveService _moveService = new MoveService();

            foreach (var item in _barcodeId)
            {
                BarcodeModel validateBarcodeModel = await _moveService.GetValidateBarcodeAsync(AppSettings.SessionId, item);

                validateBarcodeModel.Barcode = item;
                if (validateBarcodeModel.Kegs != null)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        switch (_page)
                        {
                        case "ScanKegsView":
                            ScanKegsMessage scanKegsMessage = new ScanKegsMessage
                            {
                                Barcodes = validateBarcodeModel
                            };
                            MessagingCenter.Send(scanKegsMessage, "ScanKegsMessage");
                            break;

                        case "FillScanView":
                            MessagingCenter.Send(new FillScanMessage
                            {
                                Barcodes = validateBarcodeModel
                            }, "FillScanMessage");
                            break;

                        case "MaintainScanView":
                            MaintainScanMessage maintainScanMessage = new MaintainScanMessage
                            {
                                Barcodes = validateBarcodeModel
                            };
                            MessagingCenter.Send(maintainScanMessage, "MaintainScanMessage");
                            break;

                        case "BulkUpdateScanView":
                            BulkUpdateScanMessage bulkUpdateScanMessage = new BulkUpdateScanMessage
                            {
                                Barcodes = validateBarcodeModel
                            };
                            MessagingCenter.Send(bulkUpdateScanMessage, "BulkUpdateScanMessage");
                            break;

                        default:
                            break;
                        }
                    });
                }
            }
        }
Example #21
0
 public IEnumerable <오류목록Model> GetErrorModel(BarcodeModel model, int cnt)
 {
     return(new List <오류목록Model>()
     {
         new 오류목록Model()
         {
             No = ++cnt,
             형 = "보험구분",
             메세지 = @"국민공단은 보험구분이 1이고 공상및보훈구분에 값이 없어야합니다."
         }
     });
 }
Example #22
0
 public IEnumerable <오류목록Model> GetErrorModel(BarcodeModel model, int cnt)
 {
     return(new List <오류목록Model>()
     {
         new 오류목록Model
         {
             No = ++cnt,
             형 = "보험구분",
             메세지 = "차상위 보험은 보험구분이 1이고 공상및보훈구분은 16(차상위 1종(C)) 이어야 합니다.",
         }
     });
 }
        //public static IEnumerable<string> GetAllPropertiesValue(BarcodeModel data)
        //{
        //    var headerProps = data.GetType().GetProperties();

        //    foreach (var headerProp in headerProps)
        //    {
        //        var header = headerProp.GetValue(data, null);
        //        var headerValues = header.GetType().GetProperties();

        //        // RXD는 따로 처리하자.
        //        if (headerProp.Name == "RXDs")
        //        {
        //            break;
        //            //    foreach (var RXD in header as IEnumerable<RXD>)
        //            //    {
        //            //        var RXDprops = RXD.GetType().GetProperties();

        //            //        foreach (var RXDProp in RXDprops)
        //            //        {
        //            //            yield return RXDProp.GetValue(RXD, null) as string;
        //            //        }
        //            //    }
        //        }
        //        else
        //        {
        //            foreach (var prop in headerValues)
        //            {
        //                yield return prop.GetValue(header, null) as string;
        //            }
        //        }
        //    }
        //}

        public static List <string> GetAllPropertiesValue(BarcodeModel data)
        {
            var retv        = new List <string>();
            var headerProps = data.GetType().GetProperties();

            try
            {
                foreach (var headerProp in headerProps)
                {
                    var header = headerProp.GetValue(data, null);

                    if (header == null)
                    {
                        continue;
                    }

                    var headerValues = header.GetType().GetProperties();

                    // RXD는 따로 처리하자.
                    if (headerProp.Name == "RXDs")
                    {
                        break;
                        //    foreach (var RXD in header as IEnumerable<RXD>)
                        //    {
                        //        var RXDprops = RXD.GetType().GetProperties();

                        //        foreach (var RXDProp in RXDprops)
                        //        {
                        //            yield return RXDProp.GetValue(RXD, null) as string;
                        //        }
                        //    }
                    }
                    else
                    {
                        foreach (var prop in headerValues)
                        {
                            retv.Add(prop.GetValue(header, null) as string);
                        }
                    }
                }
            }
            //catch (NullReferenceException ex)
            //{
            //    throw new MyLogicException("올바르게 파씽하지 못했습니다.\n\n오류목록과 바코드내용보기를 이용해 바코드의 내용을 확인해주세요");
            //}
            catch (Exception)
            {
                // 바코드 검증에 에러가 있어도 결과를 보여준다.
            }

            return(retv);
        }
Example #24
0
        private bool ValidateConsumableTimeLimit(BarcodeModel consumableModel, ReadPatients_Result currentPatient)
        {
            if (currentPatient == null)
            {
                return(true);
            }

            var newBarcodeGtin     = Convert.ToInt64(consumableModel.GTIN);
            var consumableType     = consumableHelper.GetConsumableType(consumableModel);
            var currentPatientDbId = currentPatient.DbId;

            if (consumableType == null || consumableType.TimeLimit == -1)
            {
                return(true);
            }
            else if (consumableModel.UsedDate != null)
            {
                var hours = (DateTime.Now - consumableModel.UsedDate).Value.TotalHours;

                if (hours > consumableType.TimeLimit)
                {
                    return(false);
                }
            }
            else
            {
                var testResult = BarcodeRepository.GetBarcodeTests(newBarcodeGtin, consumableModel.TagId);

                if (testResult == null)
                {
                    return(true);
                }

                var barcodeProceduresAssignedToCurrentPatient = testResult.Where(t => t.Study.patient_id == currentPatientDbId);

                if (!barcodeProceduresAssignedToCurrentPatient.Any())
                {
                    return(true);
                }

                var procedureTime = barcodeProceduresAssignedToCurrentPatient.First().test_time;
                var hours         = (DateTime.Now - procedureTime).TotalHours;

                if (hours > consumableType.TimeLimit)
                {
                    return(false);
                }
            }

            return(true);
        }
        private void BarcodeManualCommandRecieverAsync()
        {
            try
            {
                bool isNew = BarcodeCollection.ToList().Any(x => x.Barcode == ManaulBarcode);

                BarcodeModel model = null;
                    if(!isNew)
                {
                    try
                    {
                        model = new BarcodeModel
                        {
                            Barcode = ManaulBarcode,
                            TagsStr = TagsStr,
                            Icon = Cloud,
                            Page = ViewTypeEnum.FillScanView.ToString(),
                            Contents = Tags.Count > 2 ? Tags?[2]?.Name??string.Empty : string.Empty
                        };
                        if (ConstantManager.Tags != null)
                        {
                            foreach (var item in ConstantManager.Tags)
                                model.Tags.Add(item);
                        }
                        BarcodeCollection.Add(model);
                    }
                   
                    catch (Exception ex)
                    {
                        Crashes.TrackError(ex);
                    }

                    var current = Connectivity.NetworkAccess;
                    if (current == NetworkAccess.Internet)
                    {
                        var message = new StartLongRunningTaskMessage
                        {
                            Barcode = new List<string>() { ManaulBarcode },
                            PageName = ViewTypeEnum.FillScanView.ToString()
                        };
                        MessagingCenter.Send(message, "StartLongRunningTaskMessage");
                    }

                    ManaulBarcode = string.Empty;
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
        }
        public IEnumerable <오류목록Model> GetErrorModel(BarcodeModel model, int cnt)
        {
            var retv = new List <오류목록Model>();

            if (!(model.IN1.보험구분 == "1" && model.IN1.공상및보훈구분 == "7"))
            {
                retv.Add(new 오류목록Model()
                {
                    No = ++cnt, 형 = "보험구분", 메세지 = "보훈국비 바코드의 보험구분은 1이고 공상및보훈구분에 7값이 들어가야 합니다."
                });
            }

            return(retv);
        }
Example #27
0
        public byte[] Encode(BarcodeModel barcodeModel)
        {
            var consumableItems = ConvertBarcodeModelToConsumableItem(barcodeModel);

            if (consumableItems == null)
            {
                return(null);
            }

            ManufacturerInfo manufacturerInfo = manufacturerService.GetManufacturerInfo(1);
            var overallDataLayout             = smartSenseSecure.Encode(manufacturerInfo.EncryptionScheme, consumableItems);

            return(overallDataLayout.ContinuousBlockBytes);
        }
        private void BarcodeManualCommandRecieverAsync()
        {
            try
            {
                var isNew = BarcodeCollection.ToList().Any(x => x?.Kegs?.Partners?.FirstOrDefault()?.Kegs?.FirstOrDefault()?.Barcode == ManaulBarcode);
                if (!isNew)
                {
                    UpdateTagsStr();
                    BarcodeModel model = new BarcodeModel()
                    {
                        Barcode  = ManaulBarcode,
                        TagsStr  = TagsStr,
                        Icon     = _getIconByPlatform.GetIcon(Cloud),
                        Page     = ViewTypeEnum.ScanKegsView.ToString(),
                        Contents = SelectedBrand?.BrandName
                    };

                    if (ConstantManager.Tags != null)
                    {
                        foreach (var item in ConstantManager.Tags)
                        {
                            model.Tags.Add(item);
                        }
                    }

                    BarcodeCollection.Add(model);

                    var current = Connectivity.NetworkAccess;
                    if (current == NetworkAccess.Internet)
                    {
                        var message = new StartLongRunningTaskMessage
                        {
                            Barcode = new List <string>()
                            {
                                ManaulBarcode
                            },
                            PageName = ViewTypeEnum.ScanKegsView.ToString()
                        };
                        MessagingCenter.Send(message, "StartLongRunningTaskMessage");
                    }

                    ManaulBarcode = string.Empty;
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
        }
 public MainPageViewModel()
 {
     SearchCommand = new Command(() =>
     {
         if (!string.IsNullOrEmpty(InputText) && !string.IsNullOrWhiteSpace(InputText))
         {
             var barCode = new BarcodeModel
             {
                 Barcode = InputText
             };
             LabelText = barCode.Barcode;
             InputText = string.Empty;
         }
     });
 }
 private async void IconItemTappedCommandRecieverAsync(BarcodeModel model)
 {
     try
     {
         if (model.Kegs.Partners.Count > 1)
         {
             List<BarcodeModel> modelList = new List<BarcodeModel>
             {
                 model
             };
             await NavigateToValidatePartner(modelList);
         }
         else
         {
             if (model.Kegs.Partners?.FirstOrDefault()?.Kegs.FirstOrDefault().MaintenanceItems?.Count > 0)
             {
                 string strAlert = string.Empty;
                 for (int i = 0; i < model.Kegs.MaintenanceItems.Count; i++)
                 {
                     strAlert += "-" + model.Kegs.MaintenanceItems[i].Name + "\n";
                     if (model.Kegs.Partners.FirstOrDefault().Kegs.FirstOrDefault().MaintenanceItems.Count == i)
                     {
                         break;
                     }
                 }
                 await _dialogService.DisplayAlertAsync("Warning", "This keg needs the following maintenance performed:\n" + strAlert, "Ok");
             }
             else
             {
                 if (model.Icon == "validationerror.png")
                 {
                     bool accept = await _dialogService.DisplayAlertAsync("Warning", "This scan could not be verified", "Keep", "Delete");
                 }
                 else
                 {
                     await _navigationService.NavigateAsync("ScanInfoView", new NavigationParameters
                     {
                         { "model", model }
                     }, animated: false);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }