Beispiel #1
0
 public List<YearTermModel> GetAllYearTermIdBysessionId(int sessionId)
 {
     List<YearTermModel> yearTermModels = new List<YearTermModel>();
     string query = String.Format(@"select yearTermId from tblStudentSemisterRegistration where sessionId=@sessionId");
     using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString))
     {
         using (SqlCommand command = new SqlCommand(query, connection))
         {
             command.Parameters.Clear();
             command.Parameters.AddWithValue("@sessionId",sessionId);
             connection.Open();
             SqlDataReader rdr = command.ExecuteReader();
             while (rdr.Read())
             {
                 YearTermModel yearTermModel = new YearTermModel();
                 yearTermModel.ID = Convert.ToInt32(rdr[0]);
                 yearTermModels.Add(yearTermModel);
             }
             connection.Close();
         }
     }
     return yearTermModels;
 }
Beispiel #2
0
        public List<YearTermModel> GetAllYearTerm()
        {
            List<YearTermModel> yearTermModels = new List<YearTermModel>();
            string query = String.Format("spGetAllYearTerm");

            using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString))
            {
                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    connection.Open();
                    SqlDataReader rdr = command.ExecuteReader();
                    while (rdr.Read())
                    {
                        YearTermModel yearTermModel = new YearTermModel();
                        yearTermModel.ID = Convert.ToInt32(rdr[0]);
                        yearTermModel.YearTerm = rdr[1].ToString();
                        yearTermModels.Add(yearTermModel);
                    }
                    connection.Close();
                }
            }
            return yearTermModels;
        }
Beispiel #3
0
 public List<YearTermModel> GetAllYearTermByYearTermId(List<YearTermModel> yearTermModelsParameter)
 {
     List<YearTermModel> yearTermModels = new List<YearTermModel>();
     string query = String.Format(@"select * from tblYearTerm where id=@yearTermId");
     foreach (YearTermModel yearTerm in yearTermModelsParameter)
     {
         using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString))
         {
             using (SqlCommand command = new SqlCommand(query, connection))
             {
                 command.Parameters.Clear();
                 command.Parameters.AddWithValue("@yearTermId", yearTerm.ID);
                 connection.Open();
                 SqlDataReader rdr = command.ExecuteReader();
                 while (rdr.Read())
                 {
                     YearTermModel yearTermModel = new YearTermModel();
                     yearTermModel.ID = Convert.ToInt32(rdr[0]);
                     yearTermModel.YearTerm = rdr[1].ToString();
                     yearTermModels.Add(yearTermModel);
                 }
                 connection.Close();
             }
         }
     }
     return yearTermModels;
 }