Ejemplo n.º 1
0
        private async void FormLoaded(object sender, EventArgs e)
        {
            Looper = new frmLooper(this);
            Looper.Show(this);
            places = new PlacesKeeper();
            parts  = new PartKeeper();
            await SetComboboxes();

            txtDFrom.CustomFormat = " ";
            txtDTo.CustomFormat   = " ";
            if (mode == 1)
            {
                txtDFrom.Value = DateTime.Today;
            }
            txtAmount.Text = _this.Amount.ToString();
            if (_this.ValidFrom != null)
            {
                txtDFrom.Value = _this.ValidFrom.Value;
            }
            if (_this.ValidTo != null)
            {
                txtDTo.Value = _this.ValidTo.Value;
            }
            Looper.Hide();
        }
Ejemplo n.º 2
0
        public async Task Scan()
        {
            try
            {
                QrHandler qr  = new QrHandler();
                string    res = await qr.Scan();

                res = res.Replace("<Part>", "");
                Part p = await PartKeeper.GetByToken(res);

                if (p == null)
                {
                    DependencyService.Get <IToaster>().ShortAlert($"Część o kodzie {res} nie została znaleziona!");
                }
                else
                {
                    PartUsage pu = new PartUsage
                    {
                        PartId       = p.PartId,
                        Name         = p.Name,
                        Symbol       = p.Symbol,
                        ProducerId   = p.ProducerId,
                        ProducerName = p.ProducerName,
                        Description  = p.Description,
                        Image        = p.Image,
                        Amount       = 1
                    };
                    Items.Add(pu);
                }
            }
            catch (Exception ex)
            {
                DependencyService.Get <IToaster>().ShortAlert($"Error: {ex.Message}");
            }
        }
Ejemplo n.º 3
0
 public PartsPageViewModel()
 {
     Keeper        = new PartKeeper();
     ItemTreshold  = 5;
     PageSize      = 15;
     ReloadCommand = new AsyncCommand(Reload);
     ScanCommand   = new AsyncCommand(Scan);
     ItemTresholdReachedCommand = new AsyncCommand(ItemTresholdReached);
 }
Ejemplo n.º 4
0
 public AssignedPartsViewModel()
 {
     ScanCommand        = new AsyncCommand(Scan);
     SearchCommand      = new AsyncCommand(Search);
     RemoveItemsCommand = new AsyncCommand(RemoveItems);
     Items           = new ObservableRangeCollection <PartUsage>();
     SelectedItems   = new ObservableRangeCollection <PartUsage>();
     PartKeeper      = new PartKeeper();
     PartUsageKeeper = new PartUsageKeeper();
 }
Ejemplo n.º 5
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            //print
            PartKeeper partKeeper = new PartKeeper();

            partKeeper.Items.Add(_this);
            List <int> lInt = new List <int>();

            lInt.Add(_this.PartId);
            partKeeper.PrintQR(lInt);
        }
Ejemplo n.º 6
0
 public PartFinder(Control parent)
 {
     InitializeComponent();
     this.Visible          = false;
     this.Parent           = parent;
     this.CausesValidation = false;
     SetStyle(ControlStyles.SupportsTransparentBackColor, true);
     this.BackColor = Color.Transparent;
     DGV            = (DataGridView)parent;
     Keeper         = RuntimeSettings.PartBackup;
     Init();
 }
Ejemplo n.º 7
0
        private async Task LoadAllData()
        {
            List <Task> tasks        = new List <Task>();
            Task        partsLoad    = Task.Run(() => PartKeeper.Refresh());
            Task        storagesLoad = Task.Run(() => StorageBinKeeper.Refresh());

            tasks.Add(partsLoad);
            tasks.Add(storagesLoad);
            if (StorageBin != null)
            {
                tasks.Add(Task.Run(() => StockTakingKeeper.Refresh()));
            }
            await Task.WhenAll(tasks);
        }
Ejemplo n.º 8
0
        public async Task GoToAssign()
        {
            looper.Show();
            try
            {
                if (thisItem.ProcessId != null)
                {
                    var processKeeper = new ProcessesKeeper();
                    await processKeeper.GetByProcessId((int)thisItem.ProcessId);

                    frmProcess FrmProcess = new frmProcess(processKeeper.Items.FirstOrDefault(), ParentForm);
                    FrmProcess.Show();
                }
                else if (thisItem.PlaceId != null)
                {
                    var placeKeeper = new PlacesKeeper();
                    await placeKeeper.Refresh(query : $"PlaceId={thisItem.PlaceId}");

                    frmPlace FrmPlace = new frmPlace(placeKeeper.Items.FirstOrDefault(), ParentForm);
                    FrmPlace.Show();
                }
                else if (thisItem.PartId != null)
                {
                    var partKeeper = new PartKeeper();
                    await partKeeper.Refresh(query : $"PartId={thisItem.PartId}");

                    frmPart FrmPart = new frmPart(partKeeper.Items.FirstOrDefault(), ParentForm);
                    FrmPart.Show();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                looper.Hide();
            }
        }
Ejemplo n.º 9
0
 private void Init()
 {
     PartKeeper        = new PartKeeper();
     StorageBinKeeper  = new StorageBinKeeper();
     StockTakingKeeper = new StockTakingKeeper();
 }