コード例 #1
0
 public static Staff.BLDAL.DTO.Staff Staff_Select(Staff.BLDAL.DTO.Staff _StaffLine)
 {
     Staff.BLDAL.DTO.Staff StaffLine = new Staff.BLDAL.DTO.Staff();
     try
     {
         StaffDAL      IO       = new StaffDAL();
         SqlDataReader myReader = IO.Staff_Select(_StaffLine);
         while (myReader.Read())
         {
             if (myReader["StaffID"] != DBNull.Value)
             {
                 StaffLine.StaffID = (int)myReader["StaffID"];
             }
             if (myReader["LastName"] != DBNull.Value)
             {
                 StaffLine.LastName = (string)myReader["LastName"];
             }
             if (myReader["MiddleName"] != DBNull.Value)
             {
                 StaffLine.MiddleName = (string)myReader["MiddleName"];
             }
             if (myReader["FirstName"] != DBNull.Value)
             {
                 StaffLine.FirstName = (string)myReader["FirstName"];
             }
             if (myReader["Gender"] != DBNull.Value)
             {
                 StaffLine.Gender = (string)myReader["Gender"];
             }
             if (myReader["Position"] != DBNull.Value)
             {
                 StaffLine.Position = (string)myReader["Position"];
             }
             if (myReader["HiredDate"] != DBNull.Value)
             {
                 StaffLine.HiredDate = (string)myReader["HiredDate"];
             }
             if (myReader["Salary"] != DBNull.Value)
             {
                 StaffLine.Salary = (string)myReader["Salary"];
             }
         }
         myReader.Close();
     }
     catch (Exception ex)
     {
         if (ConfigurationManager.AppSettings["RethrowErrors"] == "true")
         {
             throw ex;
         }
         return(new Staff.BLDAL.DTO.Staff());
     }
     return(StaffLine);
 }