Exemple #1
0
        public TableAdjustment EditPhoneCall(LatticeData <PhoneHistory, PhoneHistoryRow> latticeData, PhoneHistoryRow phoneCallRow)
        {
            PhoneHistory phoneCall = null;

            if (phoneCallRow.Id == 0)
            {
                phoneCall = new PhoneHistory();
                _context.PhoneHistories.Add(phoneCall);
            }
            else
            {
                phoneCall = _context.PhoneHistories.FirstOrDefault(history => history.Id == phoneCallRow.Id);
            }

            phoneCall.PhoneNumberId = phoneCallRow.PhoneNumberId;
            phoneCall.PhoneDate     = phoneCallRow.PhoneDate;
            phoneCall.Duration      = phoneCallRow.Duration;
            phoneCall.Caller        = phoneCallRow.Caller;
            phoneCall.CallerCity    = phoneCallRow.CallerCity;
            phoneCall.Callee        = phoneCallRow.Callee;
            phoneCall.CalleeCity    = phoneCallRow.CalleeCity;
            _context.SaveChanges();

            phoneCallRow.Id = phoneCall.Id;

            phoneCallRow.PhoneNumber = _context.PhoneNumbers
                                       .Where(number => number.Id == phoneCallRow.PhoneNumberId).Select(number => number.Number)
                                       .FirstOrDefault();

            return(latticeData.Adjust(wrapper => wrapper
                                      .Update(phoneCallRow)
//                .Message(LatticeMessage.AtsUser("success", "Editing", "Person saved!"))
                                      ));
        }
Exemple #2
0
        public TableAdjustment EditStaton(LatticeData <Station, Station> latticeData, Station stationRow)
        {
            Station station = _context.Stations
                              .FirstOrDefault(x => x.StationId == stationRow.StationId);

            if (station == null)
            {
                station = new Station()
                {
                    StationId = stationRow.StationId
                };
                _context.Stations.Add(station);
            }

            try
            {
                station.StationName = stationRow.StationName;
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing", $"Save exception: {e.Message}"))
                                          ));
            }

            stationRow.StationId = station.StationId;
            return(latticeData.Adjust(x => x
                                      .UpdateRow(stationRow)
                                      .Message(LatticeMessage.User("success", "Editing", "Station saved"))
                                      ));
        }
Exemple #3
0
        private TableAdjustment EditOrCreate(LatticeData <TodoListEntry, TodoListEntry> latticeData)
        {
            var           data         = GetData();
            var           confirmation = latticeData.CommandConfirmation <TodoListEntryCreateEditViewModel>();
            TodoListEntry entry        = null;

            if (confirmation.Id == null)
            {
                entry = new TodoListEntry()
                {
                    Date = DateTime.Now,
                    Icon = confirmation.Icon,
                    Id   = Guid.NewGuid(),
                    Text = confirmation.Text
                };

                data.Add(entry);
                return(latticeData.Adjust(x => x
                                          .UpdateSource(entry)
                                          .Message(LatticeMessage.User("success", "Created", "New ToDo entry created"))));
            }

            entry      = data.FirstOrDefault(c => c.Id == confirmation.Id);
            entry.Date = DateTime.Now;
            entry.Text = confirmation.Text;
            entry.Icon = confirmation.Icon;
            return(latticeData.Adjust(x => x
                                      .UpdateSource(entry)
                                      .Message(LatticeMessage.User("success", "Updated", "ToDo entry updated"))));
        }
Exemple #4
0
        private void CreateLatticeData()
        {
            LatticeData l = new LatticeData(1);

            l.Layout.ToolPosition = 60;
            l.Rows                   = 10;
            l.Columns                = 10;
            l.Layout.RepeatX         = 10;
            l.Layout.RepeatY         = 10;
            l.Layout.Width           = 30;
            l.Layout.Height          = 30;
            l.Layout.Clip            = true;
            l.Layout.ClipRange.Start = 50;
            l.Layout.ClipRange.End   = 200;
            l.PropertyChanged       += l_PropertyChanged;
            l.Add(new Line2D(0, 0, 5, 0));
            l.Add(new Line2D(0, 5, 5, 5));
            l.Add(new Line2D(0, 0, 0, 5));
            l.Add(new Line2D(5, 0, 5, 5));
            l.Add(new Line2D(0, 0, 5, 5));
            l.Add(new Line2D(5, 0, 0, 5));
            l.LineChanged += l_LineChanged;
            l.LineRemoved += l_LineChanged;
            LatticePatterns.Add(l);
        }
Exemple #5
0
        public TableAdjustment EditAts(LatticeData <Ats, AtsRow> latticeData, AtsRow atsRow)
        {
            Ats currentATS = null;

            if (atsRow.Id == 0)
            {
                currentATS = new Ats();
                _context.AtsStations.Add(currentATS);
            }
            else
            {
                currentATS = _context.AtsStations.FirstOrDefault(ats => ats.Id == atsRow.Id);
            }

            currentATS.CityAtsAttributesId          = atsRow.CityAtsAttributesId;
            currentATS.DepartmentalAtsAttributesId  = atsRow.DepartmentalAtsAttributesId;
            currentATS.InstitutionalAtsAttributesId = atsRow.InstitutionalAtsAttributesId;
            currentATS.AtsType = atsRow.AtsType;

            _context.SaveChanges();

            atsRow.Id = currentATS.Id;

            return(latticeData.Adjust(wrapper => wrapper
                                      .Update(atsRow)
//                .Message(LatticeMessage.AtsUser("success", "Editing", "Person saved!"))
                                      ));
        }
Exemple #6
0
        public TableAdjustment EditTrains(LatticeData <Train, Train> latticeData, Train trainRow)
        {
            Train train = _context.Trains
                          .FirstOrDefault(x => x.TrainId == trainRow.TrainId);

            if (train == null)
            {
                train = new Train()
                {
                    TrainId = trainRow.TrainId
                };
                _context.Trains.Add(train);
            }

            try
            {
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing", $"Save exception: {e.Message}"))
                                          ));
            }

            trainRow.TrainId = train.TrainId;
            return(latticeData.Adjust(x => x
                                      .UpdateRow(trainRow)
                                      .Message(LatticeMessage.User("success", "Editing", "Train saved"))
                                      ));
        }
Exemple #7
0
        public TableAdjustment EditRoute(LatticeData <Route, Route> latticeData, Route routeRow)
        {
            Route route = _context.Routes.FirstOrDefault(x => x.RouteId == routeRow.RouteId);

            if (route == null)
            {
                route = new Route()
                {
                    RouteId = routeRow.RouteId
                };
                _context.Routes.Add(route);
            }
            else
            {
                route = _context.Routes
                        .FirstOrDefault(x => x.RouteId == routeRow.RouteId);
            }

            try
            {
                route.RouteName = routeRow.RouteName;
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing", $"Save exception: {e.Message}"))
                                          ));
            }
            routeRow.RouteId = route.RouteId;
            return(latticeData.Adjust(x => x
                                      .UpdateRow(routeRow)
                                      .Message(LatticeMessage.User("success", "Editing", "Route saved"))
                                      ));
        }
        public TableAdjustment EditQueue(LatticeData <PhoneInstallationQueue, PhoneInstallationQueueRow> latticeData, PhoneInstallationQueueRow queueRow)
        {
            PhoneInstallationQueue currentQueue = null;

            if (queueRow.Id == 0)
            {
                currentQueue = new PhoneInstallationQueue();
                _context.PhoneInstallationQueues.Add(currentQueue);
            }
            else
            {
                currentQueue = _context.PhoneInstallationQueues.FirstOrDefault(x => x.Id == queueRow.Id);
            }

            currentQueue.AtsUserId = queueRow.UserId;
            _context.SaveChanges();

            queueRow.Id = currentQueue.Id;

            queueRow.UserName = _context.AtsUsers
                                .Where(user => user.Id == queueRow.UserId)
                                .Select(user => user.Person.Name)
                                .FirstOrDefault();

            queueRow.UserSurname = _context.AtsUsers
                                   .Where(user => user.Id == queueRow.UserId)
                                   .Select(user => user.Person.Surname)
                                   .FirstOrDefault();

            return(latticeData.Adjust(x => x
                                      .Update(queueRow)
//                .Message(LatticeMessage.AtsUser("success", "Editing", "Person saved!"))
                                      ));
        }
Exemple #9
0
        public TableAdjustment EditPerson(LatticeData <UserAccounting, UserAccountingRow> latticeData, UserAccountingRow userBillRow)
        {
            UserAccounting currentUserBill = null;

            if (userBillRow.Id == 0)
            {
                currentUserBill = new UserAccounting();
                _context.UserAccountings.Add(currentUserBill);
            }
            else
            {
                currentUserBill = _context.UserAccountings.FirstOrDefault(x => x.Id == userBillRow.Id);
            }

            currentUserBill.AtsUserId = userBillRow.UserId;
            currentUserBill.Total     = userBillRow.Total;
            _context.SaveChanges();

            userBillRow.Id = currentUserBill.Id;

            userBillRow.UserName = _context.AtsUsers
                                   .Where(user => user.Id == userBillRow.UserId)
                                   .Select(user => user.Person.Name)
                                   .FirstOrDefault();

            userBillRow.UserSurname = _context.AtsUsers
                                      .Where(user => user.Id == userBillRow.UserId)
                                      .Select(user => user.Person.Surname)
                                      .FirstOrDefault();

            return(latticeData.Adjust(x => x
                                      .Update(userBillRow)
//                .Message(LatticeMessage.AtsUser("success", "Editing", "Person saved!"))
                                      ));
        }
Exemple #10
0
        public TableAdjustment EditAddress(LatticeData <Address, AddressRow> latticeData, AddressRow addressRow)
        {
            Address currentAddress = null;

            if (addressRow.Id == 0)
            {
                currentAddress = new Address();
                _context.Addresses.Add(currentAddress);
            }
            else
            {
                currentAddress = _context.Addresses.FirstOrDefault(address => address.Id == addressRow.Id);
            }

            currentAddress.FlatNumber  = addressRow.FlatNumber;
            currentAddress.HouseNumber = addressRow.HouseNumber;
            currentAddress.Index       = addressRow.Index;
            currentAddress.Locality    = addressRow.Locality;
            currentAddress.Street      = addressRow.Street;
            _context.SaveChanges();

            addressRow.Id = currentAddress.Id;

            return(latticeData.Adjust(wrapper => wrapper
                                      .Update(addressRow)
//                .Message(LatticeMessage.AtsUser("success", "Editing", "Person saved!"))
                                      ));
        }
//        public TableAdjustment UpdateRow(LatticeData<Person, PersonRow> latticeData)
//        {
//            return latticeData.Adjust(x => x.Build());
//        }

        public TableAdjustment EditPerson(LatticeData <Person, PersonRow> latticeData, PersonRow personRow)
        {
            Person currentPerson = null;

            if (personRow.Id == 0)
            {
                currentPerson = new Person();
                _context.Persons.Add(currentPerson);
            }
            else
            {
                currentPerson = _context.Persons.FirstOrDefault(x => x.Id == personRow.Id);
            }

            currentPerson.Age        = personRow.Age;
            currentPerson.Gender     = personRow.Gender;
            currentPerson.Name       = personRow.Name;
            currentPerson.Surname    = personRow.Surname;
            currentPerson.Middlename = personRow.Middlename;
            _context.SaveChanges();

            personRow.Id = currentPerson.Id;

            return(latticeData.Adjust(x => x
                                      .Update(personRow)
//                .Message(LatticeMessage.AtsUser("success", "Editing", "Person saved!"))
                                      ));
        }
Exemple #12
0
        public TableAdjustment EditTrainsStaffMember(LatticeData <Employee, EmployeeRow> latticeData,
                                                     EmployeeRow employeeRow)
        {
            if (string.IsNullOrEmpty(employeeRow.UserId))
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing", "Can not create create new employee from here"))
                                          ));
            }

            Employee employee = _context.Employees
                                .FirstOrDefault(x => x.UserId == employeeRow.UserId);

            if (employee == null)
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing", "Can not find employee"))
                                          ));
            }


            employee.TrainId = employeeRow.TrainId;
            _context.SaveChanges();
            return(latticeData.Adjust(x => x
                                      .Update(employeeRow)
                                      .Message(LatticeMessage.User("success", "Editing", "Employee saved"))
                                      ));
        }
        public void Run(LatticeData data)
        {
            List<Tile> tiles = new List<Tile>();

            foreach (var grid in data.Duplicates)
            {
                foreach (var tile in grid.Tiles)
                {
                    Trace.TraceInformation("Checking for " + tile.FullPath);
                    if (!Directory.Exists(tile.FullPath))
                    {
                        tiles.Add(tile);

                        if (tile.Group != null)
                        {
                            // TODO This should generate an event that causes a remove event in the AcqMonitor that checks if it removes from lattice (similar to add tile event in AcquisitionMonitor).
                            tile.Group.RemoveTile(tile);
                        } else
                        {
                            Trace.TraceWarning("Duplicate tile entry is missing container.");
                        }
                    }
                }
            }

            // TODO remove per above.
            if (tiles.Count > 0)
            {
                data.RemoveTiles(tiles);
            }
        }
Exemple #14
0
        public ToolPath CreateToolPath(PathData pd, double inc)
        {
            ToolPath    tp;
            LatticeData l = pd as LatticeData;

            tp = new ToolPath(); //.BarrelOutline((int)(1 / inc)));
            return(tp);
        }
Exemple #15
0
        public CharactorData(char charactor, int pointSize, int color, LatticeData shapeData)
        {
            this._charactor = charactor;

            this.ShapeData = shapeData;
            this.PointSize = pointSize;
            this.Color     = color;
        }
Exemple #16
0
        public ShapeCollection CreatePaths(PathData p, double increment)
        {
            ShapeCollection pc = new ShapeCollection();

            if (p == null || !(p is LatticeData))
            {
                return(pc);
            }
            ld = p as LatticeData;

            rowHeight = ld.Layout.Height / (ld.Rows - 1);
            colWidth  = ld.Layout.Width / (ld.Columns - 1);
            //Shape s = MkPath(0, 0, increment);
            //if (s != null)
            //    pc.AddShape(s);
            if ((ld.Layout.RepeatX == 0) && (ld.Layout.RepeatY == 0))
            {
                pc.AddShape(MkPath(0, 0, increment));
            }
            else if ((ld.Layout.RepeatX == 0) && (ld.Layout.RepeatY > 0))
            {
                for (int indy = -ld.Layout.RepeatY; indy < ld.Layout.RepeatY; indy++)
                {
                    Shape s = MkPath(0, indy, increment);
                    if (s != null)
                    {
                        pc.AddShape(s);
                    }
                }
            }
            else if ((ld.Layout.RepeatX > 0) && (ld.Layout.RepeatY == 0))
            {
                for (int indx = -ld.Layout.RepeatX; indx < ld.Layout.RepeatX; indx++)
                {
                    Shape s = MkPath(indx, 0, increment);
                    if (s != null)
                    {
                        pc.AddShape(s);
                    }
                }
            }
            else
            {
                for (int indy = -ld.Layout.RepeatY; indy < ld.Layout.RepeatY; indy++)
                {
                    for (int indx = -ld.Layout.RepeatX; indx < ld.Layout.RepeatX; indx++)
                    {
                        Shape s = MkPath(indx, indy, increment);
                        if (s != null)
                        {
                            pc.AddShape(s);
                        }
                    }
                }
            }
            return(pc);
        }
Exemple #17
0
        private void Remove_Line_Click(object sender, RoutedEventArgs e)
        {
            LatticeData ld = (viewModel.CurrentPathData as LatticeData);

            if (ld == null)
            {
                return;
            }
            ld.Remove((Line2D)LatticeLineList.SelectedItem);
        }
Exemple #18
0
 public ViewModel()
 {
     NeedsInitialising  = true;
     LastBazleyPattern  = new BazelyChuck();
     LastRossPattern    = new RossData();
     LastWheelsPattern  = new WheelsData();
     LastBarrelPattern  = new Barrel();
     LastLatticePattern = new LatticeData();
     LastBraidPattern   = new BraidData();
 }
Exemple #19
0
        public TableAdjustment EditRoutePoint(LatticeData <RoutePoint, RoutePointRow> latticeData,
                                              RoutePointRow routePointRow, int routeId)
        {
            RoutePoint routePoint;

            if (routePointRow.RouteId == 0)
            {
                routePoint = new RoutePoint
                {
                    RouteId      = routeId,
                    StationOrder = _context.RoutePoints.Where(x => x.RouteId == routeId)
                                   .Select(x => x.StationOrder)
                                   .DefaultIfEmpty(0)
                                   .Max() + 1
                };
                _context.RoutePoints.Add(routePoint);
            }
            else
            {
                routePoint = _context.RoutePoints
                             .FirstOrDefault(x => x.RouteId == routePointRow.RouteId &&
                                             x.StationOrder == routePointRow.StationOrder);
            }

            Station station = _context.Stations.FirstOrDefault(x => x.StationName == routePointRow.StationName);

            if (station == null)
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing",
                                                                       $"There is no station with name {routePointRow.StationName}"))
                                          ));
            }


            if (_context.RoutePoints.Any(x => x.RouteId == routeId &&
                                         x.StationOrder != routePoint.StationOrder &&
                                         x.Station.StationId == station.StationId))
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing",
                                                                       $"The route already has station {station.StationName}"))
                                          ));
            }

            routePoint.Station = station;


            _context.SaveChanges();
            return(latticeData.Adjust(x => x
                                      .Update(routePoint)
                                      .Message(LatticeMessage.User("success", "Editing", "Route saved"))
                                      ));
        }
Exemple #20
0
        public TableAdjustment RemoveRole(LatticeData <Employee, EmployeeRow> latticeData)
        {
            var comandModel = latticeData.CommandConfirmation <TargetRoleCommandViewModel>();
            var subj        = latticeData.CommandSubject();
            var employee    = _context.Employees.FirstOrDefault(x => x.UserId == subj.UserId);

            _userManager.RemoveFromRole(employee.UserId, comandModel.TargetRole);
            return(latticeData.Adjust(x => x
                                      .Message(LatticeMessage.User("success", "Remove", "Role was removed"))
                                      ));
        }
Exemple #21
0
        public TableAdjustment RemoveTrip(LatticeData <Trip, TripRow> latticeData)
        {
            var subj = latticeData.CommandSubject();
            var trip = _context.Trips.FirstOrDefault(x => x.TripId == subj.TripId);

            _context.Trips.Remove(trip);
            _context.SaveChanges();
            return(latticeData.Adjust(x => x
                                      .Remove(subj)
                                      .Message(LatticeMessage.User("success", "Remove", "Trip removed"))
                                      ));
        }
Exemple #22
0
        private void Add_Line_Click(object sender, RoutedEventArgs e)
        {
            LatticeData ld = (viewModel.CurrentPathData as LatticeData);

            if (ld == null)
            {
                return;
            }
            Line2D l = new Line2D(new Point(0, 0), new Point(ld.Columns - 1, ld.Rows - 1));

            ld.Add(l);
        }
Exemple #23
0
        public TableAdjustment RemoveRoute(LatticeData <Route, RouteRow> latticeData)
        {
            var subj  = latticeData.CommandSubject();
            var route = _context.Routes.FirstOrDefault(x => x.RouteId == subj.RouteId);

            _context.Routes.Remove(route);
            _context.SaveChanges();
            return(latticeData.Adjust(x => x
                                      .Remove(subj)
                                      .Message(LatticeMessage.User("success", "Remove", "Route removed"))
                                      ));
        }
Exemple #24
0
        public TableAdjustment RemoveStation(LatticeData <Station, Station> latticeData)
        {
            var subj    = latticeData.CommandSubject();
            var station = _context.Stations.FirstOrDefault(x => x.StationId == subj.StationId);

            _context.Stations.Remove(station);
            _context.SaveChanges();
            return(latticeData.Adjust(x => x
                                      .RemoveExact(subj)
                                      .Message(LatticeMessage.User("success", "Remove", "Station removed"))
                                      ));
        }
Exemple #25
0
        public TableAdjustment RemoveTripPoint(LatticeData <TripPoint, TripPoint> latticeData)
        {
            var subj      = latticeData.CommandSubject();
            var tripPoint = _context.TripPoints
                            .FirstOrDefault(x => x.TripId == subj.TripId && x.StationOrder == subj.StationOrder);

            _context.TripPoints.Remove(tripPoint);
            _context.SaveChanges();
            return(latticeData.Adjust(x => x
                                      .RemoveExact(subj)
                                      .Message(LatticeMessage.User("success", "Remove", "RoutePoint removed"))
                                      ));
        }
Exemple #26
0
        public TableAdjustment RemoveEmployee(LatticeData <Employee, EmployeeRow> latticeData)
        {
            var subj     = latticeData.CommandSubject();
            var employee = _context.Employees.FirstOrDefault(x => x.UserId == subj.UserId);

            _userManager.Delete(employee.ApplicationUser);
            //_context.Employees.Remove(employee); удаляеться из за зависимости от usera
            // _context.SaveChanges();
            return(latticeData.Adjust(x => x
                                      .Remove(subj)
                                      .Message(LatticeMessage.User("success", "Remove", "Employee removed"))
                                      ));
        }
Exemple #27
0
        public ShapeCollection CreatePaths(PathData p, double increment)
        {
            ShapeCollection pc = new ShapeCollection();

            if (p == null || !(p is LatticeData))
            {
                return(pc);
            }
            ld          = p as LatticeData;
            repeatAngle = 360.0 / ld.Layout.RepeatX;
            colAngle    = (repeatAngle - ld.Layout.Margin) / (ld.Columns - 1);

            rowHeight = ld.Layout.Height / (ld.Rows - 1);
            colWidth  = ld.Layout.Width / (ld.Columns - 1);
            origin    = new Point(ld.Layout.ToolPosition, 0);

            if ((ld.Layout.RepeatX == 0) && (ld.Layout.RepeatY == 0))
            {
                pc.AddShape(MkPath(0, 0, increment));
            }
            else if ((ld.Layout.RepeatX == 0) && (ld.Layout.RepeatY > 0))
            {
                for (int indy = -ld.Layout.RepeatY; indy < ld.Layout.RepeatY; indy++)
                {
                    pc.AddShape(MkPath(0, indy, increment));
                }
            }
            else if ((ld.Layout.RepeatX > 0) && (ld.Layout.RepeatY == 0))
            {
                for (int indx = -ld.Layout.RepeatX; indx < ld.Layout.RepeatX; indx++)
                {
                    pc.AddShape(MkPath(indx, 0, increment));
                }
            }
            else
            {
                for (int indy = -ld.Layout.RepeatY; indy < ld.Layout.RepeatY; indy++)
                {
                    for (int indx = -ld.Layout.RepeatX; indx < ld.Layout.RepeatX; indx++)
                    {
                        pc.AddShape(MkPath(indx, indy, increment));
                    }
                }
            }

            //for (int indx = 0; indx < ld.Layout.RepeatX; indx++)
            //{
            //    pc.AddShape(MkPath(indx,increment));
            //}
            return(pc);
        }
Exemple #28
0
        public TableAdjustment RemoveSelected(LatticeData <CityAtsAttributes, CityATSAttributesRow> latticeData)
        {
            var selectedRows          = latticeData.Selection().ToArray();
            var selectedAttributesIds = selectedRows.Select(x => x.Id);

            var ids = string.Join(",", selectedAttributesIds);

            _context.Database.ExecuteSqlCommand($"DELETE FROM CityAtsAttributes WHERE Id IN ({ids})");

            return(latticeData.Adjust(x => x
                                      .Remove(selectedRows)
//                .Message(LatticeMessage.AtsUser("success", "Remove", $"{selectedRows.Length} orders removed!"))
                                      ));
        }
Exemple #29
0
        public TableAdjustment RemoveSelected(LatticeData <Address, AddressRow> latticeData)
        {
            var selectedRows       = latticeData.Selection().ToArray();
            var selectedAddressIds = selectedRows.Select(row => row.Id);

            var ids = string.Join(",", selectedAddressIds);

            _context.Database.ExecuteSqlCommand($"DELETE FROM Addresses WHERE Id IN ({ids})");

            return(latticeData.Adjust(wrapper => wrapper
                                      .Remove(selectedRows)
//                .Message(LatticeMessage.AtsUser("success", "Remove", $"{selectedRows.Length} orders removed!"))
                                      ));
        }
Exemple #30
0
 private void PatternChoices_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (PatternChoices.SelectedValue != null)
     {
         LatticeData bc = (LatticeData)PatternChoices.SelectedValue;
         viewModel.CurrentPathData = bc;
         LatticeDisplay.Lattice    = bc;
         if (Bigdisplay.IsOpen)
         {
             PopupDisplay.Lattice = bc;
         }
         ReCalculate();
     }
 }
Exemple #31
0
        public TableAdjustment Remove(LatticeData <CityAtsAttributes, CityATSAttributesRow> latticeData)
        {
            var confirmationData = latticeData.CommandConfirmation <RemovalConfirmationViewModel>();

            var subj = latticeData.CommandSubject();
            var cityATSAttributes = _context.CityAtsAttributes.FirstOrDefault(x => x.Id == subj.Id);

            _context.CityAtsAttributes.Remove(cityATSAttributes);
            _context.SaveChanges();

            return(latticeData.Adjust(x => x
                                      .Remove(subj)
//                .Message(LatticeMessage.AtsUser("success", "Remove", $"Order removed because of {confirmationData.Cause}"))
                                      ));
        }
        public AcquisitionMonitor()
        {
            Location = "";
            Status = MonitorStatus.Idle;
            ExpectedChannelCount = 2;
            Days = new List<TileDay>();
            Lattice = new LatticeData();
            Lattice.PropertyChanged += (sender, eventArgs) =>
            {
                OnPropertyChanged(eventArgs);
            };

            ZIndexZValueMap = new Dictionary<int, double>();

            Lattice.DuplicateCollectionChanged += (s, e) =>
            {
                TileChangedMonitorContext ctx = new TileChangedMonitorContext(null, TileStateChangeAction.Duplicate);
                ctx.MonitorId = Id;
                RaiseTileDataChanged(new TileChangedEventArgs(ctx));
            };
        }
        public void TestDuplicateGrouping()
        {
            string relativePath1 = @"2016-06-28\00";
            string relativePath2 = @"2016-07-29\01";

            LatticeData data = new LatticeData();

            data.AddTile(CreateTile(relativePath1, @"\00003", 20, 20, 20));
            data.AddTile(CreateTile(relativePath1, @"\00004", 21, 20, 20));
            data.AddTile(CreateTile(relativePath1, @"\00005", 22, 20, 20));

            data.AddTile(CreateTile(relativePath2, @"\00112", 20, 20, 20));
            data.AddTile(CreateTile(relativePath2, @"\00113", 21, 20, 20));
            data.AddTile(CreateTile(relativePath2, @"\00114", 22, 20, 20));
            data.AddTile(CreateTile(relativePath2, @"\00115", 23, 20, 20));

            data.AddTile(CreateTile(relativePath2, @"\00123", 21, 20, 20));
            data.AddTile(CreateTile(relativePath2, @"\00124", 22, 20, 20));
            data.AddTile(CreateTile(relativePath2, @"\00125", 23, 20, 20));

            var dg = data.DuplicatesAsRanges;
        }