public InsuranceFund GetInsuranceFundByID(int InsuranceFundID) { using (var connection = new OleDbConnection(ConfigManagement.AccessConStr)) { string sqlText = string.Format(@"select InsuranceFundID, PeopleID, InsuranceFundType, Number, PaymentAddress, PaymentStartDate, PaymentEndDate, BasicNum from {0} where InsuranceFundID=@InsuranceFundID", _InsuranceFundTableName); var paras = new OleDbParameter[1]; paras[0] = new OleDbParameter("InsuranceFundID", InsuranceFundID); var reader = new OLESqlHelper().GetReader(sqlText, connection, paras); if (reader.Read()) { int i = 0; var InsuranceFund = new InsuranceFund(); InsuranceFund.InsuranceFundID = reader.GetInt32(i++); InsuranceFund.PeopleID = reader.GetInt32(i++); InsuranceFund.InsuranceFundType = (int)reader.GetInt32(i++); InsuranceFund.Number = reader.GetString(i++); InsuranceFund.PaymentAddress = reader.GetString(i++); InsuranceFund.PaymentStartDate = reader.IsDBNull(i) ? new Nullable<DateTime>() : reader.GetDateTime(i++); InsuranceFund.PaymentEndDate = reader.IsDBNull(i) ? new Nullable<DateTime>() : reader.GetDateTime(i++); InsuranceFund.BasicNum = reader.GetFloat(i++); return InsuranceFund; } else { return null; } } }
public TitleWageChangeRecord GetTitleWageChangeRecordByID(int TitleWageChangeRecordID) { using (var connection = new OleDbConnection(ConfigManagement.AccessConStr)) { string sqlText = string.Format(@"select TitleWageChangeRecordID, PeopleID, ChangeDate, ChangeType, ContractNum, BeforeChangeTitle, BeforeChangeBasicWage, BeforeChangeAllowance, BeforeChangeYearAward, AfterChangeTitle, AfterChangeBasicWage, AfterChangeAllowance, AfterChangeYearAward from {0} where TitleWageChangeRecordID=@TitleWageChangeRecordID", _TitleWageChangeRecordTableName); var paras = new OleDbParameter[1]; paras[0] = new OleDbParameter("TitleWageChangeRecordID", TitleWageChangeRecordID); var reader = new OLESqlHelper().GetReader(sqlText, connection, paras); if (reader.Read()) { int i = 0; var TitleWageChangeRecord = new TitleWageChangeRecord(); TitleWageChangeRecord.TitleWageChangeRecordID = reader.GetInt32(i++); TitleWageChangeRecord.PeopleID = reader.GetInt32(i++); TitleWageChangeRecord.ChangeDate = reader.IsDBNull(i) ? new Nullable<DateTime>() : reader.GetDateTime(i++); TitleWageChangeRecord.ChangeType = reader.GetInt32(i++); TitleWageChangeRecord.ContractNum = reader.GetString(i++); TitleWageChangeRecord.BeforeChangeTitle = reader.GetString(i++); TitleWageChangeRecord.BeforeChangeBasicWage = reader.GetFloat(i++); TitleWageChangeRecord.BeforeChangeAllowance = reader.GetFloat(i++); TitleWageChangeRecord.BeforeChangeYearAward = reader.GetFloat(i++); TitleWageChangeRecord.AfterChangeTitle = reader.GetString(i++); TitleWageChangeRecord.AfterChangeBasicWage = reader.GetFloat(i++); TitleWageChangeRecord.AfterChangeAllowance = reader.GetFloat(i++); TitleWageChangeRecord.AfterChangeYearAward = reader.GetFloat(i++); return TitleWageChangeRecord; } else { return null; } } }
public PeopleBasicInfo GetPeopleWorkInfoByID(int peopleID) { using (var connection = new OleDbConnection(ConfigManagement.AccessConStr)) { string sqlText = string.Format(@"select PeopleID,JoinCompanyDate,LengthOfService,Department,Title,TitleState, LeftCompanyDate,LeftCompanyReason,SpecialSkill,WageCardNumber,WageCardAddress, IsCallInArchives,ArchivesNum,ArchiveCallInDate,ArchiveCallOutDate from {0} where PeopleID=@peopleID", _peopleTableName); var paras = new OleDbParameter[1]; paras[0] = new OleDbParameter("peopleID", peopleID); var reader = new OLESqlHelper().GetReader(sqlText, connection, paras); if (reader.Read()) { int i = 0; var people = new PeopleBasicInfo(); people.PeopleID = reader.GetInt32(i++); if (!reader.IsDBNull(i)) { people.JoinCompanyDate = reader.GetDateTime(i++); } else { i++; } people.LengthOfService = reader.GetFloat(i++); people.Department = reader.IsDBNull(i) ? "" : reader.GetString(i++); people.Title = reader.IsDBNull(i) ? "" : reader.GetString(i++); people.TitleState = reader.IsDBNull(i) ? "" : reader.GetString(i++); people.LeftCompanyDate = reader.IsDBNull(i) ? new Nullable<DateTime>() : reader.GetDateTime(i++); people.LeftCompanyReason = reader.IsDBNull(i) ? "" : reader.GetString(i++); people.SpecialSkill = reader.IsDBNull(i) ? "" : reader.GetString(i++); people.WageCardNumber = reader.IsDBNull(i) ? "" : reader.GetString(i++); people.WageCardAddress = reader.IsDBNull(i) ? "" : reader.GetString(i++); people.IsCallInArchives = reader.IsDBNull(i) ? false : reader.GetBoolean(i++); people.ArchivesNum = reader.IsDBNull(i) ? "" : reader.GetString(i++); people.ArchiveCallInDate = reader.IsDBNull(i) ? new Nullable<DateTime>() : reader.GetDateTime(i++); people.ArchiveCallOutDate = reader.IsDBNull(i) ? new Nullable<DateTime>() : reader.GetDateTime(i++); return people; } else { return null; } } }