public void AddColumnWithQuiet() { SectionRow.Quiet(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), "quiet"); }
public void ApplyUnderlineToLastColumn() { SectionRow.Underline(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), "_Text_"); }
public void ApplySubToLastColumn() { SectionRow.Sub(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), @"|Text|"); }
public void ApplyStrongToLastColumn() { SectionRow.Strong(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), @"*Text*"); }
public void ApplyRawToLastColumn() { SectionRow.Raw(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), @"!Text!"); }
public void ApplyEmphasisToLastColumn() { SectionRow.Emphasis(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), @"\Text\"); }
public void AddColumnWithSelected() { SectionRow.Selected(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), "selected"); }
public void AddColumnWithWarn() { SectionRow.Warn(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), "warn"); }
public void AddColumnWithLoading() { SectionRow.Loading(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), "loading"); }
public void AddColumnWithInfo() { SectionRow.Info(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), "info"); }
public void AddColumnWithFail() { SectionRow.Fail(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), "fail"); }
public void AddColumnAndReturnsSelf() { var columnObject = new { }; var row = SectionRow.Column(columnObject); Assert.Equal(SectionRow, row); Assert.Equal(1, SectionRow.Columns.Count()); }
public void AddColumnWithError() { SectionRow.Error(); var row = (IEnumerable <object>)SectionRow.Build(); Assert.Equal(row.Last(), "error"); }
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|"); }
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\"); }
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"); }
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_"); }
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"); }
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)); }
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)); }
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; }
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); }
public void AcceptNullValue() { object columnObject = null; SectionRow.Column(columnObject); }