Example #1
0
        public IList<Core.Business.StaffTrainDetail> GetByStaffCode(string scode)
        {
            IList<Core.Business.StaffTrainDetail> staffTrainDetaillist = new List<Core.Business.StaffTrainDetail>();
            SqlServerUtility sql = new SqlServerUtility();
               // sql.AddParameter("@TrainCode", SqlDbType.NVarChar, staffTrainDetail.TrainCode);
            sql.AddParameter("@StaffCode", SqlDbType.NVarChar, scode);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetByStaffCode);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.StaffTrainDetail staffTrainDetail = new Core.Business.StaffTrainDetail();

                    if (!reader.IsDBNull(0)) staffTrainDetail.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) staffTrainDetail.TrainCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) staffTrainDetail.StaffCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) staffTrainDetail.ScoreInTheory = reader.GetDecimal(3);
                    if (!reader.IsDBNull(4)) staffTrainDetail.ScoreInPratise = reader.GetDecimal(4);

                    staffTrainDetail.MarkOld();
                    staffTrainDetaillist.Add(staffTrainDetail);
                }
                reader.Close();
            }
            return staffTrainDetaillist;
        }
Example #2
0
        public Core.Business.StaffTrainDetail GetByTrainAndStaff(string tcode, string scode)
        {
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@TrainCode", SqlDbType.NVarChar, tcode);
            sql.AddParameter("@StaffCode", SqlDbType.NVarChar, scode);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetByTrainAndStaff);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.StaffTrainDetail staffTrainDetail = new Core.Business.StaffTrainDetail();

                if (!reader.IsDBNull(0)) staffTrainDetail.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) staffTrainDetail.TrainCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) staffTrainDetail.StaffCode = reader.GetString(2);
                if (!reader.IsDBNull(3)) staffTrainDetail.ScoreInTheory = reader.GetDecimal(3);
                if (!reader.IsDBNull(4)) staffTrainDetail.ScoreInPratise = reader.GetDecimal(4);
                reader.Close();
                staffTrainDetail.MarkOld();
                return staffTrainDetail;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Example #3
0
        public Core.Business.StaffTrainDetail Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectStaffTrainDetail);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.StaffTrainDetail staffTrainDetail = new Core.Business.StaffTrainDetail();

                if (!reader.IsDBNull(0)) staffTrainDetail.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) staffTrainDetail.TrainCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) staffTrainDetail.StaffCode = reader.GetString(2);
                if (!reader.IsDBNull(3)) staffTrainDetail.ScoreInTheory = reader.GetDecimal(3);
                if (!reader.IsDBNull(4)) staffTrainDetail.ScoreInPratise = reader.GetDecimal(4);
                reader.Close();
                return staffTrainDetail;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }