public void GetCurrentProductDetails() { ProductComponent ProductComp = new ProductComponent(); var product = ProductComp.GetCurrentProduct(); _current_product_id = product.ProductId; _current_product_code = product.ProductCode; _current_product_density = product.Density; _curent_product_name = product.Name; _current_target_weight = product.TargetWeight; _current_upper_limit = product.UpperLimit; _current_lower_limit = product.LowerLimit; }
private void btnSaveProduct_Click(object sender, RoutedEventArgs e) { if (ValidateSaveProduct() == false) { return; } if (_product == null) { _product = new WeighrDAL.Models.Product(); _product.ProductId = 0; } _product.ProductCode = ProductCodeTextBox.Text; _product.Name = ProductNameTextBox.Text; _product.Density = Decimal.Parse(DensityTextBox.Text); _product.TargetWeight = Decimal.Parse(TargetWeightTextBox.Text); _product.UpperLimit = Decimal.Parse(UpperLimitTextBox.Text); _product.LowerLimit = Decimal.Parse(LowerLimitTextBox.Text); _product.Inflight = 0;// Decimal.Parse(InflightTextBox.Text); _product.DribblePoint = Decimal.Parse(DribblePointTextBox.Text); _product.ExpectedFillTime = decimal.Parse(ExpectedFillTimeTextBox.Text); ProductComponent productComp = new ProductComponent(); var curProduct = productComp.GetCurrentProduct(); if (curProduct == null) { _product.isCurrent = true; } if (_product.ProductId == 0) { productComp.AddProduct(_product); } else { productComp.UpdateProduct(_product); } ClearProduct(); LoadProductsList(); saveSuccessfullmessage(); }
private void Page_Loaded(object sender, RoutedEventArgs e) { DeviceInfoComponent deviceInfoComp = new DeviceInfoComponent(); _deviceInfo = deviceInfoComp.GetDeviceInfo(); if (GetScaleSettings() == false) { NoSettingsMessage(); return; } if (GetScaleCalibration() == false) { NoCalibrationMessage(); return; } ProductComponent productComp = new ProductComponent(); _ProductsList = productComp.GetProducts(); ProductsComboBox.ItemsSource = _ProductsList; _currentProduct = productComp.GetCurrentProduct(); //txtFlyoutMessage.Text = "Confirm. The currently selected product is " + _currentProduct.Name; if (_currentProduct != null) { ProductsComboBox.SelectedValue = _currentProduct.ProductCode; //_normal_cutoff_weight = (_currentProduct.TargetWeight) * Convert.ToDecimal(0.8); _normal_cutoff_weight = _currentProduct.DribblePoint; if (MainPage._inflight_setpoint == 0) { _final_setpoint_weight = _currentProduct.TargetWeight - _scaleSetting.Inflight; } else { _final_setpoint_weight = _currentProduct.TargetWeight - MainPage._inflight_setpoint; } tblWeigherStatus.Text = "Ready To Fill"; AcknowledgeProductSelection(_currentProduct); ProductNameTextBox.Text = _currentProduct.Name + " : " + _currentProduct.TargetWeight + " Kgs"; BatchNumberTextBox.Text = "Batch No:" + _currentBatch.BatchCode; timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 0, 0, 1); // Interval of the timer timer.Tick += timer_Tick; timer.Start(); } else { //Please configure product NoProductMessage(); } BatchComponent batchComp = new BatchComponent(); _currentBatch = batchComp.GetCurrentBatch(); if (_currentBatch != null) { BatchNumberTextBox.Text = _currentBatch.BatchCode; } }