コード例 #1
0
        public EditingRacuniViewModel(RacuniViewModel rvm)
        {
            Newrevroba       = new EditingRevRobaViewModel();
            Newrevroba.Datum = DateTime.Now;
            _original        = rvm;

            Editable       = new RacuniViewModel(null);
            Editable.Brev  = _original.Brev;
            Editable.Datum = _original.Datum;
            Editable.RevRobas.NoviRedReversa.Datum = DateTime.Now;
            Editable.Kupci = _original.Kupci;
            foreach (RevRobaViewModel rr in _original.RevRobas.Items)
            {
                var newRR = new RevRobaViewModel();
                newRR.RacuniID  = rr.RacuniID;
                newRR.Datum     = rr.Datum;
                newRR.Kolic     = rr.Kolic;
                newRR.RevRobaID = rr.RevRobaID;
                newRR.Roba      = rr.Roba;
                newRR.Utro      = rr.Utro;
                newRR.Cena      = rr.Cena;
                Editable.RevRobas.Items.Add(newRR);
            }

            var revrobaquery = from rr in _original.RevRobas.Items
                               group rr by rr.Roba into GRoba
                               select new EditingRevRobaViewModel {
                Roba = GRoba.Key, Kolic = GRoba.Sum(x => x.Kolic), Datum = GRoba.Min(t => t.Datum), Cena = GRoba.Average(x => x.Cena), Utro = Convert.ToInt32(GRoba.Min(t => t.Datum).Subtract(_original.Datum).TotalDays)
            };

            InvoiceLineSummary = new ObservableCollection <EditingRevRobaViewModel>(revrobaquery);
        }
コード例 #2
0
        private void AddInvoiceLine()
        {
            var rr = new EditingRevRobaViewModel
            {
                Roba  = Newrevroba.Roba,
                Kolic = Newrevroba.Kolic,
                Cena  = Newrevroba.Cena,
                Datum = Newrevroba.Datum
            };

            InvoiceLineSummary.Add(rr);
            Newrevroba.Clear();
        }