コード例 #1
0
        private void mapFromDataReaderToObject(IDataReader reader, kpi_AchievementType achievementType)
        {
            if (reader != null)
            {
                //bool bol = DBNull.Value.Equals(reader["pc_Designation"]);
                //reader.Read();
                if (!Convert.IsDBNull(reader["ID"]))
                {
                    achievementType.ID = (int)reader["ID"];
                }

                if (!Convert.IsDBNull(reader["Name"]))
                {
                    achievementType.Name = reader["Name"].ToString();
                }

                if (!Convert.IsDBNull(reader["IsDisabled"]))
                {
                    achievementType.IsDisabled = (bool)reader["IsDisabled"];
                }

                if (!Convert.IsDBNull(reader["CreationDate"]))
                {
                    achievementType.CreationDate = DateTime.Parse(reader["CreationDate"].ToString());
                }

                if (!Convert.IsDBNull(reader["CreationUser"]))
                {
                    achievementType.CreationUser = reader["CreationUser"].ToString();
                }

                if (!Convert.IsDBNull(reader["ModificationUser"]))
                {
                    achievementType.ModificationUser = reader["ModificationUser"].ToString();
                }


                if (!Convert.IsDBNull(reader["ModificationDate"]))
                {
                    achievementType.ModificationDate = DateTime.Parse(reader["ModificationDate"].ToString());
                }

                if (!Convert.IsDBNull(reader["Rowversion"]))
                {
                    achievementType.RowVersion = (byte[])reader["RowVersion"];
                }

                //reader.Close();
            }
        }
コード例 #2
0
        public IEnumerable <kpi_Persist> fnSelect(short status)
        {
            List <kpi_AchievementType> mListe = new List <kpi_AchievementType>();

            db.definirProcedureStockee("kpi_AchievementType_Select");
            db.ajouterParametreEntree("@Status", 8, SqlDbType.SmallInt, status);

            IDataReader reader = db.executeReader();

            while (reader.Read())
            {
                kpi_AchievementType mClass = new kpi_AchievementType();

                mapFromDataReaderToObject(reader, mClass);

                mListe.Add(mClass);
            }
            reader.Close();
            return(mListe);
        }