public static T CreateDisctionary <T>(this System.Data.IDataRecord record) where T : IDictionary <String, Object>, new() { return(record.SetToDisctionary(new T())); }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this ItemTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("action_display_id"); source.ActionDisplayID = (System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)(System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("amount"); source.Amount = (System.Byte)(System.Byte) dataRecord.GetByte(i); i = dataRecord.GetOrdinal("description"); source.Description = (System.String)(System.String) dataRecord.GetString(i); i = dataRecord.GetOrdinal("equipped_body"); source.EquippedBody = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i)); i = dataRecord.GetOrdinal("graphic"); source.Graphic = (NetGore.GrhIndex)(NetGore.GrhIndex) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("height"); source.Height = (System.Byte)(System.Byte) dataRecord.GetByte(i); i = dataRecord.GetOrdinal("hp"); source.HP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("id"); source.ID = (DemoGame.ItemID)(DemoGame.ItemID) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("item_template_id"); source.ItemTemplateID = (System.Nullable <DemoGame.ItemTemplateID>)(System.Nullable <DemoGame.ItemTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("mp"); source.MP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("name"); source.Name = (System.String)(System.String) dataRecord.GetString(i); i = dataRecord.GetOrdinal("range"); source.Range = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("skill_id"); source.SkillID = (System.Nullable <DemoGame.SkillType>)(System.Nullable <DemoGame.SkillType>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.Byte>)null : dataRecord.GetByte(i)); i = dataRecord.GetOrdinal("stat_agi"); source.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_defence"); source.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_int"); source.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_maxhit"); source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_maxhp"); source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_maxmp"); source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_minhit"); source.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_req_agi"); source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_req_int"); source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_req_str"); source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_str"); source.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("type"); source.Type = (DemoGame.ItemType)(DemoGame.ItemType) dataRecord.GetByte(i); i = dataRecord.GetOrdinal("value"); source.Value = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("weapon_type"); source.WeaponType = (DemoGame.WeaponType)(DemoGame.WeaponType) dataRecord.GetByte(i); i = dataRecord.GetOrdinal("width"); source.Width = (System.Byte)(System.Byte) dataRecord.GetByte(i); }
/// <summary> /// emit调用的方法 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="attribute"></param> /// <param name="dataRecord"></param> /// <param name="columnName"></param> /// <returns></returns> private static T OnDataReadingUsingEmit <T>(TypeHandlerAttribute attribute, System.Data.IDataRecord dataRecord, string columnName) { return(attribute.OnDataReading <T>(dataRecord, columnName)); }
/// <summary> /// Writes an object to the given outputStream /// </summary> /// <param name="outputStream"></param> /// <param name="objectData"></param> /// <param name="fieldNames"></param> /// <returns></returns> protected abstract Task WriteObject(Stream outputStream, System.Data.IDataRecord objectData, string[] fieldNames);
CustomerFull CreatePoco(System.Data.IDataRecord record) { return(new CustomerFull()); }
/// <summary> /// Return whether the specified field is set to null. /// </summary> /// <param name="record">The record to get value field in</param> /// <param name="name">The field name to get value for.</param> /// <returns>true if the specified field is set to null; otherwise, false.</returns> public static bool IsDBNull(this System.Data.IDataRecord record, string name) { var value = record.GetValue(record.GetOrdinal(name)); return(value == DBNull.Value); }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsUserShoppingTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "amount": source.Amount = (System.Byte)(System.Byte) dataRecord.GetByte(i); break; case "character_id": source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i); break; case "cost": source.Cost = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "id": source.ID = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i); break; case "item_template_id": source.ItemTemplateID = (System.Nullable <DemoGame.ItemTemplateID>)(System.Nullable <DemoGame.ItemTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "map_id": source.MapID = (System.Nullable <NetGore.World.MapID>)(System.Nullable <NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "sale_type": source.SaleType = (System.SByte)(System.SByte) dataRecord.GetSByte(i); break; case "shop_id": source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID) dataRecord.GetUInt16(i); break; case "when": source.When = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i); break; case "x": source.X = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); break; case "y": source.Y = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this CharacterTemplateTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "ai_id": source.AIID = (System.Nullable <NetGore.AI.AIID>)(System.Nullable <NetGore.AI.AIID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "alliance_id": source.AllianceID = (DemoGame.AllianceID)(DemoGame.AllianceID) dataRecord.GetByte(i); break; case "body_id": source.BodyID = (DemoGame.BodyID)(DemoGame.BodyID) dataRecord.GetUInt16(i); break; case "chat_dialog": source.ChatDialog = (System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "exp": source.Exp = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "give_cash": source.GiveCash = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "give_exp": source.GiveExp = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "id": source.ID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i); break; case "level": source.Level = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "move_speed": source.MoveSpeed = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); break; case "name": source.Name = (System.String)(System.String) dataRecord.GetString(i); break; case "respawn": source.Respawn = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); break; case "shop_id": source.ShopID = (System.Nullable <NetGore.Features.Shops.ShopID>)(System.Nullable <NetGore.Features.Shops.ShopID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "statpoints": source.StatPoints = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "stat_agi": source.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_defence": source.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_int": source.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_maxhit": source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_maxhp": source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_maxmp": source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_minhit": source.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_str": source.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this CharacterTemplateTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("ai_id"); source.AIID = (System.Nullable <NetGore.AI.AIID>)(System.Nullable <NetGore.AI.AIID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("alliance_id"); source.AllianceID = (DemoGame.AllianceID)(DemoGame.AllianceID) dataRecord.GetByte(i); i = dataRecord.GetOrdinal("body_id"); source.BodyID = (DemoGame.BodyID)(DemoGame.BodyID) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("chat_dialog"); source.ChatDialog = (System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("exp"); source.Exp = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("give_cash"); source.GiveCash = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("give_exp"); source.GiveExp = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("id"); source.ID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("level"); source.Level = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("move_speed"); source.MoveSpeed = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("name"); source.Name = (System.String)(System.String) dataRecord.GetString(i); i = dataRecord.GetOrdinal("respawn"); source.Respawn = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("shop_id"); source.ShopID = (System.Nullable <NetGore.Features.Shops.ShopID>)(System.Nullable <NetGore.Features.Shops.ShopID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("statpoints"); source.StatPoints = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("stat_agi"); source.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_defence"); source.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_int"); source.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_maxhit"); source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_maxhp"); source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_maxmp"); source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_minhit"); source.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); i = dataRecord.GetOrdinal("stat_str"); source.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); }
public Sheep(System.Data.IDataRecord record) : base(record) { this.amtWool = Convert.ToDouble(record["amtWool"].ToString()); }
ScaffoldInsertResults CreatePoco(System.Data.IDataRecord record) { return(new ScaffoldInsertResults()); }
public Goat(System.Data.IDataRecord record) : base(record) { this.amtMilk = Convert.ToDouble(record["amtMilk"].ToString()); }
public Cow(System.Data.IDataRecord record) : base(record) { this.amtMilk = Convert.ToDouble(record["amtMilk"].ToString()); this.isJersy = Convert.ToBoolean(record["isJersy"].ToString()); }
public static Dictionary <String, Object> CreateDisctionary(this System.Data.IDataRecord record) { return(record.SetToDisctionary(new Dictionary <String, Object>())); }
/// <summary> /// Gets field value as integer in specified record. /// </summary> /// <param name="record">The record to get value field in.</param> /// <param name="name">The field name to get value for.</param> /// <returns>The field value.</returns> public static int GetInt32(this System.Data.IDataRecord record, string name) { var value = record.GetValue(record.GetOrdinal(name)); return(Convert.ToInt32(value, CultureInfo.InvariantCulture)); }
public DashboardJson(int ID_UTILIZATOR, int ID_SOCIETATE, string conStr) { DataAccess da = new DataAccess(ID_UTILIZATOR, conStr, System.Data.CommandType.StoredProcedure, "DASHBOARDsp_select", new object[] { new MySql.Data.MySqlClient.MySqlParameter("_ID_SOCIETATE", ID_SOCIETATE), new MySql.Data.MySqlClient.MySqlParameter("_EXPIRATION_DAYS", 15) }); // TO DO: de adaugat parametru in setari !!! MySql.Data.MySqlClient.MySqlDataReader r = da.ExecuteSelectQuery(); while (r.Read()) { System.Data.IDataRecord dj = (System.Data.IDataRecord)r; try { this.DOSARE_TOTAL = Convert.ToInt32(dj["DOSARE_TOTAL"]); } catch { } try { this.DOSARE_CASCO_TOTAL = Convert.ToInt32(dj["DOSARE_CASCO_TOTAL"]); } catch { } try { this.DOSARE_RCA_TOTAL = Convert.ToInt32(dj["DOSARE_RCA_TOTAL"]); } catch { } // -- doar pt. Admin si Super -- try { this.DOSARE_NEASIGNATE = Convert.ToInt32(dj["DOSARE_NEASIGNATE"]); } catch { } try { this.DOSARE_CASCO_NEASIGNATE = Convert.ToInt32(dj["DOSARE_CASCO_NEASIGNATE"]); } catch { } try { this.DOSARE_RCA_NEASIGNATE = Convert.ToInt32(dj["DOSARE_RCA_NEASIGNATE"]); } catch { } try { this.DOSARE_NEASIGNATE_FROM_LAST_LOGIN = Convert.ToInt32(dj["DOSARE_NEASIGNATE_FROM_LAST_LOGIN"]); } catch { } try { this.DOSARE_NEASIGNATE_CASCO_FROM_LAST_LOGIN = Convert.ToInt32(dj["DOSARE_NEASIGNATE_CASCO_FROM_LAST_LOGIN"]); } catch { } try { this.DOSARE_NEASIGNATE_RCA_FROM_LAST_LOGIN = Convert.ToInt32(dj["DOSARE_NEASIGNATE_RCA_FROM_LAST_LOGIN"]); } catch { } // -- pt. All -- try { this.DOSARE_FROM_LAST_LOGIN = Convert.ToInt32(dj["DOSARE_FROM_LAST_LOGIN"]); } catch { } try { this.DOSARE_CASCO_FROM_LAST_LOGIN = Convert.ToInt32(dj["DOSARE_CASCO_FROM_LAST_LOGIN"]); } catch { } try { this.DOSARE_RCA_FROM_LAST_LOGIN = Convert.ToInt32(dj["DOSARE_RCA_FROM_LAST_LOGIN"]); } catch { } try { this.DOSARE_NEOPERATE = Convert.ToInt32(dj["DOSARE_NEOPERATE"]); } catch { this.DOSARE_NEOPERATE = 0; } try { this.DOSARE_CASCO_NEOPERATE = Convert.ToInt32(dj["DOSARE_CASCO_NEOPERATE"]); } catch { this.DOSARE_CASCO_NEOPERATE = 0; } try { this.DOSARE_RCA_NEOPERATE = Convert.ToInt32(dj["DOSARE_RCA_NEOPERATE"]); } catch { this.DOSARE_RCA_NEOPERATE = 0; } try { this.PROCESE_TOTAL = Convert.ToInt32(dj["PROCESE_TOTAL"]); } catch { this.PROCESE_TOTAL = 0; } try { this.PROCESE_RECLAMANT_TOTAL = Convert.ToInt32(dj["PROCESE_RECLAMANT_TOTAL"]); } catch { this.PROCESE_RECLAMANT_TOTAL = 0; } try { this.PROCESE_PARAT_TOTAL = Convert.ToInt32(dj["PROCESE_PARAT_TOTAL"]); } catch { this.PROCESE_PARAT_TOTAL = 0; } try { this.PROCESE_NOI_TOTAL = Convert.ToInt32(dj["PROCESE_NOI_TOTAL"]); } catch { this.PROCESE_NOI_TOTAL = 0; } /* -- PT. STATUS DOSARE -- */ try { this.DOSARE_INCOMPLETE = Convert.ToInt32(dj["DOSARE_INCOMPLETE"]); } catch { this.DOSARE_INCOMPLETE = 0; } try { this.DOSARE_NEAVIZATE = Convert.ToInt32(dj["DOSARE_NEAVIZATE"]); } catch { this.DOSARE_NEAVIZATE = 0; } try { this.DOSARE_AVIZATE = Convert.ToInt32(dj["DOSARE_AVIZATE"]); } catch { this.DOSARE_AVIZATE = 0; } try { this.DOSARE_AVIZATE_NEEXPEDIATE = Convert.ToInt32(dj["DOSARE_AVIZATE_NEEXPEDIATE"]); } catch { this.DOSARE_AVIZATE_NEEXPEDIATE = 0; } try { this.DOSARE_NEACHITATE = Convert.ToInt32(dj["DOSARE_NEACHITATE"]); } catch { this.DOSARE_NEACHITATE = 0; } try { this.DOSARE_ACHITATE_PARTIAL = Convert.ToInt32(dj["DOSARE_ACHITATE_PARTIAL"]); } catch { this.DOSARE_ACHITATE_PARTIAL = 0; } try { this.DOSARE_ACHITATE = Convert.ToInt32(dj["DOSARE_ACHITATE"]); } catch { this.DOSARE_ACHITATE = 0; } try { this.DOSARE_AVIZATE_TOTAL = DOSARE_AVIZATE + DOSARE_NEACHITATE + DOSARE_ACHITATE_PARTIAL + DOSARE_ACHITATE; } catch { this.DOSARE_AVIZATE_TOTAL = 0; } try { this.DOSARE_FARA_DOCUMENTE = Convert.ToInt32(dj["DOSARE_FARA_DOCUMENTE"]); } catch { this.DOSARE_FARA_DOCUMENTE = 0; } try { this.DOSARE_FARA_PROCES = Convert.ToInt32(dj["DOSARE_FARA_PROCES"]); } catch { this.DOSARE_FARA_PROCES = 0; } /* --- */ /* -- PENTRU TERMENE -- */ try { this.TERMENE_IN_URMATOARELE_7_ZILE = Convert.ToInt32(dj["TERMENE_IN_URMATOARELE_7_ZILE"]); } catch { this.TERMENE_IN_URMATOARELE_7_ZILE = 0; } try { this.TERMENE_DEPASITE = Convert.ToInt32(dj["TERMENE_DEPASITE"]); } catch { this.TERMENE_DEPASITE = 0; } /* --- */ /* -- PENTRU MESAJE -- */ try { this.MESAJE_NOI = Convert.ToInt32(dj["MESAJE_NOI"]); } catch { } try { this.MESAJE_NOI_DOSAR_NOU = Convert.ToInt32(dj["MESAJE_NOI_DOSAR_NOU"]); } catch { } try { this.MESAJE_NOI_DOCUMENT_NOU = Convert.ToInt32(dj["MESAJE_NOI_DOCUMENT_NOU"]); } catch { } /* --- */ break; } LABELS_STATUS = new List <string>() { socisaV2.Resources.DashboardResx.DOSARE_INCOMPLETE, socisaV2.Resources.DashboardResx.DOSARE_NEOPERATE, socisaV2.Resources.DashboardResx.DOSARE_AVIZATE_TOTAL }; LABELS_STATUS_AVIZATE = new List <string>() { socisaV2.Resources.DashboardResx.DOSARE_AVIZATE, socisaV2.Resources.DashboardResx.DOSARE_NEACHITATE, socisaV2.Resources.DashboardResx.DOSARE_ACHITATE_PARTIAL, socisaV2.Resources.DashboardResx.DOSARE_ACHITATE }; VALUES_STATUS = new List <int>() { DOSARE_INCOMPLETE, DOSARE_NEAVIZATE, DOSARE_AVIZATE_TOTAL }; VALUES_STATUS_AVIZATE = new List <int>() { DOSARE_AVIZATE, DOSARE_NEACHITATE, DOSARE_ACHITATE_PARTIAL, DOSARE_ACHITATE }; r.Close(); r.Dispose(); da.CloseConnection(); }
/// <summary> /// Gets field value as boolean in specified record. /// </summary> /// <param name="record">The record to get value field in.</param> /// <param name="name">The field name to get value for.</param> /// <returns>The field value.</returns> public static bool GetBoolean(this System.Data.IDataRecord record, string name) { var value = record.GetValue(record.GetOrdinal(name)); return(Convert.ToBoolean(value, CultureInfo.InvariantCulture)); }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsCountConsumeItemTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "count": source.Count = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "item_template_id": source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID) dataRecord.GetUInt16(i); break; case "last_update": source.LastUpdate = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this WorldStatsCountUserConsumeItemTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("count"); source.Count = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("item_template_id"); source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("last_update"); source.LastUpdate = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i); i = dataRecord.GetOrdinal("user_id"); source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i); }
CustomerLite CreatePoco(System.Data.IDataRecord record) { return(new CustomerLite()); }
protected override void LoadData(System.Data.IDataRecord row) { this.Username = Framework.Database.RecordHelper.Value <string>(row, "Username"); }
/// <summary> /// Creates a SendTransactionSummary from the DataRecord. /// </summary> /// <param name="record">The record of the data.</param> /// <returns>A filled SendTransactionSummary object.</returns> private static SendTransactionSummary CreateAndFillSendTransactionSummaryFromRecord(System.Data.IDataRecord record) { return(new SendTransactionSummary((TransactionStatus)record.GetInt64("mta_transactionStatus_id"), record.GetInt64("count"))); }
protected abstract TEntity MapperToGlobal(System.Data.IDataRecord data);
public abstract void Load(System.Data.IDataRecord record);
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this ItemTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "action_display_id": source.ActionDisplayID = (System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)(System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "amount": source.Amount = (System.Byte)(System.Byte) dataRecord.GetByte(i); break; case "description": source.Description = (System.String)(System.String) dataRecord.GetString(i); break; case "equipped_body": source.EquippedBody = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i)); break; case "graphic": source.Graphic = (NetGore.GrhIndex)(NetGore.GrhIndex) dataRecord.GetUInt16(i); break; case "height": source.Height = (System.Byte)(System.Byte) dataRecord.GetByte(i); break; case "hp": source.HP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i); break; case "id": source.ID = (DemoGame.ItemID)(DemoGame.ItemID) dataRecord.GetInt32(i); break; case "item_template_id": source.ItemTemplateID = (System.Nullable <DemoGame.ItemTemplateID>)(System.Nullable <DemoGame.ItemTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "mp": source.MP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i); break; case "name": source.Name = (System.String)(System.String) dataRecord.GetString(i); break; case "range": source.Range = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); break; case "skill_id": source.SkillID = (System.Nullable <DemoGame.SkillType>)(System.Nullable <DemoGame.SkillType>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.Byte>)null : dataRecord.GetByte(i)); break; case "stat_agi": source.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_defence": source.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_int": source.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_maxhit": source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_maxhp": source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_maxmp": source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_minhit": source.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_req_agi": source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_req_int": source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_req_str": source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "stat_str": source.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i)); break; case "type": source.Type = (DemoGame.ItemType)(DemoGame.ItemType) dataRecord.GetByte(i); break; case "value": source.Value = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "weapon_type": source.WeaponType = (DemoGame.WeaponType)(DemoGame.WeaponType) dataRecord.GetByte(i); break; case "width": source.Width = (System.Byte)(System.Byte) dataRecord.GetByte(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this ViewNpcCharacterTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "ai_id": source.AIID = (System.Nullable <NetGore.AI.AIID>)(System.Nullable <NetGore.AI.AIID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "body_id": source.BodyID = (DemoGame.BodyID)(DemoGame.BodyID) dataRecord.GetUInt16(i); break; case "cash": source.Cash = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "character_template_id": source.CharacterTemplateID = (System.Nullable <DemoGame.CharacterTemplateID>)(System.Nullable <DemoGame.CharacterTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "chat_dialog": source.ChatDialog = (System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "exp": source.Exp = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "hp": source.HP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i); break; case "id": source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "level": source.Level = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "load_map_id": source.LoadMapID = (NetGore.World.MapID)(NetGore.World.MapID) dataRecord.GetUInt16(i); break; case "load_x": source.LoadX = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); break; case "load_y": source.LoadY = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); break; case "move_speed": source.MoveSpeed = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); break; case "mp": source.MP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i); break; case "name": source.Name = (System.String)(System.String) dataRecord.GetString(i); break; case "respawn_map_id": source.RespawnMapID = (System.Nullable <NetGore.World.MapID>)(System.Nullable <NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "respawn_x": source.RespawnX = (System.Single)(System.Single) dataRecord.GetFloat(i); break; case "respawn_y": source.RespawnY = (System.Single)(System.Single) dataRecord.GetFloat(i); break; case "shop_id": source.ShopID = (System.Nullable <NetGore.Features.Shops.ShopID>)(System.Nullable <NetGore.Features.Shops.ShopID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "statpoints": source.StatPoints = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "stat_agi": source.StatAgi = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "stat_defence": source.StatDefence = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "stat_int": source.StatInt = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "stat_maxhit": source.StatMaxhit = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "stat_maxhp": source.StatMaxhp = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "stat_maxmp": source.StatMaxmp = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "stat_minhit": source.StatMinhit = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; case "stat_str": source.StatStr = (System.Int16)(System.Int16) dataRecord.GetInt16(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsCountNpcKillUserTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "count": source.Count = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "last_update": source.LastUpdate = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i); break; case "npc_template_id": source.NPCTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i); break; case "user_id": source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this ViewNpcCharacterTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("ai_id"); source.AIID = (System.Nullable <NetGore.AI.AIID>)(System.Nullable <NetGore.AI.AIID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("body_id"); source.BodyID = (DemoGame.BodyID)(DemoGame.BodyID) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("cash"); source.Cash = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("character_template_id"); source.CharacterTemplateID = (System.Nullable <DemoGame.CharacterTemplateID>)(System.Nullable <DemoGame.CharacterTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("chat_dialog"); source.ChatDialog = (System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("exp"); source.Exp = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("hp"); source.HP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("id"); source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("level"); source.Level = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("load_map_id"); source.LoadMapID = (NetGore.World.MapID)(NetGore.World.MapID) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("load_x"); source.LoadX = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("load_y"); source.LoadY = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("move_speed"); source.MoveSpeed = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("mp"); source.MP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("name"); source.Name = (System.String)(System.String) dataRecord.GetString(i); i = dataRecord.GetOrdinal("respawn_map_id"); source.RespawnMapID = (System.Nullable <NetGore.World.MapID>)(System.Nullable <NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("respawn_x"); source.RespawnX = (System.Single)(System.Single) dataRecord.GetFloat(i); i = dataRecord.GetOrdinal("respawn_y"); source.RespawnY = (System.Single)(System.Single) dataRecord.GetFloat(i); i = dataRecord.GetOrdinal("shop_id"); source.ShopID = (System.Nullable <NetGore.Features.Shops.ShopID>)(System.Nullable <NetGore.Features.Shops.ShopID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("statpoints"); source.StatPoints = (System.Int32)(System.Int32) dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("stat_agi"); source.StatAgi = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("stat_defence"); source.StatDefence = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("stat_int"); source.StatInt = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("stat_maxhit"); source.StatMaxhit = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("stat_maxhp"); source.StatMaxhp = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("stat_maxmp"); source.StatMaxmp = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("stat_minhit"); source.StatMinhit = (System.Int16)(System.Int16) dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("stat_str"); source.StatStr = (System.Int16)(System.Int16) dataRecord.GetInt16(i); }
public override void Load(System.Data.IDataRecord record) { throw new NotImplementedException(); }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this CharacterTemplateInventoryTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "chance": source.Chance = (DemoGame.ItemChance)(DemoGame.ItemChance) dataRecord.GetUInt16(i); break; case "character_template_id": source.CharacterTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i); break; case "id": source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i); break; case "item_template_id": source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID) dataRecord.GetUInt16(i); break; case "max": source.Max = (System.Byte)(System.Byte) dataRecord.GetByte(i); break; case "min": source.Min = (System.Byte)(System.Byte) dataRecord.GetByte(i); break; } } }