public static void storeToTable(Session paramSession, License paramLicense) { validateTableAndFixTable(paramSession); EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray(); XStream xStream = new XStream(); foreach (LicenseRowItem licenseRowItem in paramLicense.RowItems) { ConcLicenseTable concLicenseTable = new ConcLicenseTable(); string str = xStream.toXML(licenseRowItem); concLicenseTable.HashKey = str; paramSession.save(concLicenseTable); } }
public static void validateTableAndFixTable(Session paramSession) { EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray(); System.Collections.IList list = paramSession.createQuery("from ConcLicenseTable").list(); XStream xStream = new XStream(); HashSet <object> hashSet1 = new HashSet <object>(); bool? @bool = true; Hashtable hashMap = new Hashtable(); HashSet <object> hashSet2 = new HashSet <object>(); foreach (ConcLicenseTable concLicenseTable in list) { LicenseRowItem licenseRowItem = (LicenseRowItem)xStream.fromXML(concLicenseTable.HashKey); if (hashMap.ContainsKey(licenseRowItem.Serial)) { @bool = false; hashSet2.Add(concLicenseTable.Id); hashSet2.Add(((ConcLicenseTable)hashMap[licenseRowItem.Serial]).Id); continue; } hashMap[licenseRowItem.Serial] = concLicenseTable; } if ([email protected]) { int?integer = Convert.ToInt32(hashSet2.Count); foreach (long?long in hashSet2) { ConcLicenseTable concLicenseTable = (ConcLicenseTable)paramSession.load(typeof(ConcLicenseTable), long); LicenseRowItem licenseRowItem = (LicenseRowItem)xStream.fromXML(concLicenseTable.HashKey); if (integer.Value > 1) { paramSession.delete(concLicenseTable); paramSession.flush(); } } } }