public static List <Course> GetUserContentModule(CurriculumGeneral Curriculum)
 {
     try
     {
         Course            objContentModule;
         List <Course>     lstContentModule = new List <Course>();
         DbProviderFactory fact             = DbProviderFactories.GetFactory("System.Data.SqlClient");
         //string LearnerID = "";
         using (DbConnection conn = Config.GetConnection())
         {
             DbCommand cmd = fact.CreateCommand();
             cmd.CommandTimeout = 0;
             cmd.Connection     = conn;
             cmd.CommandText    = "GetUserContentModule";
             cmd.Parameters.Add(Config.GetParameter(fact, "@LearnerId", Curriculum.LearnerId));
             cmd.Parameters.Add(Config.GetParameter(fact, "@CurriculumId", Curriculum.CurriculumId));
             cmd.CommandType = CommandType.StoredProcedure;
             using (DbDataReader reader = cmd.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     objContentModule                          = new Course();
                     objContentModule.ActivityId               = reader["ActivityId"].ToString();
                     objContentModule.CurriculumId             = Curriculum.CurriculumId;
                     objContentModule.ContentModuleName        = reader["ContentModuleName"].ToString();
                     objContentModule.ContentModuleDescription = reader["ContentModuleDescription"].ToString();
                     objContentModule.ContentTrackId           = reader["ContentTrackId"].ToString();
                     objContentModule.CompletionStatus         = reader["CompletionStatus"].ToString();
                     objContentModule.DateOfCompletion         = reader["DateOfCompletion"].ToString();
                     objContentModule.DateOfStart              = reader["DateOfStart"].ToString();
                     objContentModule.NoOfPagesCompleted       = reader["NoOfPagesCompleted"].ToString();
                     objContentModule.percentCompleted         = reader["percentCompleted"].ToString();
                     objContentModule.TotalNoOfPages           = reader["TotalNoOfPages"].ToString();
                     objContentModule.Score                    = reader["Score"].ToString();
                     objContentModule.PassFailStatus           = reader["PassFailStatus"].ToString();
                     objContentModule.IsHTML5                  = reader["IsHTML5"].ToString();
                     objContentModule.DisplayOrder             = reader["DisplayOrder"].ToString();
                     lstContentModule.Add(objContentModule);
                 }
             }
         }
         return(lstContentModule);
     }
     catch (Exception ex)
     {
         clsErrorhandling objerror = new clsErrorhandling();
         objerror.LogException(ex, "ContentModule", "GetUserContentModule");
         return(null);
     }
 }
 public static Course GetUserContentModuleTracking(Course objCourse)
 {
     try
     {
         Course            objContentModuleTracking = new Course();
         DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.SqlClient");
         //string LearnerID = "";
         using (DbConnection conn = Config.GetConnection())
         {
             DbCommand cmd = fact.CreateCommand();
             cmd.CommandTimeout = 0;
             cmd.Connection     = conn;
             cmd.CommandText    = "procGetActivityDetails";
             cmd.Parameters.Add(Config.GetParameter(fact, "@LearnerId", objCourse.LearnerId));
             cmd.Parameters.Add(Config.GetParameter(fact, "@ActivityId", objCourse.ActivityId));
             cmd.CommandType = CommandType.StoredProcedure;
             using (DbDataReader reader = cmd.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     objContentModuleTracking = new Course();
                     if (Convert.ToString(reader["message"]) == "success")
                     {
                         objContentModuleTracking.ActivityId       = reader["ActivityId"].ToString();
                         objContentModuleTracking.LearnerId        = reader["LearnerId"].ToString();
                         objContentModuleTracking.ContentTrackId   = reader["ContentTrackId"].ToString();
                         objContentModuleTracking.CompletionStatus = reader["CompletionStatus"].ToString();
                         objContentModuleTracking.RetMessage       = "success";
                     }
                     else
                     {
                         objContentModuleTracking.RetMessage = Convert.ToString(reader["message"]);
                     }
                     //objContentModuleTracking.Add(objContentModule);
                 }
             }
         }
         return(objContentModuleTracking);
     }
     catch (Exception ex)
     {
         clsErrorhandling objerror = new clsErrorhandling();
         objerror.LogException(ex, "ContentModule", "GetUserContentModule");
         return(null);
     }
 }
 public static List <CurriculumGeneral> GetUserCurriculum(Learner objLeaner)
 {
     try
     {
         CurriculumGeneral        objCurriculumGeneral;
         List <CurriculumGeneral> lstCurriculumGeneral = new List <CurriculumGeneral>();
         DbProviderFactory        fact = DbProviderFactories.GetFactory(Config.DbType);
         //string LearnerID = "";
         using (DbConnection conn = Config.GetConnection())
         {
             DbCommand cmd = fact.CreateCommand();
             cmd.CommandTimeout = 0;
             cmd.Connection     = conn;
             cmd.CommandText    = "GetUserCurriculum";
             cmd.Parameters.Add(Config.GetParameter(fact, "@LearnerId", objLeaner.LearnerId));
             cmd.CommandType = CommandType.StoredProcedure;
             using (DbDataReader reader = cmd.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     objCurriculumGeneral = new CurriculumGeneral();
                     objCurriculumGeneral.CurriculumId          = reader["CurriculumId"].ToString();
                     objCurriculumGeneral.CurriculumName        = reader["CurriculumName"].ToString();
                     objCurriculumGeneral.CurriculumDescription = reader["CurriculumDescription"].ToString();
                     //objCurriculumGeneral.CreateDate = reader["CreateDate"].ToString();
                     //objCurriculumGeneral.LastmodifiedDate = reader["LastmodifiedDate"].ToString();
                     objCurriculumGeneral.CurriculumTrackId = reader["CurriculumTrackId"].ToString();
                     objCurriculumGeneral.CompletionStatus  = reader["CompletionStatus"].ToString();
                     objCurriculumGeneral.DateOfStart       = reader["DateOfStart"].ToString();
                     objCurriculumGeneral.DateOfCompletion  = reader["DateOfCompletion"].ToString();
                     objCurriculumGeneral.EnableSequencing  = Convert.ToString(reader["enableSequencing"]);
                     objCurriculumGeneral.LearnerId         = objLeaner.LearnerId;
                     lstCurriculumGeneral.Add(objCurriculumGeneral);
                 }
             }
         }
         return(lstCurriculumGeneral);
     }
     catch (Exception ex)
     {
         clsErrorhandling objerror = new clsErrorhandling();
         objerror.LogException(ex, "CurriculumGeneral", "GetUserCurriculum");
         return(null);
     }
 }
示例#4
0
 /// <summary>
 /// Added by Abhay on 29-12-2014
 /// Will check whether the learner is valid (username and password match) and active
 /// </summary>
 /// <param name="objLeaner">Learner object which contain username and password</param>
 /// <returns>return Datareader</returns>
 public static Learner ValidateLeanerLogin(Learner objLeaner)
 {
     try
     {
         Learner           objLearner = new Learner();
         DbProviderFactory fact       = DbProviderFactories.GetFactory(Config.DbType);
         //string LearnerID = "";
         using (DbConnection conn = Config.GetConnection())
         {
             DbCommand cmd = fact.CreateCommand();
             cmd.CommandTimeout = 0;
             cmd.Connection     = conn;
             cmd.CommandText    = "SELECT LearnerId,FirstName,UserName FROM  tblLearnerGeneral Where Upper(isActive)='TRUE' AND UserName=@UserName AND Password=@Password";
             cmd.Parameters.Add(Config.GetParameter(fact, "@UserName", objLeaner.UserName));
             cmd.Parameters.Add(Config.GetParameter(fact, "@Password", objLeaner.Password));
             cmd.CommandType = CommandType.Text;
             using (DbDataReader reader = cmd.ExecuteReader())
             {
                 if (reader.HasRows)
                 {
                     while (reader.Read())
                     {
                         objLearner.LearnerId = reader["LearnerId"].ToString();
                         objLearner.FirstName = reader["FirstName"].ToString();
                         objLearner.UserName  = reader["UserName"].ToString();
                     }
                 }
                 else
                 {
                     objLearner = null;
                 }
             }
         }
         return(objLearner);
     }
     catch (Exception ex)
     {
         clsErrorhandling objerror = new clsErrorhandling();
         objerror.LogException(ex, "LearnerLogin", "ValidateLeanerLogin");
         return(null);
     }
 }
 public static void ManageTracking(Tracking track)
 {
     try
     {
         DbProviderFactory fact = DbProviderFactories.GetFactory(Config.DbType);
         using (DbConnection conn = Config.GetConnection())
         {
             DbCommand cmd = fact.CreateCommand();
             cmd.CommandTimeout = 0;
             cmd.Connection     = conn;
             cmd.CommandText    = "sp_ManageTracking";
             cmd.Parameters.Add(Config.GetParameter(fact, "@LearnerId", track.LearnerId));
             cmd.Parameters.Add(Config.GetParameter(fact, "@ContentModuleId", track.ContentModuleId));
             cmd.Parameters.Add(Config.GetParameter(fact, "@CurriculumId", track.CurriculumId));
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         clsErrorhandling objerror = new clsErrorhandling();
         objerror.LogException(ex, "Tracking", "ManageTracking");
     }
 }