public SystemEntity GetBySysName(string sysName)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT s.* from Systems s ");
            strSql.Append("WHERE s.SystemName=@SystemName");

            SystemEntity systemEntity = null;
            Database     db           = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    db.AddInParameter(dbCommand, "SystemName", DbType.String, sysName);

                    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                    {
                        if (dataReader.Read())
                        {
                            systemEntity = SystemEntity.ReaderBind(dataReader);
                        }
                    }
                }

                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]",
                                                    strSql.ToString(),
                                                    base.FormatParameters(dbCommand.Parameters),
                                                    ex.Message));
                }
            }
            return(systemEntity);
        }
        public List <SystemEntity> GetAllSystems()
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * from Systems");

            List <SystemEntity> list = new List <SystemEntity>();
            Database            db   = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                    {
                        while (dataReader.Read())
                        {
                            list.Add(SystemEntity.ReaderBind(dataReader));
                        }
                    }
                }

                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]",
                                                    strSql.ToString(),
                                                    base.FormatParameters(dbCommand.Parameters),
                                                    ex.Message));
                }
            }
            return(list);
        }