示例#1
0
        /// <summary>
        /// Method to add stock
        /// </summary>
        /// <returns></returns>
        private async Task AddStock()
        {
            decimal regularPrice;
            var     stock = new EntityLayer.Entities.Stock.StockModel
            {
                Description  = Description,
                RegularPrice = decimal.TryParse(RegularPrice, NumberStyles.Any, CultureInfo.InvariantCulture, out regularPrice) ? regularPrice : 0.00M,
                StockCode    = StockCode
            };

            stock.TaxCodes.TaxCode.AddRange
                (TaxCodes.Where(x => x.IsChecked == true).Select(x => x.TaxCode).ToList());

            if (await _stockBussinessLogic.AddProductAsync(stock))
            {
                if (IsNotReceivedFromAddSale)
                {
                    NavigateService.Instance.NavigateToHome();
                }
                else
                {
                    MessengerInstance.Send(new AddStockToSaleMessage
                    {
                        StockCode       = stock.StockCode,
                        Quantity        = 1,
                        IsManuallyAdded = true
                    }, "VerifyAndAddStockForSale");
                }
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _TaxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(WATaxProvider)));
            if (_TaxGatewayId > 0)
            {
                _TaxGateway = TaxGatewayDataSource.Load(_TaxGatewayId);
            }
            if (_TaxGateway != null)
            {
                _TaxProvider = _TaxGateway.GetProviderInstance() as WATaxProvider;
            }
            if (_TaxProvider == null)
            {
                _TaxProvider = new WATaxProvider();
            }

            if (_TaxGateway == null)
            {
                _TaxGateway = new TaxGateway();

                _TaxGateway.ClassId = Misc.GetClassId(typeof(WATaxProvider));
                _TaxGateway.Name    = _TaxProvider.Name;
                _TaxGateway.Store   = AbleContext.Current.Store;
            }

            if (!Page.IsPostBack)
            {
                TaxName.Text      = _TaxProvider.TaxName;
                DebugMode.Checked = _TaxProvider.UseDebugMode;

                // INITIALIZE TAX CODES LIST
                IList <TaxCode> taxCodes = TaxCodeDataSource.LoadAll();
                TaxCodes.DataSource = taxCodes;
                TaxCodes.DataBind();


                // SELECT THE CONFIGURED TAX CODES
                foreach (ListItem taxCodeItem in this.TaxCodes.Items)
                {
                    taxCodeItem.Selected = (_TaxProvider.TaxCodes.Contains(AlwaysConvert.ToInt(taxCodeItem.Value)));
                }
            }
        }