Ejemplo n.º 1
0
        public EditBarcodeSettingWindow(BarcodeSetting barcodeSetting)
        {
            viewModel   = new EditBarcodeSettingsViewModel(barcodeSetting);
            DataContext = viewModel;

            InitializeComponent();
        }
Ejemplo n.º 2
0
        public static BaseBarcodeSettingModel ToBaseBarcodeSetting(this BarcodeSetting barcodeSetting)
        {
            BaseBarcodeSettingModel _result = new BaseBarcodeSettingModel();

            _result.Id = barcodeSetting.Id;
            _result.ShowProductCode  = barcodeSetting.ShowProductCode;
            _result.ShowCompanyName  = barcodeSetting.ShowCompanyName;
            _result.ShowPurchaseRate = barcodeSetting.ShowPurchaseRate;
            _result.ShowMRP          = barcodeSetting.ShowMRP;
            _result.CompanyName      = barcodeSetting.CompanyName;
            _result.Point            = barcodeSetting.Point;
            _result.Zero             = barcodeSetting.Zero;
            _result.One          = barcodeSetting.One;
            _result.Two          = barcodeSetting.Two;
            _result.Three        = barcodeSetting.Three;
            _result.Four         = barcodeSetting.Four;
            _result.Five         = barcodeSetting.Five;
            _result.Six          = barcodeSetting.Six;
            _result.Seven        = barcodeSetting.Seven;
            _result.Eight        = barcodeSetting.Eight;
            _result.Nine         = barcodeSetting.Nine;
            _result.CreatedDate  = barcodeSetting.CreatedDate;
            _result.ModifiedDate = barcodeSetting.ModifiedDate;
            return(_result);
        }
Ejemplo n.º 3
0
 public async Task <UpsertBaseBarcodeSettingResponse> UpsertBaseBarcodeSettingAsync(UpsertBaseBarcodeSettingRequest request)
 {
     return(await Task.Run(() =>
     {
         UpsertBaseBarcodeSettingResponse _response = new UpsertBaseBarcodeSettingResponse();
         using (AsyncAutomateAccountingEntities _dbContext = new AsyncAutomateAccountingEntities())
         {
             if (request.BaseObject != null)
             {
                 try
                 {
                     BarcodeSetting _barcodeSetting = request.BaseObject.ToBarcodeSetting();
                     UpsertEntity <BarcodeSetting>(request.BaseObject.Id, ref _barcodeSetting, _dbContext);
                     _response.BaseObject = _barcodeSetting.ToBaseBarcodeSetting();
                 }
                 catch (Exception ex) { AssignStatusData(_response, false, string.Format("Some error occurred during DB interaction. Message is something like : \n{0}", ex.Message)); }
             }
             else
             {
                 AssignStatusData(_response, false, "No entity data recieved to insert/update.");
             }
         }
         return _response;
     }));
 }
Ejemplo n.º 4
0
        public void UpdateBarcodeSettings()
        {
            barcodeSettings.Clear();
            foreach (var row in settingsDataSet.BarcodeSetting)
            {
                BarcodeSetting setting = new BarcodeSetting(row.Id, row.Name, row.Value, row.Barcode, row.IsFixPrice);
                barcodeSettings.Add(setting);
            }

            barcodeSettings = new List <BarcodeSetting>(barcodeSettings.OrderBy(b => b.Name));
        }
Ejemplo n.º 5
0
        private void DeleteBarcodeSetting(object sender, RoutedEventArgs e)
        {
            Button         button         = e.Source as Button;
            BarcodeSetting barcodeSetting = button.CommandParameter as BarcodeSetting;

            MessageBoxResult result = MessageBox.Show("Wollen Sie diese Konfiguration " + barcodeSetting.Name + " (Barcode=" + barcodeSetting.Barcode + ") wirklich löschen?", "Barcode-Konfiguration löschen", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                viewModel.RemoveBarcodeSetting(barcodeSetting);
            }
        }
Ejemplo n.º 6
0
        private void EditBarcodeSetting(object sender, RoutedEventArgs e)
        {
            Button         button         = e.Source as Button;
            BarcodeSetting barcodeSetting = button.CommandParameter as BarcodeSetting;

            EditBarcodeSettingWindow editBarcodeSettingWindow = new EditBarcodeSettingWindow(barcodeSetting);

            if (editBarcodeSettingWindow.ShowDialog() == true)
            {
                viewModel.EditBarcodeSetting(editBarcodeSettingWindow.BarcodeSetting);
            }
        }
Ejemplo n.º 7
0
        public void RemoveBarcodeSettings(int settingId)
        {
            BarcodeSetting setting = barcodeSettings.FirstOrDefault(s => s.Id == settingId);

            barcodeSettings.Remove(setting);

            SettingsDataSet.BarcodeSettingRow row = settingsDataSet.BarcodeSetting.FindById(setting.Id);
            settingsDataSet.BarcodeSetting.RemoveBarcodeSettingRow(row);

            settingsDataSet.AcceptChanges();
            Notify();
        }
Ejemplo n.º 8
0
        public void AddBarcodeSetting(BarcodeSetting setting)
        {
            barcodeSettings.Add(setting);

            SettingsDataSet.BarcodeSettingRow row = settingsDataSet.BarcodeSetting.NewBarcodeSettingRow();
            row.Name       = setting.Name;
            row.Value      = setting.Value;
            row.Barcode    = GetBarcode(setting.Barcode);
            row.IsFixPrice = setting.IsFixPrice;
            settingsDataSet.BarcodeSetting.AddBarcodeSettingRow(row);

            settingsDataSet.AcceptChanges();
            Notify();
        }
Ejemplo n.º 9
0
        private void EditBarcodeSettingFromList(object sender, MouseButtonEventArgs e)
        {
            ListBox        list           = e.Source as ListBox;
            BarcodeSetting barcodeSetting = list.SelectedItem as BarcodeSetting;

            if (barcodeSetting != null)
            {
                BarcodeSetting           editableBarcodeSetting   = new BarcodeSetting(barcodeSetting.Id, barcodeSetting.Name, barcodeSetting.Value, barcodeSetting.Barcode, barcodeSetting.IsFixPrice);
                EditBarcodeSettingWindow editBarcodeSettingWindow = new EditBarcodeSettingWindow(editableBarcodeSetting);
                if (editBarcodeSettingWindow.ShowDialog() == true)
                {
                    viewModel.EditBarcodeSetting(editBarcodeSettingWindow.BarcodeSetting);
                }
            }
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            BarcodeSetting barcodeSetting = value as BarcodeSetting;

            if (barcodeSetting != null)
            {
                if (barcodeSetting.IsFixPrice)
                {
                    return(string.Format("{0:0.00} CHF", barcodeSetting.Value));
                }

                return(string.Format("{0}%", barcodeSetting.Value * 100));
            }
            return(string.Empty);
        }
Ejemplo n.º 11
0
        public void EditBarcodeSetting(BarcodeSetting setting)
        {
            BarcodeSetting oldSetting = barcodeSettings.FirstOrDefault(s => s.Id == setting.Id);

            oldSetting.Name       = setting.Name;
            oldSetting.Value      = setting.Value;
            oldSetting.Barcode    = GetBarcode(setting.Barcode);
            oldSetting.IsFixPrice = setting.IsFixPrice;

            SettingsDataSet.BarcodeSettingRow row = settingsDataSet.BarcodeSetting.FindById(setting.Id);
            row.Name       = setting.Name;
            row.Value      = setting.Value;
            row.Barcode    = GetBarcode(setting.Barcode);
            row.IsFixPrice = setting.IsFixPrice;

            settingsDataSet.AcceptChanges();
            Notify();
        }
Ejemplo n.º 12
0
 public void AddBarcodeSetting(BarcodeSetting barcodeSetting)
 {
     dataAccess.AddBarcodeSetting(barcodeSetting);
 }
Ejemplo n.º 13
0
 public void RemoveBarcodeSetting(BarcodeSetting barcodeSetting)
 {
     dataAccess.RemoveBarcodeSettings(barcodeSetting.Id);
 }
Ejemplo n.º 14
0
 public void EditBarcodeSetting(BarcodeSetting barcodeSetting)
 {
     dataAccess.EditBarcodeSetting(barcodeSetting);
 }
Ejemplo n.º 15
0
 public EditBarcodeSettingsViewModel(BarcodeSetting barcodeSetting)
 {
     this.barcodeSetting = barcodeSetting;
 }
 public AddBarcodeSettingViewModel()
 {
     barcodeSetting = new BarcodeSetting();
 }