private void InsertButton_Click(object sender, EventArgs e)
        {
            FixtureDetails detail          = details[FixtureComboBox.SelectedIndex];
            int            DrainType       = 0;
            int            WaterSupplyType = 0;
            int            VentType        = 0;

            if (!DrainCheckBox.Checked)
            {
                DrainType = 0;
            }
            else
            {
                DrainType = DrainTypeComboBox.SelectedIndex + 1;
            }

            if (!VentCheckBox.Checked)
            {
                VentType = 0;
            }
            else
            {
                VentType = Vent
            }
        }
        private void FixtureComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            FixtureDetails df = details[FixtureComboBox.SelectedIndex];

            if (df.model.HWSFU != ConstantName.invalidNum)
            {
                HWCheckBox.Checked = true;
                HWFUTextBox.Text   = df.model.HWSFU.ToString();
                HWDiaTextBox.Text  = df.model.HW_DIA.ToString();
            }
            else
            {
                HWCheckBox.Checked = false;
                HWFUTextBox.Text   = "";
                HWDiaTextBox.Text  = "";
            }

            if (df.model.CWSFU != ConstantName.invalidNum)
            {
                CWCheckBox.Checked       = true;
                CWFUTextBox.Text         = df.model.CWSFU.ToString();
                ColdWaterDiaTextBox.Text = df.model.CW_DIA.ToString();
            }
            else
            {
                CWCheckBox.Checked       = false;
                CWFUTextBox.Text         = "";
                ColdWaterDiaTextBox.Text = "";
            }

            if (df.model.VENT_DIA != ConstantName.invalidNum)
            {
                VentCheckBox.Checked = true;
                ventDiaTextBox.Text  = df.model.VENT_DIA.ToString();
            }
            else
            {
                VentCheckBox.Checked = false;
                ventDiaTextBox.Text  = "";
            }

            if (df.model.DFU != ConstantName.invalidNum)
            {
                DrainCheckBox.Checked = true;
                DrainFUTextBox.Text   = df.model.DFU.ToString();
                drainDiaTextBox.Text  = df.model.WASTE_DIA.ToString();
            }
            else
            {
                DrainCheckBox.Checked = false;
                DrainFUTextBox.Text   = "";
                drainDiaTextBox.Text  = "";
            }
        }
Пример #3
0
        private void OnFixtureUpdate(IFixtureOverviewDelta fixture)
        {
            if (fixture == null)
            {
                return;
            }

            FixtureDetails details = new FixtureDetails {
                Id = fixture.Id
            };

            // ListenerOverview is not suitable to use here....
            // we have to get the FixtureOverview to have all data
            var overview = Supervisor.GetFixtureOverview(fixture.Id);

            FillFixtureOverview(details, overview);

            if (fixture.ListenerOverview != null)
            {
                details.IsDeleted = fixture.ListenerOverview.IsDeleted.GetValueOrDefault();
                details.IsOver    = fixture.ListenerOverview.IsOver.GetValueOrDefault();
            }

            if (fixture.FeedUpdate != null)
            {
                FixtureProcessingEntry entry = new FixtureProcessingEntry();
                FillProcessingEntry(entry, fixture.FeedUpdate);
                details.AddProcessingEntry(entry);
            }

            Supervisor.Service.StreamingService.OnFixtureUpdate(details);

            if (fixture.LastError != null && fixture.LastError.IsErrored)
            {
                ProcessingEntryError error = new ProcessingEntryError
                {
                    FixtureId          = fixture.Id,
                    FixtureDescription = overview.Name,
                    Sequence           = fixture.LastError.Sequence
                };

                FillProcessingEntryError(error, fixture.LastError);
                Supervisor.Service.StreamingService.OnError(error);
            }
        }
Пример #4
0
        /// <summary>
        /// Read Node File From Database, Fill Out The NODEDWG
        /// Path must be FULL PATH of a DWG from the database
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="path">Note PATH</param>
        public void ReadFromDatabase(SQLiteConnection connection, string pathDwg)
        {
            FixtureBoxSet.Clear();
            InsertPointSet.Clear();
            FixtureDetailSet.Clear();
            TableDataSet.Clear();

            string relPath = GoodiesPath.MakeRelativePath(pathDwg);

            file = DBDwgFile.SelectRow(connection, relPath);
            if (file == null || file.ID == ConstantName.invalidNum)
            {
                MessageBox.Show("NODEDWG -> ReadFromDatabase -> File Not Found");
                return;
            }
            foreach (FixtureBeingUsedAreaModel fixtureBox in DBFixtureBeingUsedArea.SelectRows(connection, file.ID))
            {
                FixtureBeingUsedArea fixtureArea = new FixtureBeingUsedArea(fixtureBox);
                //this line is very important. You have to make sure they have file model in each fixtureArea;
                //this won't complicate the program as we pass the pointer.
                FixtureBoxSet.Add(fixtureArea);
            }

            foreach (FixtureDetailsModel detailModel in DBFixtureDetails.SelectRows(connection, file.ID))
            {
                FixtureDetails fd = new FixtureDetails(detailModel);
                FixtureDetailSet.Add(fd);
            }

            foreach (InsertPointModel insertPointModel in DBInsertPoint.SelectRows(connection, file.ID))
            {
                InsertPoint ip = new InsertPoint(insertPointModel);
                InsertPointSet.Add(ip);
            }

            foreach (TableModel model in DBTable.SelectRows(connection, file.ID))
            {
                TableData table = new TableData(model);
                TableDataSet.Add(table);
            }
        }
Пример #5
0
        public IFixtureDetails GetFixtureDetail(string fixtureId)
        {
            if (string.IsNullOrEmpty(fixtureId))
            {
                return(null);
            }

            var overview = Supervisor.GetFixtureOverview(fixtureId);

            FixtureDetails details = new FixtureDetails();

            FillFixtureOverview(details, overview);

            foreach (var update in overview.GetFeedAudit())
            {
                FixtureProcessingEntry entry = new FixtureProcessingEntry();
                FillProcessingEntry(entry, update);
                details.AddProcessingEntry(entry);
            }

            return(details);
        }
Пример #6
0
        private static IFixtureDetails GenerateMockedFixtureOverview(string fixtureId)
        {
            var tmp = new FixtureDetails
            {
                Id            = fixtureId,
                IsStreaming   = true,
                State         = FixtureState.Ready,
                Competition   = "French Division 1",
                CompetitionId = "1qqqqqq",
                StartTime     = new DateTime(2014, 3, 17, 17, 0, 0),
                Description   = "PSG v Lion",
                IsOver        = false,
                IsDeleted     = false
            };

            tmp.AddProcessingEntry(new FixtureProcessingEntry {
                Sequence = "1", Epoch = "1", IsUpdate = false, State = FixtureProcessingState.PROCESSED, Timestamp = new DateTime(2013, 06, 11, 14, 33, 0)
            });
            tmp.AddProcessingEntry(new FixtureProcessingEntry {
                Sequence = "2", Epoch = "1", IsUpdate = true, State = FixtureProcessingState.PROCESSED, Timestamp = new DateTime(2013, 06, 11, 14, 34, 0), Exception = "Null pointer exception"
            });
            tmp.AddProcessingEntry(new FixtureProcessingEntry {
                Sequence = "2", Epoch = "1", IsUpdate = false, State = FixtureProcessingState.PROCESSED, Timestamp = new DateTime(2013, 06, 11, 14, 34, 30)
            });
            tmp.AddProcessingEntry(new FixtureProcessingEntry {
                Sequence = "3", Epoch = null, IsUpdate = true, State = FixtureProcessingState.SKIPPED, Timestamp = new DateTime(2013, 06, 11, 14, 35, 0)
            });
            tmp.AddProcessingEntry(new FixtureProcessingEntry {
                Sequence = "4", Epoch = null, IsUpdate = true, State = FixtureProcessingState.PROCESSED, Timestamp = new DateTime(2013, 06, 11, 14, 37, 0)
            });
            tmp.AddProcessingEntry(new FixtureProcessingEntry {
                Sequence = "5", Epoch = "2", IsUpdate = true, State = FixtureProcessingState.SKIPPED, Timestamp = new DateTime(2013, 06, 11, 14, 38, 45), EpochChangeReasons = new[] { 10 },
            });
            tmp.AddProcessingEntry(new FixtureProcessingEntry {
                Sequence = "5", Epoch = "2", IsUpdate = false, State = FixtureProcessingState.PROCESSING, Timestamp = new DateTime(2013, 06, 11, 14, 39, 0)
            });

            return(tmp);
        }
Пример #7
0
        public static void InsertFixtureUnit(FixtureDetails fd)
        {
            Goodies.AddBlockToActiveDrawing("C:\\Users\\dngo\\Desktop\\SAMPLES\\VERSION1.dwg", "FIX_26");


            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor   ed  = doc.Editor;

            Database db = doc.Database;

            BlockReference bref = null;
            Dictionary <ObjectId, ObjectId> blockToInsert = Goodies.InsertDynamicBlock("FIX_26", db, ref bref);

            using (doc.LockDocument())
            {
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    BlockTable       bt  = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
                    BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForRead);
                }
            }
        }
Пример #8
0
        private static NODEDWG GetData(Database db, SQLiteConnection connection)
        {
            NODEDWG note = new NODEDWG();

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable       bt  = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
                BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
                foreach (ObjectId id in btr)
                {
                    DBObject obj = tr.GetObject(id, OpenMode.ForRead);
                    if (obj is BlockReference)
                    {
                        BlockReference bref = (BlockReference)obj;
                        if (Goodies.IsBlockInTheDrawing(bref))
                        {
                            if (bref.IsDynamicBlock)
                            {
                                string brefName = Goodies.GetDynamicName(bref);
                                if (brefName.Equals(ConstantName.FixtureInformationArea))
                                {
                                    FixtureBeingUsedArea dbA = new FixtureBeingUsedArea(bref);
                                    if (dbA.model != null)
                                    {
                                        note.FixtureBoxSet.Add(dbA);
                                    }
                                }
                            }
                            else if (bref.Name == ConstantName.FixtureDetailsBox)
                            {
                                FixtureDetails FD = new FixtureDetails(bref, tr);
                                if (FD.model != null)
                                {
                                    note.FixtureDetailSet.Add(FD);
                                }
                            }
                            else if (bref.Name == ConstantName.InsertPoint)
                            {
                                InsertPoint IP = new InsertPoint(bref, tr);
                                if (IP.model != null)
                                {
                                    note.InsertPointSet.Add(IP);
                                }
                            }
                            else if (bref is Table)
                            {
                                TableData tb = new TableData(bref, tr, db);
                                if (tb.model != null)
                                {
                                    note.TableDataSet.Add(tb);
                                }
                            }
                        }
                    }
                }

                List <FixtureDetails> newFixs = new List <FixtureDetails>();

                foreach (FixtureBeingUsedArea fba in note.FixtureBoxSet)
                {
                    foreach (FixtureDetails fd in note.FixtureDetailSet)
                    {
                        if (fba.IsInsideTheBox(fd))
                        {
                            newFixs.Add(fd);
                        }
                    }
                }

                note.FixtureDetailSet.Clear();
                foreach (FixtureDetails fd in newFixs)
                {
                    note.FixtureDetailSet.Add(fd);
                }
            }

            //Write to Database

            string currentdwgPath = db.Filename;
            string dbPath         = GoodiesPath.GetDatabasePathFromDwgPath(currentdwgPath);

            if (string.IsNullOrEmpty(dbPath))
            {
                MessageBox.Show("Could Not Find Database.");
            }

            note.file = DBDwgFile.GetPNote(connection);
            note.file.modifieddate = GoodiesPath.GetModifiedOfFile(GoodiesPath.GetFullPathFromRelativePath(note.file.relativePath, connection)).Ticks;

            if (note.file == null)
            {
                MessageBox.Show($"Can't find this {currentdwgPath} in databse.");
                return(null);
            }
            foreach (FixtureBeingUsedArea fixtureBox in note.FixtureBoxSet)
            {
                fixtureBox.model.file = note.file;
            }

            foreach (FixtureDetails fd in note.FixtureDetailSet)
            {
                fd.model.file = note.file;
            }
            foreach (InsertPoint ip in note.InsertPointSet)
            {
                ip.model.file = note.file;
            }
            foreach (TableData table in note.TableDataSet)
            {
                table.model.file = note.file;
            }

            DBDwgFile.DeleteRow(connection, note.file.relativePath);

            note.WriteToDataBase(connection);

            return(note);
        }