public bool addSubTable(ushort nIndex, SubTable st) { bool bResult = true; if (nIndex > m_nTables) { bResult = false; throw new ArgumentOutOfRangeException("Index is greater than number of tables."); } else if (null == st) { bResult = false; throw new ArgumentNullException(); } else if (!(st is SubTableFormat0)) //NOTE: We only support format0 { bResult = false; throw new ArgumentException("The SubTable variable needs to SubTableFormat0."); } m_SubTable.Insert(nIndex, st); m_nTables++; m_bDirty = true; return(bResult); }
public override int GetHashCode() { int hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this hashCode = hashCode * 23 + Id.GetHashCode(); hashCode = hashCode * 23 + (Fid == null ? 0 : Fid.GetHashCode()); hashCode = hashCode * 23 + (EnableDate == null ? 0 : EnableDate.GetHashCode()); hashCode = hashCode * 23 + (DisableDate == null ? 0 : DisableDate.GetHashCode()); hashCode = hashCode * 23 + Dr.GetHashCode(); hashCode = hashCode * 23 + Ts.GetHashCode(); hashCode = hashCode * 23 + (CreateBy == null ? 0 : CreateBy.GetHashCode()); hashCode = hashCode * 23 + (CreateDate == null ? 0 : CreateDate.GetHashCode()); hashCode = hashCode * 23 + (CreateName == null ? 0 : CreateName.GetHashCode()); hashCode = hashCode * 23 + (UpdateBy == null ? 0 : UpdateBy.GetHashCode()); hashCode = hashCode * 23 + (UpdateDate == null ? 0 : UpdateDate.GetHashCode()); hashCode = hashCode * 23 + (UpdateName == null ? 0 : UpdateName.GetHashCode()); hashCode = hashCode * 23 + (TableName == null ? 0 : TableName.GetHashCode()); hashCode = hashCode * 23 + (TableComment == null ? 0 : TableComment.GetHashCode()); hashCode = hashCode * 23 + (TableMode == null ? 0 : TableMode.GetHashCode()); hashCode = hashCode * 23 + (SubTable == null ? 0 : SubTable.GetHashCode()); hashCode = hashCode * 23 + IsTree.GetHashCode(); hashCode = hashCode * 23 + IsPagination.GetHashCode(); hashCode = hashCode * 23 + IsSync.GetHashCode(); return(hashCode); }
public void PrepareData() { // Load all the sub tables CropsGrown = new SubTable("Grain Crops Grown", this); CropSpecs = new SubTable("Grain Crop Specifications", this); ForagesGrown = new SubTable("Forage Crops Grown", this); ForageSpecs = new SubTable("Forage Crop Specifications", this); LandSpecs = new SubTable("Land specifications", this); LabourSupply = new SubTable("Labour supply/hire", this); RumNumbers = new SubTable("Startup ruminant numbers", this); RumAges = new SubTable("Startup ruminant ages", this); RumWeights = new SubTable("Startup ruminant weights", this); RumCoeffs = new SubTable("Ruminant coefficients", this); RumSpecs = new SubTable("Ruminant specifications", this); RumPrices = new SubTable("Ruminant prices", this); Overheads = new SubTable("Overheads", this); Fodder = new SubTable("Bought fodder", this); FodderSpecs = new SubTable("Bought fodder specs", this); // Find climate data (assumed to exist in specific cell) Climate = GetCellValue(Part, 4, 6); // Find total land area TotalArea = LandSpecs.GetColData <double>(0).Sum(); // Set values SetGrains(); SetRuminants(); Pools = new Dictionary <int, string>(); GetGrownFodderPools(); GetBoughtFodderPools(); }
public SubTable getSubTable(ushort nIndex) { if (nIndex >= m_nTables) { throw new ArgumentOutOfRangeException("Index is greater than number of tables."); } SubTable st = (SubTable)m_SubTable[nIndex]; return(st); }
public SubTable ObrotyWgOkresu(FromTo okres) { if (Kontrahent == null) { return(null); } // Obroty towaru w okresie dla kontrahenta SubTable obrotyst = Magazyny.MagazynyModule.GetInstance(Kontrahent).Obroty.WgRozchodKontrahent[Kontrahent]; if (okres != FromTo.All && okres != FromTo.Empty) { obrotyst = obrotyst[new FieldCondition.Contain("Data", okres)]; } return(obrotyst); }
ArrayList m_SubTable; // SubTableFormat0[] since we only support format 0 public kern_cache(Table_kern OwnerTable) { m_version = OwnerTable.version; m_nTables = 0; ushort nTablesTemp = OwnerTable.nTables; m_SubTable = new ArrayList(m_nTables); for (ushort i = 0; i < nTablesTemp; i++) { SubTable SubTableTemp = OwnerTable.GetSubTable(i); //NOTE: Since these subtables could be Format 2 and we don't support them we will strip them out if (null != SubTableTemp && 0 == SubTableTemp.GetFormat()) { m_SubTable.Add(SubTableTemp); m_nTables++; } } }
public SubTable GetSubTable(uint i) { SubTable st = null; SubTableHeader sth = GetSubTableHeader(i); if (sth != null) { if (sth.GetFormat() == 0) { uint offsetSubTable = GetSubTableHeaderOffset(i); st = new SubTableFormat0(offsetSubTable, m_bufTable); } else if (sth.GetFormat() == 2) { } } return(st); }
public void GenerujRozliczenie() { KasaModule kasaModule = KasaModule.GetInstance(Session); foreach (var kontrahent in Kontrahenci) { Wplata wpłata = null; Naleznosc należność = null; SubTable st = kasaModule.RozrachunkiIdx.WgPodmiot[kontrahent, Date.MaxValue]; foreach (RozrachunekIdx idx in st) { if (idx.Typ == TypRozrachunku.Wpłata && wpłata == null) { wpłata = (Wplata)idx.Dokument; } if (idx.Typ == TypRozrachunku.Należność && należność == null && !idx.Dokument.Bufor) { należność = (Naleznosc)idx.Dokument; } if (wpłata != null && należność != null) { break; } } if (wpłata == null || należność == null) { throw new InvalidOperationException(string.Format("Nieznalezione wpłata lub należność dla kontrahenta {0}", kontrahent.Nazwa)); } using (ITransaction t = Session.Logout(true)) { RozliczenieSP rozliczenie = new RozliczenieSP(należność, wpłata); kasaModule.RozliczeniaSP.AddRow(rozliczenie); t.Commit(); } } }
// GET: SubsidencePointer public async Task <IActionResult> Index(FormFields form) { SetViewBags(form.sortOrder); var data = from m in _context.SubsidencePoint select m; switch (form.sortOrder) { case "region": data = data.OrderBy(o => o.Region); break; case "region_desc": data = data.OrderByDescending(o => o.Region); break; case "city": data = data.OrderBy(o => o.City); break; case "city_desc": data = data.OrderByDescending(o => o.City); break; case "team": data = data.OrderBy(o => o.TeamNumber); break; case "team_desc": data = data.OrderByDescending(o => o.TeamNumber); break; case "station": data = data.OrderBy(o => o.StationNumber); break; case "station_desc": data = data.OrderByDescending(o => o.StationNumber); break; case "date": data = data.OrderBy(o => o.DateAndTime); break; case "date_desc": data = data.OrderByDescending(o => o.DateAndTime); break; case "coord": data = data.OrderBy(o => o.Coordinates); break; case "coord_desc": data = data.OrderByDescending(o => o.Coordinates); break; case "fault": data = data.OrderBy(o => o.Fault); break; case "fault_desc": data = data.OrderByDescending(o => o.Fault); break; case "type": data = data.OrderBy(o => o.DataType); break; case "type_desc": data = data.OrderByDescending(o => o.DataType); break; case "strike": data = data.OrderBy(o => o.Strike); break; case "strike_desc": data = data.OrderByDescending(o => o.Strike); break; case "throw": data = data.OrderBy(o => o.Throw); break; case "throw_desc": data = data.OrderByDescending(o => o.Throw); break; case "slip": data = data.OrderBy(o => o.Slip); break; case "slip_desc": data = data.OrderByDescending(o => o.Slip); break; case "angle": data = data.OrderBy(o => o.Angle); break; case "angle_desc": data = data.OrderByDescending(o => o.Angle); break; case "country_desc": data = data.OrderByDescending(o => o.Country); break; case "country": data = data.OrderBy(o => o.Country); break; default: data = data.OrderBy(o => o.Country); break; } int pageSize = 5; int pageNumber = (form.page ?? 1); if (!string.IsNullOrEmpty(form.country)) { data = data.Where(x => x.Country.Equals(form.country)); } if (!string.IsNullOrEmpty(form.region)) { data = data.Where(x => x.Region.Equals(form.region)); } if (!string.IsNullOrEmpty(form.city)) { data = data.Where(x => x.City.Equals(form.city)); } if (!string.IsNullOrEmpty(form.teamno)) { data = data.Where(x => x.TeamNumber.Equals(form.teamno)); } if (!string.IsNullOrEmpty(form.fault)) { data = data.Where(x => x.Fault.Equals(form.fault)); } if (!string.IsNullOrEmpty(form.type)) { data = data.Where(x => x.DataType.Equals(form.type)); } if (form.startdate.CompareTo(form.enddate) < 0) { data = data.Where(x => (x.DateAndTime > form.startdate) && (x.DateAndTime < form.enddate)); } if (form.strikelow < form.strikehigh) { data = data.Where(x => (x.Strike > form.strikelow) && (x.Strike < form.strikehigh)); } if (form.thwlow < form.thwhigh) { data = data.Where(x => (x.Throw > form.thwlow) && (x.Throw < form.thwhigh)); } if (form.sliplow < form.sliphigh) { data = data.Where(x => (x.Slip > form.sliplow) && (x.Slip < form.sliphigh)); } if (form.anglelow < form.anglehigh) { data = data.Where(x => (x.Angle > form.anglelow) && (x.Angle < form.anglehigh)); } var count = data.Count(); data = data.Skip(pageSize * (pageNumber - 1)).Take(pageSize); var model = new SubTable { Page = pageNumber, Size = count, NumPages = (((count % 5) == 0) ? (count / 5) : ((count / 5) + 1)), Table = await data.ToListAsync(), Filter = form }; return(View(model)); }
/************************ * public methods */ public bool Validate(Validator v, OTFontVal fontOwner) { bool bRet = true; if (v.PerformTest(T.kern_TableVersion)) { if (version == 0) { v.Pass(T.kern_TableVersion, P.kern_P_TableVersion, m_tag); } else { v.Error(T.kern_TableVersion, E.kern_E_TableVersion, m_tag, "version = " + version.ToString() + ", unrecognized version #, no further tests can be performed"); return(false); } } if (v.PerformTest(T.kern_NumSubtables)) { if (nTables != 0) { v.Pass(T.kern_NumSubtables, P.kern_P_NumSubTables, m_tag, nTables.ToString()); } else { v.Error(T.kern_NumSubtables, E.kern_E_NumSubTables, m_tag); bRet = false; } } if (v.PerformTest(T.kern_SubtableFormats)) { bool bFormatsOk = true; for (uint i = 0; i < nTables; i++) { SubTableHeader sth = GetSubTableHeader(i); if (sth != null) { if (sth.GetFormat() != 0 && sth.GetFormat() != 2) { v.Error(T.kern_SubtableFormats, E.kern_E_SubtableFormats, m_tag, "subtable #" + i + ", format " + sth.GetFormat()); bFormatsOk = false; bRet = false; } } else { v.Error(T.kern_SubtableFormats, E.kern_E_SubTableExtendsPastEOT, m_tag, "subtable #" + i); bFormatsOk = false; bRet = false; break; } } if (bFormatsOk) { v.Pass(T.kern_SubtableFormats, P.kern_P_SubtableFormats, m_tag); } } if (!bRet) { v.Warning(T.kern_SubtableFormats, W._TEST_W_OtherErrorsInTable, m_tag, "kern table appears to be corrupt. No further tests will be performed."); return(bRet); } if (v.PerformTest(T.kern_SubtableLength)) { bool bLengthsOk = true; for (uint i = 0; i < nTables; i++) { SubTable st = this.GetSubTable(i); if (st.length != st.CalculatedLength()) { v.Error(T.kern_SubtableLength, E.kern_E_SubtableLength, m_tag, "subtable #" + i + ", length = " + st.length + ", calculated length = " + st.CalculatedLength()); bLengthsOk = false; bRet = false; } } if (bLengthsOk) { v.Pass(T.kern_SubtableLength, P.kern_P_SubtableLengths, m_tag); } } if (v.PerformTest(T.kern_CoverageReservedBits)) { bool bReservedOk = true; for (uint i = 0; i < nTables; i++) { SubTable st = this.GetSubTable(i); if ((st.coverage & 0xf0) != 0) { bReservedOk = false; v.Error(T.kern_CoverageReservedBits, E.kern_E_ReservedCoverageBits, m_tag, "subtable #" + i); bRet = false; break; } } if (bReservedOk) { v.Pass(T.kern_CoverageReservedBits, P.kern_P_ReservedCoverageBits, m_tag); } } if (v.PerformTest(T.kern_Format0_SearchFields)) { bool bBinaryFieldsOk = true; for (uint i = 0; i < nTables; i++) { SubTable st = this.GetSubTable(i); if (st.version == 0) { SubTableFormat0 stf0 = (SubTableFormat0)st; ushort nPairs = stf0.nPairs; ushort sizeofEntry = 6; if (nPairs != 0) { ushort CalculatedSearchRange = (ushort)(util.MaxPower2LE(nPairs) * sizeofEntry); ushort CalculatedEntrySelector = util.Log2(util.MaxPower2LE(nPairs)); ushort CalculatedRangeShift = (ushort)((nPairs - util.MaxPower2LE(nPairs)) * sizeofEntry); if (stf0.searchRange != CalculatedSearchRange) { string s = "subtable #" + i + ", calc = " + CalculatedSearchRange + ", actual = " + stf0.searchRange; v.Error(T.kern_Format0_SearchFields, E.kern_E_Format0_searchRange, m_tag, s); bBinaryFieldsOk = false; bRet = false; } if (stf0.entrySelector != CalculatedEntrySelector) { string s = "subtable #" + i + ", calc = " + CalculatedEntrySelector + ", actual = " + stf0.entrySelector; v.Error(T.kern_Format0_SearchFields, E.kern_E_Format0_entrySelector, m_tag, s); bBinaryFieldsOk = false; bRet = false; } if (stf0.rangeShift != CalculatedRangeShift) { string s = "subtable #" + i + ", calc = " + CalculatedRangeShift + ", actual = " + stf0.rangeShift; v.Error(T.kern_Format0_SearchFields, E.kern_E_Format0_rangeShift, m_tag, s); bBinaryFieldsOk = false; bRet = false; } } else { // cannot validate fields since they are undefined when nPairs is zero v.Warning(T.kern_Format0_SearchFields, W.kern_W_Format0_SearchFields, m_tag, "subtable #" + i + ", nPairs = " + stf0.nPairs); bBinaryFieldsOk = false; } } } if (bBinaryFieldsOk) { v.Pass(T.kern_Format0_SearchFields, P.kern_P_Format0_SearchFields, m_tag); } } if (v.PerformTest(T.kern_Format0_GlyphIDs)) { for (uint i = 0; i < nTables; i++) { SubTable st = this.GetSubTable(i); if (st.version == 0) { bool bGlyphIDsOk = true; SubTableFormat0 stf0 = (SubTableFormat0)st; for (int iPair = 0; iPair < stf0.nPairs; iPair++) { ushort left = 0, right = 0; short kernvalue = 0; stf0.GetKerningPairAndValue(iPair, ref left, ref right, ref kernvalue); ushort numGlyphs = fontOwner.GetMaxpNumGlyphs(); if (left >= numGlyphs) { v.Error(T.kern_Format0_GlyphIDs, E.kern_E_Format0_GlyphIDs, m_tag, "kern pair[" + iPair + "]: left = " + left); bGlyphIDsOk = false; bRet = false; } if (right >= numGlyphs) { v.Error(T.kern_Format0_GlyphIDs, E.kern_E_Format0_GlyphIDs, m_tag, "kern pair[" + iPair + "]: right = " + right); bGlyphIDsOk = false; bRet = false; } } if (bGlyphIDsOk) { v.Pass(T.kern_Format0_GlyphIDs, P.kern_P_Format0_GlyphIDs, m_tag); } } } } if (v.PerformTest(T.kern_Format0_Values)) { for (uint i = 0; i < nTables; i++) { SubTable st = this.GetSubTable(i); if (st.version == 0) { SubTableFormat0 stf0 = (SubTableFormat0)st; Table_hmtx hmtxTable = (Table_hmtx)fontOwner.GetTable("hmtx"); if (hmtxTable != null) { bool bValuesOk = true; for (int iPair = 0; iPair < stf0.nPairs; iPair++) { ushort left = 0, right = 0; short kernvalue = 0; stf0.GetKerningPairAndValue(iPair, ref left, ref right, ref kernvalue); short absKernValue = Math.Abs(kernvalue); Table_hmtx.longHorMetric lhmLeft = null; Table_hmtx.longHorMetric lhmRight = null; try { lhmLeft = hmtxTable.GetOrMakeHMetric(left, fontOwner); lhmRight = hmtxTable.GetOrMakeHMetric(right, fontOwner); } catch (Exception e) { v.ApplicationError(T.kern_Format0_Values, E._Table_E_Exception, m_tag, "GetOrMakeHMetric:" + e.Message); bValuesOk = false; bRet = false; break; } if (lhmLeft == null || lhmRight == null) { v.ApplicationError(T.kern_Format0_Values, E._Table_E_Exception, m_tag, "hmtx Left or Right null"); bValuesOk = false; bRet = false; break; } if (absKernValue > lhmLeft.advanceWidth && absKernValue > lhmRight.advanceWidth) { v.Error(T.kern_Format0_Values, E.kern_E_Format0_Values, m_tag, "kern pair[" + iPair + "]: left id = " + left + ", right id = " + right + ", value = " + kernvalue); bValuesOk = false; bRet = false; } } if (bValuesOk) { v.Pass(T.kern_Format0_Values, P.kern_P_Format0_Values, m_tag); } } } } } if (v.PerformTest("kern_Format0_IDsInCmap")) { for (uint i = 0; i < nTables; i++) { SubTable st = this.GetSubTable(i); if (st.version == 0) { SubTableFormat0 stf0 = (SubTableFormat0)st; Table_cmap cmapTable = (Table_cmap)fontOwner.GetTable("cmap"); if (cmapTable != null) { Table_cmap.Subtable cmapSubtable = cmapTable.GetSubtable(3, 10); if (cmapSubtable == null) { cmapSubtable = cmapTable.GetSubtable(3, 1); } if (cmapSubtable == null) { Table_cmap.EncodingTableEntry ete = cmapTable.GetEncodingTableEntry(0); cmapSubtable = cmapTable.GetSubtable(ete); } if (cmapSubtable != null) { uint [] map = cmapSubtable.GetMap(); bool bAllIDsInCmap = true; for (int iPair = 0; iPair < stf0.nPairs; iPair++) { ushort left = 0, right = 0; short kernvalue = 0; stf0.GetKerningPairAndValue(iPair, ref left, ref right, ref kernvalue); bool bFoundLeft = false; bool bFoundRight = false; for (int j = 0; j < map.Length; j++) { if (left == map[j]) { bFoundLeft = true; break; } } for (int j = 0; j < map.Length; j++) { if (right == map[j]) { bFoundRight = true; break; } } if (bFoundLeft == false) { v.Error(T.kern_Format0_IDsInCmap, E.kern_E_Format0_GlyphIdInCmap, m_tag, "kern pair[" + iPair + "]: left id = " + left); bAllIDsInCmap = false; bRet = false; } if (bFoundRight == false) { v.Error(T.kern_Format0_IDsInCmap, E.kern_E_Format0_GlyphIdInCmap, m_tag, "kern pair[" + iPair + "]: right id = " + right); bAllIDsInCmap = false; bRet = false; } } if (bAllIDsInCmap) { v.Pass(T.kern_Format0_IDsInCmap, P.kern_P_Format0_GlyphIdInCmap, m_tag); } } } } } } return(bRet); }
public bool addSubTable( ushort nIndex, SubTable st ) { bool bResult = true; if( nIndex > m_nTables ) { bResult = false; throw new ArgumentOutOfRangeException( "Index is greater than number of tables." ); } else if( null == st ) { bResult = false; throw new ArgumentNullException(); } else if( !(st is SubTableFormat0 )) //NOTE: We only support format0 { bResult = false; throw new ArgumentException( "The SubTable variable needs to SubTableFormat0." ); } m_SubTable.Insert( nIndex, st ); m_nTables++; m_bDirty = true; return bResult; }
/// <summary> /// 把 table 从 startRow 到 endRow 之间的数据,都转换为一个 TEntity 并返回。 /// </summary> /// <param name="entityType">Type of the entity.</param> /// <param name="table">The table.</param> /// <param name="startRow">The start row.</param> /// <param name="endRow">The end row.</param> /// <param name="relationLoader">The relation loader.</param> /// <returns></returns> private static Entity CreateEntity(Type entityType, IDataTable table, int startRow, int endRow, Action<Entity, IDataTable> relationLoader) { //新的TEntity var repo = RepositoryFactoryHost.Factory.FindByEntity(entityType); var entity = RdbDataProvider.Get(repo).SQLColumnsGenerator.ReadDataDirectly(table[startRow]); if (entity == null) { throw new InvalidProgramException("id不为空,对象也不应该为空。"); } var childTable = new SubTable(table, startRow, endRow); if (relationLoader != null) { relationLoader(entity, childTable); } return entity; }