Exemple #1
0
 public List <ExamSubTypeDTO> getExamSubTypeList()
 {
     using (IDbSvc dbSvc = new DbSvc(_configSvc))
     {
         try
         {
             dbSvc.OpenConnection();
             MySqlCommand command = new MySqlCommand();
             command.CommandText = "select ExamSubTypeId, ExamSubTypeDescription from examsubtype where Active=1";
             command.Connection  = dbSvc.GetConnection() as MySqlConnection;
             _dtData             = new DataTable();
             MySqlDataAdapter msDa = new MySqlDataAdapter(command);
             msDa.Fill(_dtData);
             List <ExamSubTypeDTO> lstexamsubType = new List <ExamSubTypeDTO>();
             if (_dtData != null && _dtData.Rows.Count > 0)
             {
                 ExamSubTypeDTO examsubType = null;
                 foreach (DataRow dr in _dtData.Rows)
                 {
                     examsubType = new ExamSubTypeDTO();
                     examsubType.ExamSubTypeId          = (int)dr["ExamSubTypeId"];
                     examsubType.ExamSubTypeDescription = dr["ExamSubTypeDescription"].ToString();
                     lstexamsubType.Add(examsubType);
                 }
             }
             return(lstexamsubType);
         }
         catch (Exception exp)
         {
             throw exp;
         }
     }
 }
        public SelectList getExamSubTypeDropDown(int?examType = null)
        {
            List <ExamSubTypeDTO> rDto           = _ddlRepo.getExamSubType(examType);
            ExamSubTypeDTO        examSubtypeDTO = new ExamSubTypeDTO();

            examSubtypeDTO.ExamSubTypeId          = -1;
            examSubtypeDTO.ExamSubTypeDescription = "";

            rDto.Insert(0, examSubtypeDTO);

            return(new SelectList(rDto, "ExamSubTypeId", "ExamSubTypeDescription"));
        }