protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            receiveLine = (ReceiveLine)e.Parameter;

            if (receiveLine.DocumentID != null)
            {
                receiveHeader     = dbCtx.ReceiveHeaders.FirstOrDefault(x => x.DocumentID == receiveLine.DocumentID);
                DocumentIDTb.Text = receiveLine.DocumentID;
                QuantityTb.Text   = "0.0";
            }
        }
        private void SaveReceiveLineButton_Click(object sender, RoutedEventArgs e)
        {
            using (DBContext dbCtx = new DBContext())
            {
                receiveLine = dbCtx.ReceiveLines.First(x => x.DocumentID == receiveLine.DocumentID && x.PositionNumber == receiveLine.PositionNumber);
                dbCtx.ReceiveLines.Attach(receiveLine);
                receiveLine.Quantity         = Convert.ToDouble(QuantityTb.Text);
                receiveLine.ReceiveQuantity  = Convert.ToDouble(ReceiveQuantityTb.Text);
                receiveLine.ReceivedQuantity = Convert.ToDouble(ReceivedQuantityTb.Text);

                dbCtx.SaveChanges();
            }
            this.Frame.Navigate(typeof(ReceiveHeaderPage), receiveHeader);
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            using (DBContext dbCtx = new DBContext())
            {
                receiveLine   = (ReceiveLine)e.Parameter;
                receiveHeader = dbCtx.ReceiveHeaders.First(x => x.DocumentID == receiveLine.DocumentID);

                DocumentIDTb.Text = receiveLine.DocumentID;

                QuantityTb.Text = receiveLine.Quantity.ToString();

                ReceiveQuantityTb.Text  = receiveLine.ReceiveQuantity.ToString();
                ReceivedQuantityTb.Text = receiveLine.ReceivedQuantity.ToString();
            }
        }
        private async void SaveReceiveLineButton_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(QuantityTb.Text))
            {
                MessageDialog message = new MessageDialog("Nie podano ilości.", "Operacja przerwana");
                await message.ShowAsync();

                return;
            }
            var Itm   = ItemIDCb.SelectedItem as Item;
            var ISKU  = StockKeepUnitCb.SelectedItem as ItemStockKeepUnit;
            var MagNr = WarehouseNameCb.SelectedItem as Warehouse;
            var MagPl = WarehousePlaceCb.SelectedItem as WarehousePlace;

            if (Itm == null)
            {
                MessageDialog message = new MessageDialog("Nie wybrano produktu", "Operacja przerwana");
                await message.ShowAsync();

                return;
            }
            if (ISKU == null)
            {
                MessageDialog message = new MessageDialog("Nie wybrano jednostki.", "Operacja przerwana");
                await message.ShowAsync();

                return;
            }

            using (DBContext dbCtx = new DBContext())
            {
                int position = 0;
                if (dbCtx.ReceiveLines.Any(x => x.DocumentID == DocumentIDTb.Text))
                {
                    position = dbCtx.ReceiveLines.Last(x => x.DocumentID == DocumentIDTb.Text).PositionNumber + 1;
                }
                else
                {
                    position = 1;
                }
                double qty = 0.0;
                if (!String.IsNullOrEmpty(QuantityTb.Text))
                {
                    qty = Convert.ToDouble(QuantityTb.Text);
                }
                else
                {
                    qty = Convert.ToDouble(0);
                }

                receiveLine = new ReceiveLine(DocumentIDTb.Text, position, Itm.ItemID, ISKU.Code, MagNr.WarehouseName, MagPl.WarehousePlaceName, qty);
                string errorMsg = InvMgt.isReceiveLineValid(receiveLine);
                if (String.IsNullOrEmpty(errorMsg))
                {
                    dbCtx.ReceiveLines.Add(receiveLine);
                    dbCtx.SaveChanges();
                    ReceiveHeader receiveHeader = dbCtx.ReceiveHeaders.FirstOrDefault(x => x.DocumentID == receiveLine.DocumentID);

                    this.Frame.Navigate(typeof(ReceiveHeaderPage), receiveHeader);
                }
                else
                {
                    MessageDialog message = new MessageDialog(errorMsg, "Operacja przerwana");
                    await message.ShowAsync();

                    return;
                }
            }
        }
        /// <summary>
        /// Gets the abbreviated article headers.
        /// </summary>
        /// <param name="firstArticleId">The first article id.</param>
        /// <param name="lastArticleId">The last article id.</param>
        /// <param name="receiveLine">The receive line.</param>
        public void GetAbbreviatedArticleHeaders(int firstArticleId, int lastArticleId, ReceiveLine receiveLine)
        {
            if (!CurrentGroupSelected)
            {
                throw new NntpGroupNotSelectedException();
            }

            if (m_supportsXover)
            {
                foreach (string s in DoArticleCommand("XOVER " + firstArticleId + "-" + lastArticleId, 224))
                {
                    receiveLine(s);
                }
            }
        }
        /// <summary>
        /// Gets the abbreviated article headers.
        /// </summary>
        /// <param name="firstArticleId">The first article id.</param>
        /// <param name="lastArticleId">The last article id.</param>
        /// <param name="receiveLine">The receive line.</param>
        public void GetAbbreviatedArticleHeaders(int firstArticleId, int lastArticleId, ReceiveLine receiveLine)
        {
            if (!CurrentGroupSelected)
            {
                throw new NntpGroupNotSelectedException();
            }

            if (m_supportsXover)
            {
                foreach (string s in DoArticleCommand("XOVER " + firstArticleId + "-" + lastArticleId, 224))
                {
                    receiveLine(s);
                }
            }
        }
Example #7
0
        private void ReceiveLineList_Tapped(object sender, TappedRoutedEventArgs e)
        {
            ReceiveLine receiveLine = ReceiveLineList.SelectedItem as ReceiveLine;

            Frame.Navigate(typeof(ReceiveLineEditPage), receiveLine);
        }
 /// <summary>
 /// 引发收到一行事件
 /// </summary>
 internal void RaiseRecvLineEvent(string data)
 {
     ReceiveLine?.Invoke(data);
 }
Example #9
0
 public void AddDelegateOnDataReceived(ReceiveLine NewDelegate)
 {
     OnDataReceived += NewDelegate;
 }