public ResourceRecord(DbDataReader reader) { Page = reader.GetString(reader.GetOrdinal("resourcepage")); CultureCode = reader.GetString(reader.GetOrdinal("culturecode")); Key = reader.GetString(reader.GetOrdinal("resourcekey")); Value = reader.GetString(reader.GetOrdinal("resourcevalue")); }
private BasicExternalCredential ReadExternalCredentialFromDataReader (DbDataReader reader) { int externalCredentialId = reader.GetInt32(0); string serviceName = reader.GetString(1); string login = reader.GetString(2); string password = reader.GetString(3); return new BasicExternalCredential(externalCredentialId, serviceName, login, password); }
private static BasicExceptionLog ExceptionLogFromDataReader (DbDataReader reader) { int ExceptionId = reader.GetInt32(0); DateTime ExceptionDateTime = reader.GetDateTime(1); string Source = reader.GetString(2); string ExceptionText = reader.GetString(3); return new BasicExceptionLog(ExceptionId, ExceptionDateTime, Source, ExceptionText); }
private static BasicCountry ReadCountryFromDataReader(DbDataReader reader) { int countryId = reader.GetInt32(0); string name = reader.GetString(1); string code = reader.GetString(2).ToUpperInvariant(); string culture = reader.GetString(3); int geographyId = reader.GetInt32(4); return new BasicCountry(countryId, name, code, culture, geographyId); }
public IPersistentRepresentation Map(DbDataReader reader, IActorRef sender = null) { var persistenceId = reader.GetString(PersistenceIdIndex); var sequenceNr = reader.GetInt64(SequenceNrIndex); var isDeleted = reader.GetBoolean(IsDeletedIndex); var manifest = reader.GetString(ManifestIndex); // timestamp is SQL-journal specific field, it's not a part of casual Persistent instance var payload = GetPayload(reader, manifest); return new Persistent(payload, sequenceNr, persistenceId, manifest, isDeleted, sender); }
private static BasicAutoMail ReadAutoMailFromDataReader (DbDataReader reader) { int autoMailId = reader.GetInt32(0); AutoMailType type = (AutoMailType) Enum.Parse(typeof (AutoMailType), reader.GetString(1)); int geographyId = reader.GetInt32(3); int organizationId = reader.GetInt32(2); int authorPersonId = reader.GetInt32(4); // appear to be unused? string title = reader.GetString(5); string body = reader.GetString(6); return new BasicAutoMail(autoMailId, type, organizationId, geographyId, authorPersonId, title, body); }
public static void GetDevisPrestataire(Devis d) { String sql = "SELECT devisid, prestataireid, dp.prix, nom FROM DevisPrestataire dp inner join Prestataire p on dp.prestataireid = p.id WHERE devisId=@devisId "; using (MySqlCommand command = new MySqlCommand(sql, connection)) { command.Connection.Open(); command.Parameters.AddWithValue("@devisid", d.Id); using (System.Data.Common.DbDataReader dbReader = command.ExecuteReader()) { while (dbReader.Read()) { int devisid = dbReader.GetInt32(0); int prestataireid = dbReader.GetInt32(1); int prix = dbReader.GetInt32(2); string nom = dbReader.GetString(3); DevisPrestataire dp = new DevisPrestataire(devisid, prestataireid, prix) { Nom = nom }; d.DevisPrestataires.Add(dp); } } command.Connection.Close(); } }
public WorkoutPlan(DbDataReader reader) { _id = reader.GetInt64(0); _title = reader.GetValue(1).ToString() == "" ? "" : reader.GetString(1); _period = reader.GetValue(2).ToString() == "" ? (byte)0 : reader.GetByte(2); _creatorId = reader.GetValue(3).ToString() == "" ? 0 : reader.GetInt64(3); }
private static BasicGeography ReadGeographyFromDataReader (DbDataReader reader) { int geographyId = reader.GetInt32(0); int parentGeographyId = reader.GetInt32(1); string name = reader.GetString(2); return new BasicGeography(geographyId, parentGeographyId, name); }
public static void GetPrestataire() { String sql = "SELECT * FROM Prestataire"; using (MySqlCommand command = new MySqlCommand(sql, connection)) { try { command.Connection.Open(); } catch (MySqlException) { } using (System.Data.Common.DbDataReader dbReader = command.ExecuteReader()) { while (dbReader.Read()) { int Id = dbReader.GetInt32(0); String Nom = dbReader.GetString(1); String Url = dbReader.GetString(2); String Categorie = dbReader.GetString(3); String Contact = dbReader.GetString(4); String Adresse = dbReader.GetString(5); String Description = dbReader.GetString(6); Boolean Activation = dbReader.GetBoolean(7); String Prix = dbReader.GetString(8); // attente de la création de la class business Business.Prestataires.Add(new Prestataire(Id, Nom, Url, Categorie, Contact, Adresse, Description, Activation, Prix)); } } command.Connection.Close(); } }
private static BasicPerson ReadPersonFromDataReader (DbDataReader reader) { int personId = reader.GetInt32(0); string passwordHash = reader.GetString(1); string name = reader.GetString(2); string email = reader.GetString(3); string street = reader.GetString(4); string postalCode = reader.GetString(5); string cityName = reader.GetString(6); int countryId = reader.GetInt32(7); string phone = reader.GetString(8); int geographyId = reader.GetInt32(9); DateTime birthdate = reader.GetDateTime(10); int genderId = reader.GetInt32(11); // Fix broken names, emails email = email.ToLower().Trim(); name = name.Trim(); while (name.Contains(" ")) { name = name.Replace(" ", " "); } return new BasicPerson(personId, passwordHash, name, email, street, postalCode, cityName, countryId, phone, geographyId, birthdate, (PersonGender)genderId); }
/// <summary> /// /// </summary> /// <param name="reader"></param> /// <returns></returns> protected static string GetTableType(DbDataReader reader) { const string TABLE_TYPE = @"TABLE_TYPE"; var ordinal = reader.GetOrdinal(TABLE_TYPE); var type = reader.GetString(ordinal); return type; }
/// <summary> /// /// </summary> /// <param name="reader"></param> /// <returns></returns> protected static string GetTableName(DbDataReader reader) { const string TABLE_NAME = @"TABLE_NAME"; var ordinal = reader.GetOrdinal(TABLE_NAME); var name = reader.GetString(ordinal); return name; }
private static BasicCity ReadCityFromDataReader (DbDataReader reader) { int cityId = reader.GetInt32(0); int countryId = reader.GetInt32(1); string cityName = reader.GetString(2); int geographyId = reader.GetInt32(3); return new BasicCity(cityId, cityName, countryId, geographyId); }
private static BasicOrganization ReadOrganizationFromDataReader (DbDataReader reader) { int organizationId = reader.GetInt32(0); int parentOrganizationId = reader.GetInt32(1); string name = reader.GetString(2); string nameInternational = reader.GetString(3); string nameShort = reader.GetString(4); string domain = reader.GetString(5); string mailPrefix = reader.GetString(6); int anchorGeographyId = reader.GetInt32(7); bool acceptsMembers = reader.GetBoolean(8); bool autoAssignNewMembers = reader.GetBoolean(9); int defaultCountryId = reader.GetInt32(10); return new BasicOrganization(organizationId, parentOrganizationId, name, nameInternational, nameShort, domain, mailPrefix, anchorGeographyId, acceptsMembers, autoAssignNewMembers, defaultCountryId); }
private BasicPWEvent ReadPWEventFromDataReader (DbDataReader reader) { int eventId = reader.GetInt32(0); EventType eventType = (EventType)Enum.Parse(typeof(EventType), reader.GetString(1)); EventSource eventSource = (EventSource)Enum.Parse(typeof(EventSource), reader.GetString(2)); int actingPersonId = reader.GetInt32(3); int affectedPersonId = reader.GetInt32(4); DateTime eventDateTime = reader.GetDateTime(5); DateTime processedDateTime = reader.GetDateTime(6); bool open = reader.GetBoolean(7); int organizationId = reader.GetInt32(8); int geographyId = reader.GetInt32(9); int parameterInt = reader.GetInt32(10); string parameterText = reader.GetString(11); return new BasicPWEvent(eventId, eventDateTime, open, processedDateTime, eventType, eventSource, actingPersonId, affectedPersonId, organizationId, geographyId, parameterInt, parameterText); }
private object GetPayload(DbDataReader reader) { var payloadType = reader.GetString(3); var type = Type.GetType(payloadType, true); var binary = (byte[]) reader[4]; var serializer = _serialization.FindSerializerForType(type); return serializer.FromBinary(binary, type); }
private BasicOutboundInvoiceItem ReadOutboundInvoiceItemFromDataReader (DbDataReader reader) { int outboundInvoiceItemId = reader.GetInt32(0); int outboundInvoiceId = reader.GetInt32(1); string description = reader.GetString(2); Int64 amountCents = reader.GetInt64(3); return new BasicOutboundInvoiceItem(outboundInvoiceItemId, outboundInvoiceId, description, amountCents); }
private static BasicGeographyDesignation ReadGeographyDesignationFromDataReader (DbDataReader reader) { int geographyId = reader.GetInt32(0); int countryId = reader.GetInt32(1); string designation = reader.GetString(2); GeographyLevel level = (GeographyLevel) reader.GetInt32(3); return new BasicGeographyDesignation(geographyId, countryId, designation, level); }
private BasicPostalCode ReadPostalCodeFromDataReader(DbDataReader reader) { int postalCodeId = reader.GetInt32(0); string postalCode = reader.GetString(1); int cityId = reader.GetInt32(2); int countryId = reader.GetInt32(3); return new BasicPostalCode(postalCodeId, postalCode, cityId, countryId); }
public IPersistentRepresentation Map(DbDataReader reader, IActorRef sender = null) { var persistenceId = reader.GetString(0); var sequenceNr = reader.GetInt64(1); var isDeleted = reader.GetBoolean(2); var payload = GetPayload(reader); return new Persistent(payload, sequenceNr, persistenceId, isDeleted, sender); }
private object GetSnapshot(DbDataReader reader) { var type = Type.GetType(reader.GetString(3), true); var serializer = _serialization.FindSerializerForType(type); var binary = (byte[])reader[4]; var obj = serializer.FromBinary(binary, type); return obj; }
public SelectedSnapshot Map(DbDataReader reader) { var persistenceId = reader.GetString(0); var sequenceNr = reader.GetInt64(1); var timestamp = new DateTime(reader.GetInt64(2)); var metadata = new SnapshotMetadata(persistenceId, sequenceNr, timestamp); var snapshot = GetSnapshot(reader); return new SelectedSnapshot(metadata, snapshot); }
static private BasicPersonRole ReadPersonRoleFromDataReader (DbDataReader reader) { int personRoleId = reader.GetInt32(0); string personRoleTypeName = reader.GetString(1); int personId = reader.GetInt32(2); int organizationId = reader.GetInt32(3); int geographyId = reader.GetInt32(4); RoleType roleType = (RoleType) Enum.Parse(typeof (RoleType), personRoleTypeName); return new BasicPersonRole(personRoleId, personId, roleType, organizationId, geographyId); }
private Dictionary<int, Medicine> Read(DbDataReader reader, IDatabase db) { Dictionary<int, Medicine> medicines = new Dictionary<int, Medicine>(); while (reader.Read()) { Medicine m = new Medicine(); m.Id = reader.GetInt32(0); m.Name = reader.GetString(1); m.Description = reader.GetString(2); m.PackageSize = reader.GetInt32(3); m.Price = Decimal.ToSingle(reader.GetDecimal(4)); m.Allergens = this.ReadAllergens(m, db); medicines.Add(m.Id, m); } return medicines; }
private BasicOutboundInvoice ReadOutboundInvoiceFromDataReader(DbDataReader reader) { int outboundInvoiceId = reader.GetInt32(0); string customerName = reader.GetString(1); string invoiceAddressPaper = reader.GetString(2); string invoiceAddressMail = reader.GetString(3); int currencyId = reader.GetInt32(4); // double amount = reader.GetDouble(5); int organizationId = reader.GetInt32(6); int budgetId = reader.GetInt32(7); DateTime createdDateTime = reader.GetDateTime(8); int createdByPersonId = reader.GetInt32(9); DateTime dueDate = reader.GetDateTime(10); int reminderCount = reader.GetInt32(11); string reference = reader.GetString(12); bool domestic = reader.GetBoolean(13); bool open = reader.GetBoolean(14); bool sent = reader.GetBoolean(15); string securityCode = reader.GetString(16); string theirReference = reader.GetString(17); return new BasicOutboundInvoice(outboundInvoiceId, customerName, invoiceAddressPaper, invoiceAddressMail, currencyId, organizationId, budgetId, createdDateTime, createdByPersonId, dueDate, reminderCount, reference, domestic, open, sent, securityCode, theirReference); }
private BasicInboundInvoice ReadInboundInvoiceFromDataReader(DbDataReader reader) { int inboundInvoiceId = reader.GetInt32(0); int organizationId = reader.GetInt32(1); DateTime createdDateTime = reader.GetDateTime(2); int createdByPersonId = reader.GetInt32(3); DateTime dueDate = reader.GetDateTime(4); Int64 amountCents = reader.GetInt64(5); int budgetId = reader.GetInt32(6); bool attested = reader.GetBoolean(7); bool open = reader.GetBoolean(8); string supplier = reader.GetString(9); string payToAccount = reader.GetString(10); string ocr = reader.GetString(11); string invoiceReference = reader.GetString(12); DateTime closedDateTime = reader.GetDateTime(13); int closedByPersonId = reader.GetInt32(14); return new BasicInboundInvoice(inboundInvoiceId, organizationId, createdDateTime, dueDate, amountCents, budgetId, supplier, payToAccount, ocr, invoiceReference, attested, open, closedDateTime, closedByPersonId); }
private BasicPayrollAdjustment ReadPayrollAdjustmentFromDataReader(DbDataReader reader) { int payrollAdjustmentId = reader.GetInt32(0); int payrollAdjustmentTypeId = reader.GetInt32(1); int payrollItemId = reader.GetInt32(2); Int64 amountCents = reader.GetInt64(3); string description = reader.GetString(4); bool open = reader.GetBoolean(5); int salaryId = reader.GetInt32(6); return new BasicPayrollAdjustment(payrollAdjustmentId, payrollItemId, (PayrollAdjustmentType) payrollAdjustmentTypeId, amountCents, description, open, salaryId); }
static int GetString(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); System.Data.Common.DbDataReader obj = (System.Data.Common.DbDataReader)ToLua.CheckObject(L, 1, typeof(System.Data.Common.DbDataReader)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); string o = obj.GetString(arg0); LuaDLL.lua_pushstring(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
protected Conversation GetCurrentConversation(DbDataReader reader) { int colID = reader.GetOrdinal("grupoid_grupo"); int colName = reader.GetOrdinal("nombre"); Conversation conversation = new Conversation(); if (!reader.IsDBNull(colID)) { conversation.ID = reader.GetInt32(colID); } if (!reader.IsDBNull(colName)) { conversation.Name = reader.GetString(colName); } return conversation; }
public static void Write( Stream output, DbDataReader source) { /* Style: value1row1 value2row1 value1row2 value2row2 */ TextWriter writer = new StreamWriter(output); while (source.Read()) { for (int i = 0; i < source.FieldCount; ++i) writer.Write(source.GetString(i)); writer.WriteLine(); } writer.Flush(); }
private BasicInternalPoll ReadInternalPollFromDataReader(DbDataReader reader) { int internalPollId = reader.GetInt32(0); int organizationId = reader.GetInt32(1); int geographyId = reader.GetInt32(2); string name = reader.GetString(3); bool runningOpen = reader.GetBoolean(4); bool votingOpen = reader.GetBoolean(5); int maxVoteLength = reader.GetInt32(6); int createdByPersonId = reader.GetInt32(7); DateTime runningOpens = reader.GetDateTime(8); DateTime runningCloses = reader.GetDateTime(9); DateTime votingOpens = reader.GetDateTime(10); DateTime votingCloses = reader.GetDateTime(11); int resultsTypeId = reader.GetInt32(12); InternalPollResultsType resultsType = (InternalPollResultsType) resultsTypeId; return new BasicInternalPoll(internalPollId, createdByPersonId, organizationId, geographyId, name, runningOpen, votingOpen, maxVoteLength, runningOpens, runningCloses, votingOpens, votingCloses, resultsType); }
private void mapValues(DbDataReader reader, object record) { foreach (var accessor in this.accessors) { var index = reader.GetOrdinal(accessor.Name); if (reader.IsDBNull(index)) { continue; } if (accessor.PropertyType == typeof(string)) { accessor.Set(record, reader.GetString(index)); } else if (accessor.PropertyType == typeof(int) || accessor.PropertyType == typeof(int?)) { accessor.Set(record, reader.GetInt32(index)); } else if (accessor.PropertyType == typeof(long) || accessor.PropertyType == typeof(long?)) { accessor.Set(record, reader.GetInt64(index)); } else if (accessor.PropertyType == typeof(DateTime) || accessor.PropertyType == typeof(DateTime?)) { accessor.Set(record, reader.GetDateTime(index)); } else if (accessor.PropertyType == typeof(char) || accessor.PropertyType == typeof(char?)) { accessor.Set(record, reader.GetChar(index)); } } }
internal static Model.ContactsApplicationMapping MapToContactsApplication(System.Data.Common.DbDataReader dr) { ContactsApplicationMapping cam = new ContactsApplicationMapping(); cam.IdMap = (long)dr.GetDecimal("ID_MAP"); cam.IdTitolo = (long)dr.GetDecimal("ID_TITOLO"); cam.AppCode = dr.GetString("APP_CODE"); cam.Titolo = dr.GetString("TITOLO"); cam.TitoloCode = dr.GetString("TITOLO_PROT_CODE"); cam.IsTitoloActive = Convert.ToBoolean(dr.GetDecimal("TITOLO_ACTIVE")); cam.IdSottotitolo = (long)dr.GetDecimal("ID_SOTTOTITOLO"); cam.Sottotitolo = dr.GetString("SOTTOTITOLO"); cam.SottotitoloCode = dr.GetString("SOTTOTITOLO_PROT_CODE"); cam.IsSottotitoloActive = Convert.ToBoolean(dr.GetDecimal("SOTTOTITOLO_ACTIVE")); cam.ComCode = dr.GetString("COM_CODE"); cam.IdContact = (long)dr.GetDecimal("ID_CONTACT"); cam.Mail = dr.GetString("MAIL"); cam.Fax = dr.GetString("FAX"); cam.Telefono = dr.GetString("TELEFONO"); cam.RefIdReferral = (long)dr.GetDecimal("REF_ID_REFERRAL"); cam.IsPec = Convert.ToBoolean(dr.GetDecimal("FLG_PEC")); cam.RefOrg = (long)dr.GetDecimal("REF_ORG"); cam.IdCanale = (long)dr.GetDecimal("ID_CANALE"); cam.Codice = dr.GetString("CODICE"); cam.IdBackend = (long)dr.GetDecimal("ID_BACKEND"); cam.BackendCode = dr.GetString("BACKEND_CODE"); cam.BackendDescr = dr.GetString("BACKEND_DESCR"); cam.Category = dr.GetString("CATEGORY"); cam.DescrPlus = dr.GetString("DESCR_PLUS"); return(cam); }
public IEnumerable <Bunk> QueryBunkListView(DataTransferObject.Foundation.BunkQueryCondition condition, Core.Pagination pagination) { var result = new List <Bunk>(); using (var dbOperator = new DbOperator(Provider, ConnectionString)) { if (!string.IsNullOrWhiteSpace(condition.Airline)) { dbOperator.AddParameter("@iAirline", condition.Airline.Trim()); } if (!string.IsNullOrWhiteSpace(condition.Departure)) { dbOperator.AddParameter("@iDeparture", condition.Departure.Trim()); } if (!string.IsNullOrWhiteSpace(condition.Arrival)) { dbOperator.AddParameter("@iArrival", condition.Arrival.Trim()); } if (!string.IsNullOrWhiteSpace(condition.BunkCode)) { dbOperator.AddParameter("@iBunkCode", condition.BunkCode.Trim()); } if (condition.BunkType.HasValue) { dbOperator.AddParameter("@iBunkType", (int)condition.BunkType); } if (condition.VoyageType.HasValue) { dbOperator.AddParameter("@iVoyageType", (byte)condition.VoyageType); } if (condition.FlightBeginDate.HasValue) { dbOperator.AddParameter("@iFlightBeginDate", condition.FlightBeginDate.Value.Date); } if (condition.FlightEndDate.HasValue) { dbOperator.AddParameter("@iFlightEndDate", condition.FlightEndDate.Value.Date); } if (condition.Status.HasValue) { dbOperator.AddParameter("@iStatus", condition.Status); } if (pagination != null) { dbOperator.AddParameter("@iPageSize", pagination.PageSize); dbOperator.AddParameter("@iPageIndex", pagination.PageIndex); } System.Data.Common.DbParameter totalCount = dbOperator.AddParameter("@oTotalCount"); totalCount.DbType = System.Data.DbType.Int32; totalCount.Direction = System.Data.ParameterDirection.Output; using (System.Data.Common.DbDataReader reader = dbOperator.ExecuteReader("dbo.P_QueryBunks", System.Data.CommandType.StoredProcedure)) { Guid?previousId = null; Bunk bunk = null; while (reader.Read()) { var currentId = reader.GetGuid(1); if (bunk == null || previousId.Value != currentId) { bunk = null; } var bunkType = (BunkType)reader.GetInt32(0); switch (bunkType) { case BunkType.Economic: bunk = loadEconomicBunk(bunk, reader); break; case BunkType.FirstOrBusiness: bunk = loadFirstBusinessBunk(bunk, reader); break; case BunkType.Promotion: bunk = loadPromotionBunk(bunk, reader); break; case BunkType.Production: bunk = loadProductionBunk(bunk, reader); break; case BunkType.Transfer: bunk = loadTransferBunk(bunk, reader); break; case BunkType.Free: bunk = loadFreeBunk(bunk, reader); break; case BunkType.Team: bunk = loadTeamBunk(bunk, reader); break; } bunk.VoyageType = (VoyageTypeValue)reader.GetByte(19); bunk.TravelType = (TravelTypeValue)reader.GetByte(20); bunk.PassengerType = (PassengerTypeValue)reader.GetByte(21); bunk.RefundRegulation = reader.IsDBNull(8) ? string.Empty : reader.GetString(8); bunk.ChangeRegulation = reader.IsDBNull(16) ? string.Empty : reader.GetString(16); bunk.EndorseRegulation = reader.IsDBNull(17) ? string.Empty : reader.GetString(17); bunk.Remarks = reader.IsDBNull(18) ? string.Empty : reader.GetString(18); if (!previousId.HasValue || previousId.Value != currentId) { result.Add(bunk); previousId = currentId; } } } if (pagination.GetRowCount) { pagination.RowCount = (int)totalCount.Value; } } return(result); }