public static FinancialSupportRequest RowToFinancialSupportRequest(IEnumerable <DataRow> rows) { DataRow row = rows.FirstOrDefault(); FinancialSupportRequests financialSupportRequests = new FinancialSupportRequests(); return(new FinancialSupportRequest() { ApprovedAmount = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.ApprovedAmount.FullName), branch = new Branch() { Id = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.BranchId.FullName) }, Id = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.Id.FullName), CurrentStatus = DataRowHelper.GetValue <RequestStatus>(row, Tables.FinancialSupportRequest.CurrentStatusId.FullName), Date = DataRowHelper.GetValue <DateTime>(row, Tables.FinancialSupportRequest.Date.FullName), Details = DataRowHelper.GetValue <string>(row, Tables.FinancialSupportRequest.Details.FullName), DigitalSignature = DataRowHelper.GetValue <Byte[]>(row, Tables.FinancialSupportRequest.DigitalSignature.FullName), IsApproved = DataRowHelper.GetValue <bool>(row, Tables.FinancialSupportRequest.IsApproved.FullName), Iscanceled = DataRowHelper.GetValue <bool>(row, Tables.FinancialSupportRequest.IsCanceled.FullName), NumberOfMonthsApproved = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.NumberOfMonthsApproved.FullName), Student = new Student() { Id = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.StudentId.FullName), } }); }
private IList <CharacterAttackOrSpellcast5e> GetAttacksAndSpellcasts(int characterId) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@CharacterId", characterId) }; using (CustomDataAdapter adapter = new CustomDataAdapter("GetCharacterAttacksAndSpellcasts5e", CommandType.StoredProcedure, parameters)) { DataTable table = new DataTable(); adapter.Fill(table); return(DataRowHelper.CreateListFromTable <CharacterAttackOrSpellcast5e>(table)); //foreach(DataRow row in table.Rows) //{ // attacksAndSpellcasts.Add(new CharacterAttackOrSpellcast5e // { // Name = row["Name"] as String, // AttackBonus = Convert.ToInt32(row["AttackBonus"]), // Damage = row["Damage"] as String, // DamageType = row["DamageType"] as String, // Notes = row["Notes"] as String, // }); //} } }
private static Common.Models.Office.Office GetOffice(DataRow row) { Common.Models.Office.Office office = new Common.Models.Office.Office(); office.OfficeId = Conversion.TryCastInteger(DataRowHelper.GetColumnValue(row, "office_id")); office.OfficeCode = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "office_code")); office.OfficeName = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "office_name")); office.Nickname = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "nick_name")); office.RegistrationDate = Conversion.TryCastDate(DataRowHelper.GetColumnValue(row, "registration_date")); office.CurrencyCode = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "currency_code")); office.AddressLine1 = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "address_line_1")); office.AddressLine2 = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "address_line_2")); office.Street = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "street")); office.City = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "city")); office.State = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "state")); office.ZipCode = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "zip_code")); office.Country = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "country")); office.Phone = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "phone")); office.Fax = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "fax")); office.Email = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "email")); office.Url = new Uri(Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "url")), UriKind.RelativeOrAbsolute); office.RegistrationNumber = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "registration_number")); office.PanNumber = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "pan_number")); office.ParentOfficeId = Conversion.TryCastInteger(DataRowHelper.GetColumnValue(row, "parent_office_id")); office.ParentOffice = GetOffice(office.ParentOfficeId); return(office); }
private IList <CharacterAllyOrOrganization5e> GetAlliesAndOrganizations(int characterId) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@CharacterId", characterId) }; using (CustomDataAdapter adapter = new CustomDataAdapter("GetCharacterAlliesAndOrganizations5e", CommandType.StoredProcedure, parameters)) { DataTable table = new DataTable(); adapter.Fill(table); List <CharacterAllyOrOrganization5e> alliesAndOrganizations = new List <CharacterAllyOrOrganization5e>(); foreach (DataRow row in table.Rows) { CharacterAllyOrOrganization5e allyOrOrganization = DataRowHelper.CreateItemFromRow <CharacterAllyOrOrganization5e>(row); allyOrOrganization.ImageKey = row["ImageKey"].ToNullableGuid(); alliesAndOrganizations.Add(allyOrOrganization); } return(alliesAndOrganizations); } }
public static LoanSupportRequest RowToLoan(IEnumerable <DataRow> rows) { DataRow row = rows.FirstOrDefault(); return(new LoanSupportRequest() { AmountRepaymentMonthly = DataRowHelper.GetValue <int>(row, Tables.LoanSupportRequest.AmountRepaymentMonthly.Name), AmountRequested = DataRowHelper.GetValue <int>(row, Tables.LoanSupportRequest.AmountRequested.Name), ApprovedAmount = DataRowHelper.GetValue <decimal>(row, Tables.LoanSupportRequest.ApprovedAmount.Name), branch = new Branch() { Id = DataRowHelper.GetValue <int>(row, Tables.LoanSupportRequest.BranchId.Name) }, CurrentStatus = DataRowHelper.GetValue <RequestStatus>(row, Tables.LoanSupportRequest.CurrentStatusId.Name), Date = DataRowHelper.GetValue <DateTime>(row, Tables.LoanSupportRequest.Date.Name), DateReturningEntireAmount = DataRowHelper.GetValue <DateTime>(row, Tables.LoanSupportRequest.DateReturningEntireAmount.Name), Details = DataRowHelper.GetValue <string>(row, Tables.LoanSupportRequest.Details.Name), DigitalSignature = DataRowHelper.GetValue <byte[]>(row, Tables.LoanSupportRequest.DigitalSignature.Name), Id = DataRowHelper.GetValue <int>(row, Tables.LoanSupportRequest.Id.Name), IsApproved = DataRowHelper.GetValue <bool?>(row, Tables.LoanSupportRequest.IsApproved.Name), Iscanceled = DataRowHelper.GetValue <bool?>(row, Tables.LoanSupportRequest.IsCanceled.Name), IsDisapprovedClosedRequest = DataRowHelper.GetValue <bool>(row, Tables.LoanSupportRequest.IsDisapprovedClosedRequest.Name), NumberApprovedMonths = DataRowHelper.GetValue <int>(row, Tables.LoanSupportRequest.NumberApprovedMonths.Name), ReasonIsApproved = DataRowHelper.GetValue <string>(row, Tables.LoanSupportRequest.ReasonIsApproved.Name), Student = new Student() { Id = DataRowHelper.GetValue <int>(row, Tables.LoanSupportRequest.StudentId.Name) }, }); }
public static int GetOpinionListCount(string searchText) { var db = DB.GetDB(); QParamCollection paramCollection = new QParamCollection(); string searchQuery = ""; if (!string.IsNullOrEmpty(searchText)) { //надо делить на слова string[] words = searchText.Split(' '); StringBuilder searchSelect = new StringBuilder(); int wordIndex = 0; searchSelect.Append("AND ("); foreach (var word in words) { if (wordIndex > 0) { searchSelect.Append(" OR "); } searchSelect.AppendFormat("like_text ilike @st{0} OR dislike_text ilike @st{0}", wordIndex); paramCollection.AddParam("st" + wordIndex, DbType.String, "%" + word + "%"); wordIndex++; } searchSelect.Append(")"); searchQuery = searchSelect.ToString(); } var cmd = db.GetCommand(string.Format(@"SELECT COUNT(o.id) FROM bookmedica.opinion o LEFT JOIN bookmedica.doctor d ON d.id=o.on_id AND o.class_id={0} WHERE o.moderation={1} AND d.moderation={1} {2}", Values.DOCTOR_CLASS_ID, Values.MODERATION_STATUS_OK, searchQuery)); db.AddInParameters(cmd, paramCollection.ParamList); DataRow data = executeDataRow(cmd); return(DataRowHelper.GetIntValue(data, "count")); }
public static SignInView GetSignInView(DataRow row) { SignInView view = new SignInView(); view.UserId = Conversion.TryCastInteger(DataRowHelper.GetColumnValue(row, "user_id")); view.Role = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "role")); view.IsAdmin = Conversion.TryCastBoolean(DataRowHelper.GetColumnValue(row, "is_admin")); view.IsSystem = Conversion.TryCastBoolean(DataRowHelper.GetColumnValue(row, "is_system")); view.UserName = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "user_name")); view.FullName = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "full_name")); view.LogOnId = Conversion.TryCastInteger(DataRowHelper.GetColumnValue(row, "login_id")); view.OfficeId = Conversion.TryCastInteger(DataRowHelper.GetColumnValue(row, "office_id")); view.Culture = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "culture")); view.Office = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "office")); view.OfficeCode = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "office_code")); view.OfficeName = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "office_name")); view.Nickname = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "nick_name")); view.RegistrationDate = Conversion.TryCastDate(DataRowHelper.GetColumnValue(row, "registration_date")); view.RegistrationNumber = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "registration_number")); view.PanNumber = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "pan_number")); view.AddressLine1 = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "address_line_1")); view.AddressLine2 = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "address_line_2")); view.Street = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "street")); view.City = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "city")); view.State = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "state")); view.ZipCode = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "zip_code")); view.Country = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "country")); view.Phone = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "phone")); view.Fax = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "fax")); view.Email = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "email")); view.Url = new Uri(Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "url")), UriKind.RelativeOrAbsolute); return(view); }
/// <summary> /// Кол-во не проверенных специализаций /// </summary> /// <returns></returns> internal static int GetNotModerationSpecializationCount() { var cmd = db.GetCommand(string.Format("SELECT COUNT(id) FROM bookmedica.valueset WHERE moderation IN ({0},{1}) AND type=1;", Values.MODERATION_STATUS_NEW, Values.MODERATION_STATUS_EDIT)); DataRow data = executeDataRow(cmd); return(DataRowHelper.GetIntValue(data, "count")); }
public static Institution RowToInstitution(DataRow row) { return(new Institution() { Id = DataRowHelper.GetValue <int>(row, Tables.Institutions.Id.FullName), Name = DataRowHelper.GetValue <string>(row, Tables.Institutions.Name.FullName), }); }
public static Country RowToCountry(DataRow row) { return(new Country() { Id = DataRowHelper.GetValue <int>(row, Tables.Countries.Id.FullName), Name = DataRowHelper.GetValue <string>(row, Tables.Countries.Name.FullName) }); }
public static Scolarship RowToScolarship(DataRow row) { return(new Scolarship() { Id = DataRowHelper.GetValue <int>(row, Tables.Scolarships.Id.Name), Amount = DataRowHelper.GetValue <decimal>(row, Tables.Scolarships.Amount.Name) }); }
public static BranchType RowToBranchType(DataRow row) { return(new BranchType() { Id = DataRowHelper.GetValue <int>(row, Tables.BranchTypes.Id.FullName), Name = DataRowHelper.GetValue <string>(row, Tables.BranchTypes.Name.FullName), Type = DataRowHelper.GetValue <string>(row, Tables.BranchTypes.Type.FullName), }); }
public TFormula(DataRow dataRow) : this() { this.Id = DataRowHelper.GetValue <int>(dataRow, "Id"); this.PId = DataRowHelper.GetValue <int>(dataRow, "PId"); this.StrId = DataRowHelper.GetValue(dataRow, "StrId"); this.FormulaName = DataRowHelper.GetValue(dataRow, "FormulaName"); this.ScriptContent = DataRowHelper.GetValue(dataRow, "ScriptContent"); }
public Doctor(DataRow data) { Name = DataRowHelper.GetTextValue(data, "name"); Surname = DataRowHelper.GetTextValue(data, "surname"); Patronymic = DataRowHelper.GetTextValue(data, "patronymic"); FullName = DataRowHelper.GetTextValue(data, "full_name"); Photo = DataRowHelper.GetTextValue(data, "photo"); Specialization = DataRowHelper.GetTextValue(data, "specialization"); SpecializationList = DataRowHelper.GetTextValue(data, "specialization_list"); Position = DataRowHelper.GetTextValue(data, "position"); AcademicDegree = DataRowHelper.GetTextValue(data, "academic_degree"); Category = DataRowHelper.GetTextValue(data, "category"); Clinic = DataRowHelper.GetTextValue(data, "clinic"); ClinicList = DataRowHelper.GetTextValue(data, "clinic_list"); SpecializationText = DataRowHelper.GetTextValue(data, "specialization_text"); Description = DataRowHelper.GetTextValue(data, "description"); //сначала пробую поле doctor_id ID = DataRowHelper.GetIntValue(data, "doctor_id"); if (ID == 0) { ID = DataRowHelper.GetIntValue(data, "id"); } PositionID = DataRowHelper.GetIntValue(data, "position_id"); AcademicDegreeID = DataRowHelper.GetIntValue(data, "academic_degree_id"); CategoryID = DataRowHelper.GetIntValue(data, "category_id"); WorkExperience = DataRowHelper.GetIntValue(data, "work_experience"); RatingCount = DataRowHelper.GetIntValue(data, "rating_count"); ReviewCount = DataRowHelper.GetIntValue(data, "review_count"); Rating = DataRowHelper.GetDecimalValue(data, "rating"); Price = DataRowHelper.GetIntValue(data, "price"); CityID = DataRowHelper.GetIntValue(data, "city_id"); UserID = DataRowHelper.GetIntValue(data, "user_id"); OwnerID = DataRowHelper.GetIntValue(data, "owner_id"); FlowerBouquetCount = DataRowHelper.GetIntValue(data, "flower_bouquet_count"); RecomendationCount = DataRowHelper.GetIntValue(data, "recomendation_count"); Email = DataRowHelper.GetTextValue(data, "email"); Site = DataRowHelper.GetTextValue(data, "site"); Skype = DataRowHelper.GetTextValue(data, "skype"); CreateDate = DataRowHelper.GetDateTimeValue(data, "create_date"); Moderation = DataRowHelper.GetIntValue(data, "moderation"); SkipModeration = DataRowHelper.GetIntValue(data, "skip_moderation"); //Source = ("BookMedica.ru, "+DataRowHelper.GetTextValue(data, "source")).Trim().TrimEnd(','); Source = DataRowHelper.GetTextValue(data, "source"); }
public static AttendanceRules RowToAttendanceRules(DataRow row) { return(new AttendanceRules() { Branch = null, Id = DataRowHelper.GetValue <int>(row, Tables.AttendanceRules.Id.FullName), MaximumAbsences = DataRowHelper.GetValue <int>(row, Tables.AttendanceRules.MaximumAbsences.FullName), MaximumLateness = DataRowHelper.GetValue <int>(row, Tables.AttendanceRules.MaximumLateness.FullName) }); }
internal static Bank RowToBank(DataRow row) { return(new Bank() { Id = DataRowHelper.GetValue <int>(row, Tables.Banks.Id.FullName), BankNumber = DataRowHelper.GetValue <string>(row, Tables.Banks.BankNumber.FullName), Name = DataRowHelper.GetValue <string>(row, Tables.Banks.Name.FullName), BranchNumber = DataRowHelper.GetValue <string>(row, Tables.Banks.BranchNumber.FullName), //Address = new Address() { Id = DataRowHelper.GetValue<int>(row, Tables.Banks.AddressId.FullName) } }); }
public static ExamRules RowToExamRules(DataRow row) { return(new ExamRules() { Id = DataRowHelper.GetValue <int>(row, Tables.ExamsRules.Id.FullName), Branch = null, ExamsPeriod = DataRowHelper.GetValue <string>(row, Tables.ExamsRules.ExamsPeriod.FullName), ExamsPerPeriod = DataRowHelper.GetValue <int>(row, Tables.ExamsRules.ExamsPerPeriod.FullName), IsRequiredExams = DataRowHelper.GetValue <bool>(row, Tables.ExamsRules.IsRequiredExams.FullName) }); }
public static Street RowToStreet(DataRow row) { return(new Street() { Id = DataRowHelper.GetValue <int>(row, Tables.Streets.Id.FullName), Name = DataRowHelper.GetValue <string>(row, Tables.Streets.Name.FullName), City = new City() { Id = DataRowHelper.GetValue <int>(row, Tables.Streets.CityId.FullName) } }); }
public static StudentPayments TableToStudentPayments(DataTable table) { if (table == null) { return(null); } StudentPayments studentPayments = new StudentPayments(); var studentPaymentList = table.AsEnumerable().GroupBy(row => DataRowHelper.GetValue <int>(row, Tables.StudentPayment.Id.Name), (key, group) => RowToStudentPayment(group)); studentPayments.AddRange(studentPaymentList.ToList()); return(studentPayments); }
public static LoanSupportRequests TableToLoan(DataTable table) { if (table == null) { return(null); } LoanSupportRequests loans = new LoanSupportRequests(); var loanList = table.AsEnumerable().GroupBy(row => DataRowHelper.GetValue <int>(row, Tables.LoanSupportRequest.Id.Name), (key, group) => RowToLoan(group)); loans.AddRange(loanList.ToList()); return(loans); }
public static FinancialSupportRequests TableToFinancialSupport(DataTable table) { if (table == null) { return(null); } FinancialSupportRequests financialSupports = new FinancialSupportRequests(); var studentList = table.AsEnumerable().GroupBy(row => DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.Id.FullName), (key, group) => RowToFinancialSupportRequest(group)); financialSupports.AddRange(studentList.ToList()); return(financialSupports); }
public static Branches TableToBranch(DataTable table, Branch.Includes includes) { if (table == null) { return(null); } Branches branches = new Branches(); var branchList = table.AsEnumerable().GroupBy(row => DataRowHelper.GetValue <int>(row, Tables.Branches.Id.FullName), (key, group) => RowToBranch(group, includes)); branches.AddRange(branchList.ToList()); return(branches); }
public Clinic(System.Data.DataRow data) { _data = data; ID = DataRowHelper.GetIntValue(data, "id"); Name = DataRowHelper.GetTextValue(data, "name"); Address = DataRowHelper.GetTextValue(data, "address"); //формирую список телефонов PhoneList = Utils.GetPhoneList(DataRowHelper.GetTextValue(data, "phone")); if (PhoneList.Count > 0) { Phone = PhoneList[0]; } Email = DataRowHelper.GetTextValue(data, "email"); Site = DataRowHelper.GetTextValue(data, "site"); AdvertisementDescription = DataRowHelper.GetTextValue(data, "advertisement_description"); Description = DataRowHelper.GetTextValue(data, "description"); PropertyID = DataRowHelper.GetIntValue(data, "type_property_id"); Property = DataRowHelper.GetTextValue(data, "type_property"); TypeID = DataRowHelper.GetIntValue(data, "type_id"); Type = DataRowHelper.GetTextValue(data, "type"); TreatmentTypeID = DataRowHelper.GetIntValue(data, "treatment_type_id"); TreatmentType = DataRowHelper.GetTextValue(data, "treatment_type"); Services = DataRowHelper.GetTextValue(data, "services"); Photo = DataRowHelper.GetTextValue(data, "photo"); Logo = DataRowHelper.GetTextValue(data, "logo"); Skype = DataRowHelper.GetTextValue(data, "skype"); RatingCount = DataRowHelper.GetIntValue(data, "rating_count"); ReviewCount = DataRowHelper.GetIntValue(data, "review_count"); Rating = DataRowHelper.GetDecimalValue(data, "rating"); CityID = DataRowHelper.GetIntValue(data, "city_id"); UserID = DataRowHelper.GetIntValue(data, "user_id"); OwnerID = DataRowHelper.GetIntValue(data, "owner_id"); Latitude = DataRowHelper.GetDecimalValue(data, "latitude"); Longitude = DataRowHelper.GetDecimalValue(data, "longitude"); Distance = DataRowHelper.GetDecimalValue(data, "distance"); DoctorCount = DataRowHelper.GetIntValue(data, "doctor_count"); CreateDate = DataRowHelper.GetDateTimeValue(data, "create_date"); Moderation = DataRowHelper.GetIntValue(data, "moderation"); SkipModeration = DataRowHelper.GetIntValue(data, "skip_moderation"); WorkTime = DataRowHelper.GetTextValue(data, "work_time"); }
public static Address RowToAddress(DataRow row) { return(new Address() { Id = DataRowHelper.GetValue <int>(row, Tables.Address.Id.FullName), Country = CountryConverter.RowToCountry(row), City = CityConverter.RowToCity(row), NeighborhoodName = DataRowHelper.GetValue <string>(row, Tables.Address.NeighborhoodName.FullName), Street = StreetConverter.RowToStreet(row), HouseNumber = DataRowHelper.GetValue <int>(row, Tables.Address.HouseNumber.FullName), ApartmentNumber = DataRowHelper.GetValue <int?>(row, Tables.Address.ApartmentNumber.FullName), ZipCode = DataRowHelper.GetValue <string>(row, Tables.Address.ZipCode.FullName) }); }
public static BranchDevice RowToBranchDevice(DataRow row) { return(new BranchDevice() { Device = new Device() { Id = DataRowHelper.GetValue <int>(row, Tables.BranchDevices.DeviceId.Name) }, Branch = new Branch() { Id = DataRowHelper.GetValue <int>(row, Tables.BranchDevices.BranchId.Name) }, }); }
private static CashRepository GetCashRepository(DataRow row) { CashRepository cashRepository = new CashRepository(); cashRepository.CashRepositoryId = Conversion.TryCastInteger(DataRowHelper.GetColumnValue(row, "cash_repository_id")); cashRepository.OfficeId = Conversion.TryCastInteger(DataRowHelper.GetColumnValue(row, "office_id")); cashRepository.Office = GetOffice(cashRepository.OfficeId); cashRepository.CashRepositoryCode = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "cash_repository_code")); cashRepository.CashRepositoryName = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "cash_repository_name")); cashRepository.ParentCashRepositoryId = Conversion.TryCastInteger(DataRowHelper.GetColumnValue(row, "parent_cash_repository_id")); cashRepository.ParentCashRepository = GetCashRepository(cashRepository.ParentCashRepositoryId); cashRepository.Description = Conversion.TryCastString(DataRowHelper.GetColumnValue(row, "description")); return(cashRepository); }
private IList <CharacterSpell5e> GetSpells(int characterId) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@CharacterId", characterId) }; using (CustomDataAdapter adapter = new CustomDataAdapter("GetCharacterSpells5e", CommandType.StoredProcedure, parameters)) { DataTable table = new DataTable(); adapter.Fill(table); return(DataRowHelper.CreateListFromTable <CharacterSpell5e>(table)); } }
public void DataRowsToJsonTest() { DataTable dt = new DataTable(); dt.Columns.Add("name"); dt.Columns.Add("age"); DataRow dr = dt.NewRow(); dr["name"] = "张三"; dr["age"] = "18"; dt.Rows.Add(dr); _ = DataRowHelper.DataRowsToJson(dt.Select()); Assert.IsTrue(true); }
//public static BranchActivityHours RowToBranchActivityHours(IEnumerable<DataRow> rows) //{ // DataRow row = rows.FirstOrDefault(); // return new BranchActivityHours() // { // Id = DataRowHelper.GetValue<int>(row, Tables.BranchActivityHours.Id.FullName), // Branch = null, // LateHour = DataRowHelper.GetValue<TimeSpan>(row, Tables.BranchActivityHours.LateHour.FullName), // EndStudyHours = DataRowHelper.GetValue<TimeSpan>(row, Tables.BranchActivityHours.EndStudyHours.FullName) // }; //} public static BranchActivityHours RowToBranchActivityHours(IEnumerable <DataRow> rows) { DataRow row = rows.FirstOrDefault(); return(new BranchActivityHours() { Id = DataRowHelper.GetValue <int>(row, Tables.BranchActivityHours.Id.Name), Branch = new Branch() { Id = DataRowHelper.GetValue <int>(row, Tables.BranchActivityHours.BranchId.Name) }, LateHour = DataRowHelper.GetValue <TimeSpan>(row, Tables.BranchActivityHours.LateHour.Name), EndStudyHours = DataRowHelper.GetValue <TimeSpan>(row, Tables.BranchActivityHours.EndStudyHours.Name), StartStudyHours = DataRowHelper.GetValue <TimeSpan>(row, Tables.BranchActivityHours.StartStudyHours.Name) }); }
public void Initialize() { this.Storage = StorageFactory <T, Cell <T> > .Create(this.Key, this.Config.Storage); this.NameSpace = Storage.NameSpace; this.DataSources = new DataSourceCollection(this.Config); this.Cells = new CellCollection <T>(this.Storage); this.Schema = new DataSchema <T>( this.Config, this.DataSources, this.Storage.Dimensions, this.Storage.Measures, this.Storage.Metrics); _rowHelper = new DataRowHelper <T>(this.Schema, this.Config.Source); Initialized = true; }