public void Parse_SalesOrderDetail(string dbPath, int pageID) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("SalesOrderID"), RawType.Int("SalesOrderDetailID"), RawType.SmallInt("OrderQty"), RawType.Int("ProductID"), RawType.Money("UnitPrice"), RawType.Money("UnitPriceDiscount"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(8, ((Dictionary <string, object>)result).Count); Assert.AreEqual(71774, result.SalesOrderID); Assert.AreEqual(110562, result.SalesOrderDetailID); Assert.AreEqual(1, result.OrderQty); Assert.AreEqual(836, result.ProductID); Assert.AreEqual(356.898, result.UnitPrice); Assert.AreEqual(0.00, result.UnitPriceDiscount); Assert.AreEqual(new Guid("e3a1994c-7a68-4ce8-96a3-77fdd3bbd730"), result.rowguid); Assert.AreEqual(Convert.ToDateTime("2004-06-01"), result.ModifiedDate); }
public void Parse_Address(string dbPath, int pageID) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("AddressID"), RawType.NVarchar("AddressLine1"), RawType.NVarchar("AddressLine2"), RawType.NVarchar("City"), RawType.NVarchar("StateProvince"), RawType.NVarchar("CountryRegion"), RawType.NVarchar("PostalCode"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(9, ((Dictionary <string, object>)result).Count); Assert.AreEqual(9, result.AddressID); Assert.AreEqual("8713 Yosemite Ct.", result.AddressLine1); Assert.AreEqual(null, result.AddressLine2); Assert.AreEqual("Bothell", result.City); Assert.AreEqual("Washington", result.StateProvince); Assert.AreEqual("United States", result.CountryRegion); Assert.AreEqual("98011", result.PostalCode); Assert.AreEqual(new Guid("268af621-76d7-4c78-9441-144fd139821a"), result.rowguid); Assert.AreEqual(new DateTime(2002, 07, 01), result.ModifiedDate); }
private void deleteTypeButton_Click(object sender, EventArgs e) { try { DataGridViewRow row = dataGridViewType.SelectedRows[0]; DialogResult dr = MessageBox.Show("Вы действительно хотите удалить запись?", "Удаление", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dr == DialogResult.OK) { RawType rawType = new RawType(dataGridViewRaw.CurrentRow.Cells[0].Value.ToString(), Convert.ToInt32(dataGridViewType.CurrentRow.Cells[0].Value)); controller.deleteTypeButtonClick(rawType); dataGridViewType.DataSource = DAO.getInstance().selectTableNote(RawType.NameTable, RawType.RawIdAttr, Convert.ToString(rawType.RawId)); dataGridViewType.ClearSelection(); addSubtypeButton.BackColor = Color.LightGray; deleteSubtypeButton.BackColor = Color.LightGray; dataGridViewSubtype.DataSource = null; } } catch (System.ArgumentOutOfRangeException) { MessageBox.Show("Выберите тип!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Data.SqlClient.SqlException) { MessageBox.Show("Невозможно удалить запись! Она используется в других таблицах!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception) { MessageBox.Show("Ошибка работы с базой данных!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LeafLevelNonclusteredWithNullBitmapAndVariableLength2012_B() { var rawBytes = TestHelper.GetBytesFromByteString(@" 36947500 00020000 01004200 6a006500 73007300 69006500 30004000 61006400 76006500 6e007400 75007200 65002d00 77006f00 72006b00 73002e00 63006f00 6d00 " ); var record = new RawIndexRecord(new ArrayDelimiter <byte>(rawBytes), 5, 0); Assert.AreEqual(4, record.FixedLengthData.Count); Assert.AreEqual(true, record.HasNullBitmap); Assert.AreEqual(true, record.HasVariableLengthColumns); Assert.AreEqual(2, record.NullBitmapColumnCount); Assert.IsNull(record.ChildPageID); Assert.IsNull(record.ChildFileID); dynamic row = RawColumnParser.Parse(record, new IRawType[] { RawType.NVarchar("EmailAddress"), RawType.Int("CustomerID") }); Assert.AreEqual("*****@*****.**", row.EmailAddress); Assert.AreEqual(30100, row.CustomerID); }
private void addTypeButton_Click(object sender, EventArgs e) { RawType rawType = new RawType(dataGridViewRaw.CurrentRow.Cells[0].Value.ToString()); controller.addTypeButtonClick("Тип:", rawType); dataGridViewType.DataSource = DAO.getInstance().selectTableNote(RawType.NameTable, RawType.RawIdAttr, Convert.ToString(rawType.RawId)); dataGridViewType.ClearSelection(); }
protected PrimitiveType(Type rawType) : base(rawType) { if (typeof(IDisposable).GetTypeInfo().IsAssignableFrom(RawType.GetTypeInfo())) { throw new ArgumentException("A " + nameof(PrimitiveType) + " cannot have a disposable " + nameof(RawType), nameof(rawType)); } }
public async void SetData(RawType raw) { var sprite = await AssetsController.LoadAsset <Sprite>(_iconUtil.GetRawIcon(raw)); var rawCountKey = LocalisationKeys.RawKeys[raw]; var rawCount = _controllersResolver.GetStoreByType(ItemType.Raw).GetItem(rawCountKey).GetCount(); SetIcon(sprite); SetCount(rawCount); }
public RawReader(string fileName) { if (!File.Exists(fileName)) { throw new FileNotFoundException("The file doesn't exist!", fileName); } bool handled = true; string name = Path.GetFileNameWithoutExtension(fileName); switch (name.ToUpperInvariant()) { case "UNITDATA": _type = RawType.UnitData; break; case "SKILLS": _type = RawType.SkillData; break; case "AFFIXES": _type = RawType.AffixData; break; case "MISSILES": _type = RawType.MissileData; break; case "ROOMPIECES": _type = RawType.RoomPieceData; break; case "TRIGGERABLES": _type = RawType.TriggerableData; break; case "UI": _type = RawType.UserInterfaceData; break; default: handled = false; break; } if (!handled) { if (name.StartsWith("UNITDATA")) { _type = RawType.UnitData; handled = true; } else { throw new RawReaderException(String.Format("That type of raw file [{0}] is not supported.\r\nNote: for custom UNITDATA files, name has to start with 'UNITDATA'.", name)); } } _filename = fileName; byte[] data = File.ReadAllBytes(fileName); SetupStream(data); }
public void Parse_SalesOrderHeader(string dbPath, int pageID, int customerID) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("SalesOrderID"), RawType.TinyInt("RevisionNumber"), RawType.DateTime("OrderDate"), RawType.DateTime("DueDate"), RawType.DateTime("ShipDate"), RawType.TinyInt("Status"), RawType.Bit("OnlineOrderFlag"), RawType.NVarchar("PurchaseOrderNumber"), RawType.NVarchar("AccountNumber"), RawType.Int("CustomerID"), RawType.Int("ShipToAddressID"), RawType.Int("BillToAddressID"), RawType.NVarchar("ShipMethod"), RawType.Varchar("CreditCardApprovalCode"), RawType.Money("SubTotal"), RawType.Money("TaxAmt"), RawType.Money("Freight"), RawType.NVarchar("Comment"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(20, ((Dictionary <string, object>)result).Count); Assert.AreEqual(71774, result.SalesOrderID); Assert.AreEqual(1, result.RevisionNumber); Assert.AreEqual(Convert.ToDateTime("2004-06-01"), result.OrderDate); Assert.AreEqual(Convert.ToDateTime("2004-06-13"), result.DueDate); Assert.AreEqual(Convert.ToDateTime("2004-06-08"), result.ShipDate); Assert.AreEqual(5, result.Status); Assert.AreEqual(false, result.OnlineOrderFlag); Assert.AreEqual("PO348186287", result.PurchaseOrderNumber); Assert.AreEqual("10-4020-000609", result.AccountNumber); Assert.AreEqual(customerID, result.CustomerID); Assert.AreEqual(1092, result.ShipToAddressID); Assert.AreEqual(1092, result.BillToAddressID); Assert.AreEqual("CARGO TRANSPORT 5", result.ShipMethod); Assert.AreEqual(null, result.CreditCardApprovalCode); Assert.AreEqual(880.3484, result.SubTotal); Assert.AreEqual(70.4279, result.TaxAmt); Assert.AreEqual(22.0087, result.Freight); Assert.AreEqual(null, result.Comment); Assert.AreEqual(new Guid("89e42cdc-8506-48a2-b89b-eb3e64e3554e"), result.rowguid); Assert.AreEqual(Convert.ToDateTime("2004-06-08"), result.ModifiedDate); }
static ConstrainedPropertyViewModel() { Type t = typeof(T); if (t.Name != "Nullable`1") { return; } // We could do a dynamicmethod here for call speed, but it's probably not needed. RawType = t.GetGenericArguments()[0]; Comparer = RawType.GetMethod("CompareTo", new[] { RawType }); NullableConverter = new NullableConverter(t); }
private List <OutputSetting> GetOutputListForRaw(RawType raw) { if (raw == RawType.FSGame) { return(_outputFSGames); } else if (raw == RawType.Raw) { return(_outputRaws); } else { throw new ArgumentException("raw"); } }
public RawBase(ref byte[] Content) { if (IsCR3(Content)) { _rawType = RawType.CR3; this._content = Content; crxheader = new CRXHeader(ref Content); } else { _rawType = RawType.Tiff; this._content = Content; _header = new TiffHeader(ref Content); } }
public List <OutputSetting> GetSecondaryOutputs(RawType raw) { List <OutputSetting> outputs = GetOutputListForRaw(raw); List <OutputSetting> finalList = new List <OutputSetting>(outputs.Count); foreach (OutputSetting cur in outputs) { if (cur.UseAlways) { finalList.Add(cur); } } return(finalList); }
public OutputSetting GetPrimaryOutput(RawType raw) { List <OutputSetting> outputs = GetOutputListForRaw(raw); // search in outputs, which has defined TargetPlatform and TargetConfiguration foreach (OutputSetting cur in outputs) { if (cur.TargetPlatform == TargetPlatform && cur.TargetConfiguration == TargetConfiguration) { return(cur); } } // search in outputs, which has defined TargetPlatform foreach (OutputSetting cur in outputs) { if (cur.TargetPlatform == TargetPlatform && cur.TargetConfiguration == TargetConfiguration.None) { return(cur); } } // search in outputs, which has defined TargetConfiguration foreach (OutputSetting cur in outputs) { if (cur.TargetPlatform == TargetPlatform.None && cur.TargetConfiguration == TargetConfiguration) { return(cur); } } // get first output without any conditions foreach (OutputSetting cur in outputs) { if (cur.TargetPlatform == TargetPlatform.None && cur.TargetConfiguration == TargetConfiguration.None) { return(cur); } } return(null); }
public void CompileAssemblySFs(RawType raw, bool compareDate) { List <ScriptFile> processFiles = CompileAssemblySFs_GetFiles(raw, compareDate); int errorsCount = 0; int warningsCount = 0; CompileAssemblySFs_ReadSC(processFiles, ref errorsCount, ref warningsCount); CompileAssemblySFs_CheckSC(processFiles, ref errorsCount, ref warningsCount); foreach (ScriptFile sf in processFiles) { CompileAssemblySF_Compile(sf); } CompileAssemblySF_Finish(raw); }
public void Parse_Product(string dbPath, int pageID) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("ProductID"), RawType.NVarchar("Name"), RawType.NVarchar("ProductNumber"), RawType.NVarchar("Color"), RawType.Money("StandardCost"), RawType.Money("ListPrice"), RawType.NVarchar("Size"), RawType.Decimal("Weight", 8, 2), RawType.Int("ProductCategoryID"), RawType.Int("ProductModelID"), RawType.DateTime("SellStartDate"), RawType.DateTime("SellEndDate"), RawType.DateTime("DiscontinuedDate"), RawType.VarBinary("ThumbNailPhoto"), RawType.NVarchar("ThumbnailPhotoFileName"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(17, ((Dictionary <string, object>)result).Count); Assert.AreEqual(680, result.ProductID); Assert.AreEqual("HL Road Frame - Black, 58", result.Name); Assert.AreEqual("FR-R92B-58", result.ProductNumber); Assert.AreEqual("Black", result.Color); Assert.AreEqual(1059.31, result.StandardCost); Assert.AreEqual(1431.50, result.ListPrice); Assert.AreEqual("58", result.Size); Assert.AreEqual(1016.04, result.Weight); Assert.AreEqual(18, result.ProductCategoryID); Assert.AreEqual(6, result.ProductModelID); Assert.AreEqual(Convert.ToDateTime("1998-06-01"), result.SellStartDate); Assert.AreEqual(null, result.SellEndDate); Assert.AreEqual(null, result.DiscontinuedDate); Assert.AreEqual(1077, result.ThumbNailPhoto.Length); Assert.AreEqual("no_image_available_small.gif", result.ThumbnailPhotoFileName); Assert.AreEqual(new Guid("43dd68d6-14a4-461f-9069-55309d90ea7e"), result.rowguid); Assert.AreEqual(Convert.ToDateTime("2004-03-11 10:01:36.827"), result.ModifiedDate); }
public void Parse_ProductDescription(string dbPath, int pageID) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("ProductDescriptionID"), RawType.NVarchar("Description"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(4, ((Dictionary <string, object>)result).Count); Assert.AreEqual(3, result.ProductDescriptionID); Assert.AreEqual("Chromoly steel.", result.Description); Assert.AreEqual(new Guid("301eed3a-1a82-4855-99cb-2afe8290d641"), result.rowguid); Assert.AreEqual(Convert.ToDateTime("2003-06-01"), result.ModifiedDate); }
public void Parse_BuildVersion(string dbPath, int pageID, string databaseVersion, string versionDate) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.TinyInt("SystemInformationID"), RawType.NVarchar("Database Version"), RawType.DateTime("VersionDate"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(4, ((Dictionary <string, object>)result).Count); Assert.AreEqual(1, result.SystemInformationID); Assert.AreEqual(databaseVersion, ((Dictionary <string, object>)result)["Database Version"]); Assert.AreEqual(Convert.ToDateTime(versionDate), result.VersionDate); Assert.AreEqual(Convert.ToDateTime(versionDate), result.ModifiedDate); }
public void Parse_Customer(string dbPath, int pageID, string modifiedDate) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("CustomerID"), RawType.Bit("NameStyle"), RawType.NVarchar("Title"), RawType.NVarchar("FirstName"), RawType.NVarchar("MiddleName"), RawType.NVarchar("LastName"), RawType.NVarchar("Suffix"), RawType.NVarchar("CompanyName"), RawType.NVarchar("SalesPerson"), RawType.NVarchar("EmailAddress"), RawType.NVarchar("Phone"), RawType.Varchar("PasswordHash"), RawType.Varchar("PasswordSalt"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(15, ((Dictionary <string, object>)result).Count); Assert.AreEqual(1, result.CustomerID); Assert.AreEqual(false, result.NameStyle); Assert.AreEqual("Mr.", result.Title); Assert.AreEqual("Orlando", result.FirstName); Assert.AreEqual("N.", result.MiddleName); Assert.AreEqual("Gee", result.LastName); Assert.AreEqual(null, result.Suffix); Assert.AreEqual("A Bike Store", result.CompanyName); Assert.AreEqual(@"adventure-works\pamela0", result.SalesPerson); Assert.AreEqual("*****@*****.**", result.EmailAddress); Assert.AreEqual("245-555-0173", result.Phone); Assert.AreEqual("L/Rlwxzp4w7RWmEgXX+/A7cXaePEPcp+KwQhl2fJL7w=", result.PasswordHash); Assert.AreEqual("1KjXYs4=", result.PasswordSalt); Assert.AreEqual(new Guid("3f5ae95e-b87d-4aed-95b4-c3797afcb74f"), result.rowguid); Assert.AreEqual(Convert.ToDateTime(modifiedDate), result.ModifiedDate); }
public void Parse_ProductModelProductDescription(string dbPath, int pageID, string rowguid) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("ProductModelID"), RawType.Int("ProductDescriptionID"), RawType.NChar("Culture", 6), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(5, ((Dictionary <string, object>)result).Count); Assert.AreEqual(1, result.ProductModelID); Assert.AreEqual(1199, result.ProductDescriptionID); Assert.AreEqual("en".PadRight(6, ' '), result.Culture); Assert.AreEqual(new Guid(rowguid), result.rowguid); Assert.AreEqual(Convert.ToDateTime("2003-06-01"), result.ModifiedDate); }
public void Parse_ProductCategory(string dbPath, int pageID) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("ProductCategoryID"), RawType.Int("ParentProductCategoryID"), RawType.NVarchar("Name"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(5, ((Dictionary <string, object>)result).Count); Assert.AreEqual(1, result.ProductCategoryID); Assert.AreEqual(null, result.ParentProductCategoryID); Assert.AreEqual("Bikes", result.Name); Assert.AreEqual(new Guid("cfbda25c-df71-47a7-b81b-64ee161aa37c"), result.rowguid); Assert.AreEqual(Convert.ToDateTime("1998-06-01"), result.ModifiedDate); }
public void Parse_CustomerAddress(string dbPath, int pageID, int customerID, int addressID, string rowguid, string modifiedDate) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("CustomerID"), RawType.Int("AddressID"), RawType.NVarchar("AddressType"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(5, ((Dictionary <string, object>)result).Count); Assert.AreEqual(customerID, result.CustomerID); Assert.AreEqual(addressID, result.AddressID); Assert.AreEqual("Main Office", result.AddressType); Assert.AreEqual(new Guid(rowguid), result.rowguid); Assert.AreEqual(Convert.ToDateTime(modifiedDate), result.ModifiedDate); }
public void Parse_ProductModel(string dbPath, int pageID) { var db = new RawDataFile(dbPath); var page = db.GetPage(pageID); var record = page.Records.First() as RawPrimaryRecord; var result = RawColumnParser.Parse(record, new IRawType[] { RawType.Int("ProductModelID"), RawType.NVarchar("Name"), RawType.Xml("CatalogDescription"), RawType.UniqueIdentifier("rowguid"), RawType.DateTime("ModifiedDate") }); Assert.AreEqual(5, ((Dictionary <string, object>)result).Count); Assert.AreEqual(1, result.ProductModelID); Assert.AreEqual("Classic Vest", result.Name); Assert.AreEqual(null, result.CatalogDescription); Assert.AreEqual(new Guid("29321d47-1e4c-4aac-887c-19634328c25e"), result.rowguid); Assert.AreEqual(Convert.ToDateTime("2003-06-01"), result.ModifiedDate); }
public void BranchLevelNonClusteredWithNullBitmapAndVariableLength2012_SecondRecord() { var rawBytes = TestHelper.GetBytesFromByteString(@" 36d90000 00780200 00010002 00000100 46006300 68007200 69007300 36004000 61006400 76006500 6e007400 75007200 65002d00 77006f00 72006b00 73002e00 63006f00 6d00 " ); var record = new RawIndexRecord(new ArrayDelimiter <byte>(rawBytes), 11, 1); Assert.AreEqual(1, record.ChildFileID); Assert.AreEqual(632, record.ChildPageID); dynamic row = RawColumnParser.Parse(record, new IRawType[] { RawType.NVarchar("EmailAddress"), RawType.Int("CustomerID") }); Assert.AreEqual("*****@*****.**", row.EmailAddress); Assert.AreEqual(217, row.CustomerID); }
public RawReader(byte[] data, RawType type) { _type = type; SetupStream(data); }
internal RawDevice(IntPtr hDevice, uint dwType) { this.hDevice = hDevice; rawType = (RawType)(dwType + 1); }
public static void SetInnerException(RawType exception, RawType innerException) { }
public static void SetWrapperSdkName(RawType exception, string sdkName) { }
public static void SetStacktrace(RawType exception, string stacktrace) { }
public static void SetMessage(RawType exception, string message) { }
public static void SetType(RawType exception, string type) { }
/// <summary> /// Retrieves the hash code. /// </summary> /// <returns>An integer representing the hash code.</returns> public override int GetHashCode() { return(Hashing.CombineHash(RawType.GetHashCode(), Count.GetHashCode())); }
public EventProperties() { _rawObject = EventPropertiesInternal.Create(); }