コード例 #1
0
        public void AddColumnWithQuiet()
        {
            SectionRow.Quiet();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), "quiet");
        }
コード例 #2
0
        public void ApplyUnderlineToLastColumn()
        {
            SectionRow.Underline();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), "_Text_");
        }
コード例 #3
0
        public void ApplySubToLastColumn()
        {
            SectionRow.Sub();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"|Text|");
        }
コード例 #4
0
        public void ApplyStrongToLastColumn()
        {
            SectionRow.Strong();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"*Text*");
        }
コード例 #5
0
        public void ApplyRawToLastColumn()
        {
            SectionRow.Raw();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"!Text!");
        }
コード例 #6
0
        public void ApplyEmphasisToLastColumn()
        {
            SectionRow.Emphasis();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"\Text\");
        }
コード例 #7
0
        public void AddColumnWithSelected()
        {
            SectionRow.Selected();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), "selected");
        }
コード例 #8
0
        public void AddColumnWithWarn()
        {
            SectionRow.Warn();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), "warn");
        }
コード例 #9
0
        public void AddColumnWithLoading()
        {
            SectionRow.Loading();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), "loading");
        }
コード例 #10
0
        public void AddColumnWithInfo()
        {
            SectionRow.Info();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), "info");
        }
コード例 #11
0
        public void AddColumnWithFail()
        {
            SectionRow.Fail();
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), "fail");
        }
コード例 #12
0
ファイル: TabRowShould.cs プロジェクト: zanhaipeng/Glimpse
        public void AddColumnAndReturnsSelf()
        {
            var columnObject = new { };
            var row          = SectionRow.Column(columnObject);

            Assert.Equal(SectionRow, row);
            Assert.Equal(1, SectionRow.Columns.Count());
        }
コード例 #13
0
        public void AddColumnWithError()
        {
            SectionRow.Error();

            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), "error");
        }
コード例 #14
0
        public void ApplySubToLastColumnIf()
        {
            SectionRow.SubIf(false);
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"Text");

            SectionRow.SubIf(true);
            row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"|Text|");
        }
コード例 #15
0
        public void ApplyEmphasisToLastColumnIf()
        {
            SectionRow.EmphasisIf(false);
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"Text");

            SectionRow.EmphasisIf(true);
            row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"\Text\");
        }
コード例 #16
0
        public void AddColumnWithLodaingIf()
        {
            SectionRow.LoadingIf(false);
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"Text");

            SectionRow.LoadingIf(true);
            row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"loading");
        }
コード例 #17
0
        public void ApplyUnderlineToLastColumnIf()
        {
            SectionRow.UnderlineIf(false);
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"Text");

            SectionRow.UnderlineIf(true);
            row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"_Text_");
        }
コード例 #18
0
        public void AddColumnWithWarnIf()
        {
            SectionRow.WarnIf(false);
            var row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"Text");

            SectionRow.WarnIf(true);
            row = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(row.Last(), @"warn");
        }
コード例 #19
0
ファイル: TabRowShould.cs プロジェクト: zanhaipeng/Glimpse
        public void ReturnObjectArrayOfColumnData()
        {
            var columnObject1 = new { Id = "obj1" };
            var columnObject2 = new { Id = "obj2" };

            SectionRow.Column(columnObject1).Column(columnObject2);

            SectionRow.Build();
            var columnData = (IEnumerable <object>)SectionRow.Build();

            Assert.Equal(2, SectionRow.Columns.Count());
            Assert.Equal(columnObject1, columnData.ElementAt(0));
            Assert.Equal(columnObject2, columnData.ElementAt(1));
        }
コード例 #20
0
        public ActionResult Index(int?id, string errMessage = "",
                                  bool sectionOpen          = false, bool categoryOpen     = false, bool tagOpen     = false,
                                  bool sectionEditOpen      = false, bool categoryEditOpen = false, bool tagEditOpen = false, bool boardEditOpen = false, bool cardEditOpen = false)
        {
            BoardViewModel view = new BoardViewModel();
            string         user = User.Identity.GetUserId();

            if (db.Boards.Where(b => b.OwnerID == user).Count() > 0)
            {
                List <Board>     boards     = db.Boards.Where(b => b.OwnerID == user).ToList();
                List <MiniBoard> miniBoards = new List <MiniBoard>();
                foreach (var b in boards)
                {
                    MiniBoard m = new MiniBoard(b.ID, b.Title);
                    miniBoards.Add(m);
                }
                view.Boards = miniBoards;

                if (id == null)
                {
                    view.SelectedBoard = boards.FirstOrDefault();
                }
                else
                {
                    Board origBoard = db.Boards.Find(id);
                    if (origBoard == null)
                    {
                        return(HttpNotFound());
                    }
                    Board selectedBoard = boards.Where(b => b.ID == id).FirstOrDefault();
                    if (selectedBoard == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
                    }
                    view.SelectedBoard = selectedBoard;
                }

                SectionRow row = new SectionRow();
                view.SectionTable = row.getTable(view.SelectedBoard.Sections.ToList());
                foreach (var r in view.SectionTable)
                {
                    r.Row = r.Row.OrderBy(rr => rr.Order).ToList();
                }
                view.ActiveSections = row.getActiveSections(view.SelectedBoard.Sections.ToList(), view.SectionTable);
                List <Section> sections = view.SelectedBoard.Sections.OrderBy(s => s.ParentID).ThenBy(s => s.Order).ToList();
                view.SelectedBoard.Sections = sections;
                List <Card> cards = new List <Card>();
                foreach (var item in view.ActiveSections)
                {
                    cards.AddRange(item.Cards);
                    List <Card> orderCards = item.Cards.OrderBy(c => c.Order).ToList();
                    item.Cards = orderCards;
                }
                ViewBag.uncategorizedCards = cards.Count > 0 ? true : false;
            }

            ViewBag.sectionOpen      = sectionOpen;
            ViewBag.categoryOpen     = categoryOpen;
            ViewBag.tagOpen          = tagOpen;
            ViewBag.sectionEditOpen  = sectionEditOpen;
            ViewBag.categoryEditOpen = categoryEditOpen;
            ViewBag.tagEditOpen      = tagEditOpen;
            ViewBag.boardEditOpen    = boardEditOpen;
            ViewBag.cardEditOpen     = cardEditOpen;
            ViewBag.errorMessage     = errMessage;
            return(View(view));
        }
コード例 #21
0
ファイル: FileAwoisMdb.cs プロジェクト: slgrobotics/QuakeMap
        public override bool process(string url, string filename, string source)
        {
            bool ret = true;

            OleDbConnection con = null;

            LibSys.StatusBar.Trace("IP: processing MDB file: " + filename);

            try
            {
                con = new OleDbConnection(@"Provider=Microsoft.JET.OLEDB.4.0;data source=" + filename + "");
                con.Open(); //connection must be opened

                DataTable dt = con.GetSchema("Tables");

                DataRow row = dt.Select("TABLE_TYPE='TABLE'")[0];

                string tableName = row["TABLE_NAME"].ToString();

                OleDbCommand cmd = new OleDbCommand("SELECT * from [" + tableName + "]", con); // creating query command
                OleDbDataReader reader = cmd.ExecuteReader(); // executes query

                int i = 0;
                int errCnt = 0;
                while (reader.Read()) // if can read row from database
                {
                    try
                    {
                        SectionRow sr = new SectionRow()
                        {
                            RECRD = (int)reader.GetValue(0),
                            VESSLTERMS = reader.GetValue(1).ToString(),
                            CHART = reader.GetValue(2).ToString(),
                            AREA = reader.GetValue(3).ToString(),
                            CARTOCODE = reader.GetValue(4).ToString(),
                            SNDINGCODE = reader.GetValue(5).ToString(),
                            DEPTH = reader.GetValue(6).ToString(),
                            NATIVLAT = reader.GetValue(7).ToString(),
                            NATIVLON = reader.GetValue(8).ToString(),
                            LAT83 = reader.GetValue(9).ToString(),
                            LONG83 = reader.GetValue(10).ToString(),
                            LATDEC = (double)reader.GetValue(11),
                            LONDEC = -(double)reader.GetValue(12),
                            NATIVDATUM = reader.GetValue(13).ToString(),
                            CONVERT83 = reader.GetValue(14).ToString(),
                            GPACCURACY = reader.GetValue(15).ToString(),
                            GPQUALITY = reader.GetValue(16).ToString(),
                            GPSOURCE = reader.GetValue(17).ToString(),
                            QUADRANT = reader.GetValue(18).ToString(),
                            History = reader.GetValue(19).ToString(),
                            REFERENCE = reader.GetValue(20).ToString(),
                            YEARSUNK = reader.GetValue(21).ToString()
                        };

                        CreateInfo createInfo = new CreateInfo();	// we will recycle it in place, filling every time.

                        createInfo.init("wpt");
                        createInfo.name = (sr.VESSLTERMS + " " + sr.DEPTH).Trim();
                        createInfo.desc = sr.YEARSUNK;
                        createInfo.lat = sr.LATDEC;
                        createInfo.lng = sr.LONDEC;
                        createInfo.typeExtra = "unknown";	// type: ppl, school, park, locale, airport, reservoir, dam, civil, cemetery, valley, building
                        createInfo.source = source;
                        createInfo.comment = sr.History.Replace(". ", ".\r\n") + ";\r\n" + sr.REFERENCE;

                        m_insertWaypoint(createInfo);
                    }
                    catch (Exception excr)
                    {
                        errCnt++;
                    }

                    i++;
                }
                LibSys.StatusBar.Trace("OK: MDB file: '" + filename + "' processed; found table[" + tableName + "] records/waypoints count=" + i + "  errors count=" + errCnt);
            }
            catch (Exception e)
            {
                LibSys.StatusBar.Error("FileAwoisMdb process() " + e.Message);
                ret = false;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }

            return ret;
        }
コード例 #22
0
ファイル: FileAwoisMdb.cs プロジェクト: slgrobotics/QuakeMap
        public override bool process(string url, string filename, string source)
        {
            bool ret = true;

            OleDbConnection con = null;

            LibSys.StatusBar.Trace("IP: processing MDB file: " + filename);

            try
            {
                con = new OleDbConnection(@"Provider=Microsoft.JET.OLEDB.4.0;data source=" + filename + "");
                con.Open(); //connection must be opened

                DataTable dt = con.GetSchema("Tables");

                DataRow row = dt.Select("TABLE_TYPE='TABLE'")[0];

                string tableName = row["TABLE_NAME"].ToString();

                OleDbCommand    cmd    = new OleDbCommand("SELECT * from [" + tableName + "]", con); // creating query command
                OleDbDataReader reader = cmd.ExecuteReader();                                        // executes query

                int i      = 0;
                int errCnt = 0;
                while (reader.Read()) // if can read row from database
                {
                    try
                    {
                        SectionRow sr = new SectionRow()
                        {
                            RECRD      = (int)reader.GetValue(0),
                            VESSLTERMS = reader.GetValue(1).ToString(),
                            CHART      = reader.GetValue(2).ToString(),
                            AREA       = reader.GetValue(3).ToString(),
                            CARTOCODE  = reader.GetValue(4).ToString(),
                            SNDINGCODE = reader.GetValue(5).ToString(),
                            DEPTH      = reader.GetValue(6).ToString(),
                            NATIVLAT   = reader.GetValue(7).ToString(),
                            NATIVLON   = reader.GetValue(8).ToString(),
                            LAT83      = reader.GetValue(9).ToString(),
                            LONG83     = reader.GetValue(10).ToString(),
                            LATDEC     = (double)reader.GetValue(11),
                            LONDEC     = -(double)reader.GetValue(12),
                            NATIVDATUM = reader.GetValue(13).ToString(),
                            CONVERT83  = reader.GetValue(14).ToString(),
                            GPACCURACY = reader.GetValue(15).ToString(),
                            GPQUALITY  = reader.GetValue(16).ToString(),
                            GPSOURCE   = reader.GetValue(17).ToString(),
                            QUADRANT   = reader.GetValue(18).ToString(),
                            History    = reader.GetValue(19).ToString(),
                            REFERENCE  = reader.GetValue(20).ToString(),
                            YEARSUNK   = reader.GetValue(21).ToString()
                        };

                        CreateInfo createInfo = new CreateInfo();       // we will recycle it in place, filling every time.

                        createInfo.init("wpt");
                        createInfo.name      = (sr.VESSLTERMS + " " + sr.DEPTH).Trim();
                        createInfo.desc      = sr.YEARSUNK;
                        createInfo.lat       = sr.LATDEC;
                        createInfo.lng       = sr.LONDEC;
                        createInfo.typeExtra = "unknown";       // type: ppl, school, park, locale, airport, reservoir, dam, civil, cemetery, valley, building
                        createInfo.source    = source;
                        createInfo.comment   = sr.History.Replace(". ", ".\r\n") + ";\r\n" + sr.REFERENCE;

                        m_insertWaypoint(createInfo);
                    }
                    catch (Exception excr)
                    {
                        errCnt++;
                    }

                    i++;
                }
                LibSys.StatusBar.Trace("OK: MDB file: '" + filename + "' processed; found table[" + tableName + "] records/waypoints count=" + i + "  errors count=" + errCnt);
            }
            catch (Exception e)
            {
                LibSys.StatusBar.Error("FileAwoisMdb process() " + e.Message);
                ret = false;
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }

            return(ret);
        }
コード例 #23
0
ファイル: TabRowShould.cs プロジェクト: zanhaipeng/Glimpse
        public void AcceptNullValue()
        {
            object columnObject = null;

            SectionRow.Column(columnObject);
        }