public List <TestSetupModel> GetAllInfo()
        {
            string getQuery = "SELECT * FROM TestSetup JOIN TestTypeSetup " +
                              "ON TestSetup.testTypeSetupId = TestTypeSetup.testTypeId";

            Command = new SqlCommand(getQuery, Connection);

            Connection.Open();
            Reader = Command.ExecuteReader();
            int x = 0;
            List <TestSetupModel> lModel = new List <TestSetupModel>();

            while (Reader.Read())
            {
                TestSetupModel tsModel = new TestSetupModel();
                tsModel.TsId     = Convert.ToInt32(Reader["testId"]);
                tsModel.SerialNo = x + 1;
                tsModel.TsName   = Reader["testName"].ToString();
                tsModel.TsFee    = Convert.ToDouble(Reader["testFee"]);
                tsModel.TtsName  = Reader["testTypeName"].ToString();

                lModel.Add(tsModel);
                x++;
            }
            Reader.Close();
            Connection.Close();

            return(lModel);
        }
Пример #2
0
        public List <TestSetupModel> GetAllTestNames()
        {
            string testNamesQuery = "SELECT DISTINCT testName, testFee FROM TestSetup";

            Command = new SqlCommand(testNamesQuery, Connection);

            Connection.Open();
            Reader = Command.ExecuteReader();
            List <TestSetupModel> tsModel = new List <TestSetupModel>();

            while (Reader.Read())
            {
                TestSetupModel tsM = new TestSetupModel();
                tsM.TsName = Reader["testName"].ToString();
                tsM.TsFee  = Convert.ToDouble(Reader["testFee"]);

                tsModel.Add(tsM);
            }
            Reader.Close();
            Connection.Close();

            return(tsModel);
        }