예제 #1
0
 private void ChangeGridColumnHeaderValue()
 {
     if (PriceUnits.ElementAt(SelectedPriceUnitIndex) == "%")
     {
         Column2Header = ApplicationConstants.Percent;
     }
     else
     {
         Column2Header = ApplicationConstants.Prices;
     }
 }
예제 #2
0
        private async Task PriceChangeAsync()
        {
            if (IsAllFieldsEntered())
            {
                if (SelectedPriceIndex >= 0 &&
                    !(StockPriceModel?.SpecialPriceTypes.ElementAt(SelectedPriceIndex)).Equals(ApplicationConstants.RegularPriceText))
                {
                    var ChangePrice = new ChangePrice()
                    {
                        Fromdate           = StockPriceModel.FromDate.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture),
                        Todate             = StockPriceModel.ToDate.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture),
                        StockCode          = StockCode,
                        RegisterNumber     = CacheBusinessLogic.RegisterNumber,
                        TillNumber         = CacheBusinessLogic.TillNumber,
                        SaleNumber         = CacheBusinessLogic.SaleNumber,
                        RegularPrice       = decimal.Parse(StockPriceModel.RegularPriceText, CultureInfo.InvariantCulture),
                        IsEndDate          = StockPriceModel.IsEndDateChecked,
                        PerDollarChecked   = PriceUnits.ElementAt(_selectedPriceUnitIndex).Equals("$"),
                        PriceType          = StockPriceModel?.SpecialPriceTypes.ElementAt(SelectedPriceIndex),
                        GridPricesContract = GetGridPrices()
                    };

                    var response = await _stockBussinessLogic.EditPrice(ChangePrice, false);

                    WriteToLineDisplay(response.LineDisplay);
                    MapStockPriceModel(response);
                    EditPrice(false);
                }
                else
                {
                    var ChangePrice = new ChangePrice()
                    {
                        StockCode      = StockCode,
                        RegisterNumber = CacheBusinessLogic.RegisterNumber,
                        TillNumber     = CacheBusinessLogic.TillNumber,
                        SaleNumber     = CacheBusinessLogic.SaleNumber,
                        RegularPrice   = decimal.Parse(StockPriceModel.RegularPriceText, CultureInfo.InvariantCulture)
                    };

                    var response = await _stockBussinessLogic.EditPrice(ChangePrice, true);

                    WriteToLineDisplay(response.LineDisplay);
                    MapStockPriceModel(response);
                    EditPrice(false);
                }
            }
        }
예제 #3
0
 public string GetTrString()
 {
     return(PriceTotalTr + " " + PriceUnits.GetUnitPrice(PriceTotalTrUnit));
 }
예제 #4
0
 public string GetUSDString()
 {
     return(PriceTotal + " " + PriceUnits.GetUnitPrice(PriceTotalUnit));
 }
예제 #5
0
        private void MapStockPriceModel(StockPrice response)
        {
            try
            {
                StockPriceModel.SpecialPriceTypes = MapSepcialPrices(response.SpecialPriceTypes);
            }
            catch (Exception)
            {
            }
            finally
            {
                StockPriceModel.Description       = string.Format("{0} (#{1})", response.Description, StockCode);
                StockPriceModel.AvailableQuantity = response.AvailableQuantity;
                StockPriceModel.ToDate            = string.IsNullOrEmpty(response.ToDate) ? DateTimeOffset.Now :
                                                    Convert.ToDateTime(response.ToDate, CultureInfo.InvariantCulture);
                StockPriceModel.FromDate = string.IsNullOrEmpty(response.FromDate) ? DateTimeOffset.Now :
                                           Convert.ToDateTime(response.FromDate, CultureInfo.InvariantCulture);
                StockPriceModel.RegularPriceText      = response.RegularPriceText;
                StockPriceModel.IsAddButtonVisible    = response.IsAddButtonVisible && IsEditButtonPressed;
                StockPriceModel.IsChangePriceEnable   = response.IsChangePriceEnable;
                StockPriceModel.IsRemoveButtonVisible = response.IsRemoveButtonVisible && IsEditButtonPressed;
                StockPriceModel.IsToDateVisible       = response.IsToDateVisible && response.IsSpecialPricingVisible;
                StockPriceModel.TaxExemptPrice        = response.TaxExemptPrice;
                StockPriceModel.TaxExemptAvailable    = response.TaxExemptAvailable;
                StockPriceModel.IsTaxExemptVisible    = response.IsTaxExemptVisible;
                StockPriceModel.VendorId          = response.VendorId;
                StockPriceModel.AvailableQuantity = response.AvailableQuantity;
                _defaultSelectedSpecialPrice      = StockPriceModel.PriceTypeText = response.PriceTypeText;
                SelectedPriceIndex = string.IsNullOrEmpty(response.PriceTypeText) ? -1 :
                                     response.SpecialPriceTypes.IndexOf(response.PriceTypeText);


                ControlUIElementVisibility();

                if (response.XForPrice.Columns > 0)
                {
                    MapPriceTypeModelWithReponse(response.XForPrice);
                }
                else if (response.IncrementalPrice.Columns > 0)
                {
                    MapPriceTypeModelWithReponse(response.IncrementalPrice);
                }
                else if (response.FirstUnitPrice.Columns > 0)
                {
                    MapPriceTypeModelWithReponse(response.FirstUnitPrice);
                }
                else if (response.SalePrice.Columns > 0)
                {
                    MapPriceTypeModelWithReponse(response.SalePrice);
                }
                else
                {
                    ResetPriceTypeList();
                }

                if (response.IsPerDollarChecked)
                {
                    SelectedPriceUnitIndex = PriceUnits.IndexOf("$");
                }
                else if (response.IsPerPercentageChecked)
                {
                    SelectedPriceUnitIndex = PriceUnits.IndexOf("%");
                }
            }
        }