private void carToolbarComRecDelete_Click(object sender, RoutedEventArgs e)
        {
            int     _idcar = Convert.ToInt32(txtId.Text);
            dtoCars _car   = ocar.Find(x => x.id.Equals(_idcar));

            ocar.Remove(_car);
            CollectionViewSource masterviewsource = (CollectionViewSource)this.FindResource("MasterView");

            masterviewsource.SortDescriptions.Add(new System.ComponentModel.SortDescription("stationid", System.ComponentModel.ListSortDirection.Ascending));
            masterviewsource.Source = ocar;
            mainGrid.DataContext    = masterviewsource;
        }
        private void carToolbarComRecNew_Click(object sender, RoutedEventArgs e)
        {
            dtoCars _car = new dtoCars();
            int     rid  = 1000 + ocar.Count();

            _car.id = rid;
            ocar.Add(_car);
            CollectionViewSource masterviewsource = (CollectionViewSource)this.FindResource("MasterView");

            masterviewsource.Source = ocar;
            masterviewsource.SortDescriptions.Add(new System.ComponentModel.SortDescription("id", System.ComponentModel.ListSortDirection.Ascending));
            masterviewsource.View.MoveCurrentToFirst();
        }
Exemple #3
0
        public List <dtoCars> LoadCarsFromCouch()
        {
            List <dtoCars> lcar = new List <dtoCars>();

            var server   = new CouchServer(host, port);
            var cdb      = server.GetDatabase("dbsendill_newcars");
            var tempView = cdb.NewTempView("dbsendill_cars", "dbsendill_cars", "if (doc.docType && doc.docType == 'car') emit(doc.carnumber, doc);");
            var linqCars = tempView.LinqQuery <jcar>();
            var mycar    = from c in linqCars
                           select c;

            foreach (var par in mycar)
            {
                dtoCars jc = new dtoCars();
                jc.id             = par.id;
                jc.stationid      = par.stationid;
                jc.carnumber      = par.carnumber;
                jc.code           = par.code;
                jc.listed         = par.listed;
                jc.carname        = par.carname;
                jc.car1           = par.car1;
                jc.car2           = par.car2;
                jc.car3           = par.car3;
                jc.car4           = par.car4;
                jc.car5           = par.car5;
                jc.car6           = par.car6;
                jc.car7           = par.car7;
                jc.car8           = par.car8;
                jc.car9           = par.car9;
                jc.car10          = par.car10;
                jc.length         = par.length;
                jc.backdoorheight = par.backdoorheight;
                jc.backdoorlength = par.backdoorlength;
                jc.sidedoorheight = par.sidedoorheight;
                jc.sidedoorlength = par.sidedoorlength;
                jc.weightlimit    = par.weightlimit;
                jc.liftsize       = par.liftsize;
                jc.volume         = par.volume;
                jc.width          = par.width;
                jc.model          = par.model;
                jc.maxcarry       = par.maxcarry;
                jc.owner          = par.owner;
                jc.kt             = par.kt;
                jc.address        = par.address;
                jc.town           = par.town;
                jc.postcode       = par.postcode;
                jc.phone          = par.phone;
                jc.mobile         = par.mobile;
                jc.driver         = par.driver;
                jc.dkt            = par.dkt;
                jc.daddress       = par.daddress;
                jc.dtown          = par.town;
                jc.postcode       = par.postcode;
                jc.dphone         = par.dphone;
                jc.dmobile        = par.dmobile;
                jc.heightofbox    = par.heightofbox;
                jc.isdel          = par.isdel;
                jc.size           = par.size;
                lcar.Add(jc);
            }
            return(lcar);
            //var tempView = cdb.NewTempView("test", "test", "if (doc.docType && doc.docType == 'car') emit(doc.Hps, doc);");
            //var linqCars = tempView.LinqQuery<Car>();
        }