public string DeleteStudyMaterial(StudyMaterialViewModel objStudyMaterial) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("StudyMaterialID", objStudyMaterial.StudyMaterialID)); return(DGeneric.RunSP_ExecuteNonQuery("sp_DeleteStudyMaterial", sqlParameterList)); }
public string DeleteTestType(TestTypeViewModel objTestType) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("TestTypeID", objTestType.TestTypeID)); return(DGeneric.RunSP_ExecuteNonQuery("sp_DeleteTestType", sqlParameterList)); }
public List <Topper_AverageViewModel> GetTopper_Average(int TestID) { string query = string.Format("select * from Topper_Average where TestID = {0} ", TestID); DataTable dt = DGeneric.GetData(query).Tables[0]; return(dt.AsEnumerable().Select(s => new Topper_AverageViewModel() { Topper_AverageID = Convert.ToInt32(s["Topper_AverageID"]), Topper_Average = Convert.ToString(s["Topper_Average"]), TestID = Convert.ToInt32(s["TestID"]), Physics_Right = Convert.ToString(s["Physics_Right"]), Physics_Wrong = Convert.ToString(s["Physics_Wrong"]), Chemistry_Right = Convert.ToString(s["Chemistry_Right"]), Chemistry_Wrong = Convert.ToString(s["Chemistry_Wrong"]), Biology_Right = Convert.ToString(s["Biology_Right"]), Biology_Wrong = Convert.ToString(s["Biology_Wrong"]), Aptitude_Right = Convert.ToString(s["Aptitude_Right"]), Aptitude_Wrong = Convert.ToString(s["Aptitude_Wrong"]), TotalCorrect = Convert.ToString(s["TotalCorrect"]), TotalWrong = Convert.ToString(s["TotalWrong"]), TotalAttempt = Convert.ToString(s["TotalAttempt"]), TotalMarksObtained = Convert.ToString(s["TotalMarksObtained"]), Percentage = Convert.ToString(s["Percentage"]), }).ToList()); }
public string DeleteOnlineTest(int OnlineTestId) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("@OnlineTestID", OnlineTestId)); return(DGeneric.RunSP_ExecuteNonQuery("sp_DeleteOnlineTest", sqlParameterList)); }
public PaperAnalysisViewModel GetPaperAnalysis(int TestID) { string query = string.Format("select * from PaperAnalysis where TestID = {0} ", TestID); DataRow dr = DGeneric.GetData(query).Tables[0].Rows[0]; PaperAnalysisViewModel obj = new PaperAnalysisViewModel(); obj.PaperAnalysisID = Convert.ToInt32(dr["PaperAnalysisID"]); obj.TestID = Convert.ToInt32(dr["TestID"]); obj.TotalEasy = dr["TotalEasy"].ToString(); obj.TotalMedium = dr["TotalMedium"].ToString(); obj.TotalDifficult = dr["TotalDifficult"].ToString(); obj.EasyQuestionList = dr["EasyQuestionList"].ToString(); obj.MediumQuestionList = dr["MediumQuestionList"].ToString(); obj.DifficultQuestionList = dr["DifficultQuestionList"].ToString(); return(obj); //return dt.AsEnumerable().Select(s => new PaperAnalysisViewModel() //{ // PaperAnalysisID = Convert.ToInt32(s["OnlineTestID"]), // TestID = Convert.ToInt32(s["OnlineTestID"]), // TotalEasy = s["OnlineTestNo"].ToString(), // TotalMedium = s["TestSeries"].ToString(), // TotalDifficult = s["TestType"].ToString(), // EasyQuestionList = s["TestName"].ToString(), // MediumQuestionList = s["TestDuration"].ToString(), // DifficultQuestionList = s["SessionID"].ToString() //}).ToList(); }
public List <TestTypeViewModel> GetTestType() { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); List <DataTableMapping> dataTableMappingList = new List <DataTableMapping>(); dataTableMappingList.Add(new DataTableMapping("Table", "TestType")); dataTableMappingList.Add(new DataTableMapping("Table1", "QuestionType")); dataTableMappingList.Add(new DataTableMapping("Table2", "Subject")); DataSet ds = DGeneric.RunSP_ReturnDataSet("sp_GetAllMasterData", sqlParameterList, dataTableMappingList); List <TestTypeViewModel> testTypeList = new List <TestTypeViewModel>(); if (ds.Tables.Count > 0) { foreach (DataTable dt in ds.Tables) { if (dt.Rows.Count > 0) { string tableName = Convert.ToString(dt.Rows[0]["TableName"]); switch (tableName) { case "TestType": testTypeList = DGeneric.BindDataList <TestTypeViewModel>(dt); break; } } } } return(ds.Tables["TestType"].AsEnumerable().Select(s => new TestTypeViewModel() { TestTypeID = Convert.ToInt32(s["TestTypeID"]), TestType = s["TestType"].ToString(), }).ToList()); }
public StudyMaterialViewModel GetStudyMaterialByID(int StudyMaterialID) { var studyMaterialViewModelData = new StudyMaterialViewModel(); List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("@StudyMaterialID", StudyMaterialID)); DataTable dt = DGeneric.RunSP_ReturnDataSet("sp_GetStudyMaterialByID", sqlParameterList, null).Tables[0]; if (dt.Rows.Count > 0) { return(DGeneric.BindDataList <StudyMaterialViewModel>(dt).FirstOrDefault()); } else { return(new List <StudyMaterialViewModel>().FirstOrDefault()); } //if (ds.Tables.Count > 0) //{ // studyMaterialViewModelData = DGeneric.BindDataList<OnlineTestViewModel>(dt).FirstOrDefault(); // studyMaterialViewModelData.StreamID = dt.Rows[0]["StreamID"].ToString().Split(',').Select(int.Parse).ToArray(); // //Vaibhav Changed because of empty data // // onlineTestViewModelData.CourseID = dt.Rows[0]["CourseID"].ToString().Split(',').Select(int.Parse).ToArray(); // // onlineTestViewModelData.BatchID = dt.Rows[0]["BatchID"].ToString().Split(',').Select(int.Parse).ToArray(); // studyMaterialViewModelData.CourseID = dt.Rows[0]["CourseID"].ToString() != string.Empty ? dt.Rows[0]["CourseID"].ToString().Split(',').Select(int.Parse).ToArray() : null; // studyMaterialViewModelData.BatchID = dt.Rows[0]["BatchID"].ToString() != string.Empty ? dt.Rows[0]["BatchID"].ToString().Split(',').Select(int.Parse).ToArray() : null; //} //return studyMaterialViewModelData; }
public List <EligibleStudentViewModel> GetEligibleStudent(int OnlineTestID) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("@OnlineTestID", OnlineTestID)); DataTable dt = DGeneric.RunSP_ReturnDataSet("sp_GetEligibleStudent", sqlParameterList, null).Tables[0]; if (dt.Rows.Count > 0) { return(DGeneric.BindDataList <EligibleStudentViewModel>(dt)); } //return dt.AsEnumerable().Select(s => new EligibleStudentViewModel() //{ // StudentID = Convert.ToInt32(s["StudentID"]), // OnlineTestID = Convert.ToInt32(s["OnlineTestID"]), // EnrollmentNo = (s["EnrollmentNo"]).ToString(), // StudentName = (s["StudentName"]).ToString(), // Gender = (s["Gender"]).ToString(), // MobileNumber = (s["MobileNumber"]).ToString(), // FatherMobileNo = (s["FatherMobileNo"]).ToString(), // IsEligible = Convert.ToBoolean((s["IsEligible"])), // TestStatusID = Convert.ToInt32(s["TestStatusID"]) //}).ToList(); else { return(new List <EligibleStudentViewModel>()); } }
public DataTable GetStudentResponseByTestID(int TestID) { string query = string.Format("select * from StudentResponse where TestID={0} ", TestID); DataTable dt = DGeneric.GetData(query).Tables[0]; return(dt); }
public string DeleteSlider(SliderViewModel objSlider) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("SliderID", objSlider.SliderID)); return(DGeneric.RunSP_ExecuteNonQuery("sp_DeleteSlider", sqlParameterList)); }
public string UpdateEligibleStudentTestStatus(List <EligibleStudentViewModel> EligibleStudentData) { List <int> StudentList = new List <int>(); int OnlineTestID = 0; foreach (var item in EligibleStudentData) { StudentList.Add(item.StudentID); OnlineTestID = item.OnlineTestID; } int[] terms = StudentList.ToArray(); string StudentID = string.Join(",", terms); string strquery = string.Format(@"UPDATE EligibleStudent SET TestStatusID = {2} WHERE OnlineTestID={0} and StudentID in ({1});", OnlineTestID, StudentID, '1'); DGeneric.ExecQuery(strquery); return("Success"); //var dt = new DataTable(); //dt.Columns.Add("OnlineTestID", typeof(int)); //dt.Columns.Add("StudentID", typeof(int)); //dt.Columns.Add("TestStatus", typeof(int)); //foreach (var item in EligibleStudentData) //{ // dt.Rows.Add(item.OnlineTestID, item.StudentID, Convert.ToInt32(item.IsEligible)); //} //List<SqlParameter> sqlParameterList = new List<SqlParameter>(); //sqlParameterList.Add(new SqlParameter("@EligibleStudentDetails", dt)); //return DGeneric.RunSP_ExecuteNonQuery("sp_AddEligibleStudent1", sqlParameterList); }
public List <CourseViewModel> GetCourseByStream(string StreamId) { if (StreamId != "") { List <SqlParameter> parameter = new List <SqlParameter>(); parameter.Add(new SqlParameter("@StreamID", StreamId)); DataTable dt = DGeneric.RunSP_ReturnDataSet("sp_GetStreamCourseBatch", parameter, null).Tables[0]; if (dt.Rows.Count > 0) { return(DGeneric.BindDataList <CourseViewModel>(dt)); } else { return(new List <CourseViewModel>()); } //return dt.AsEnumerable().Select(s => new CourseViewModel() //{ // CourseID = Convert.ToInt32(s["CourseID"]), // Course = Convert.ToString(s["Course"]) //}).ToList(); } else { return(new List <CourseViewModel>()); } }
public string DeleteSubTopic(SubTopicViewModel objSubTopic) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("TopicID", objSubTopic.SubTopicID)); return(DGeneric.RunSP_ExecuteNonQuery("sp_DeleteSubTopic", sqlParameterList)); }
public DataRow GetOnlineTestByID(int TestID) { string query = string.Format("select * from OnlineTest where OnlineTestID={0} ", TestID); DataRow dr = DGeneric.GetData(query).Tables[0].Rows[0]; return(dr); }
public List <SubTopicViewModel> GetSubTopic() { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); List <DataTableMapping> dataTableMappingList = new List <DataTableMapping>(); dataTableMappingList.Add(new DataTableMapping("Table7", "SubTopic")); DataSet ds = DGeneric.RunSP_ReturnDataSet("sp_GetAllMasterData", sqlParameterList, dataTableMappingList); List <SubTopicViewModel> testTypeList = new List <SubTopicViewModel>(); if (ds.Tables.Count > 0) { foreach (DataTable dt in ds.Tables) { if (dt.Rows.Count > 0) { string tableName = Convert.ToString(dt.Rows[0]["TableName"]); switch (tableName) { case "SubTopic": testTypeList = DGeneric.BindDataList <SubTopicViewModel>(dt); break; } } } } return(testTypeList); //return ds.Tables["SubTopic"].AsEnumerable().Select(s => new SubTopicViewModel() //{ // SubTopicID = Convert.ToInt32(s["SubTopicID"]), // SubTopic = s["SubTopic"].ToString(), // Description = s["Description"].ToString(), // TopicID = Convert.ToInt32(s["TopicID"]), // IsActive = Convert.ToBoolean(s["IsActive"]), //}).ToList(); }
public List <TopicViewModel> GetTopic() { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); List <DataTableMapping> dataTableMappingList = new List <DataTableMapping>(); dataTableMappingList.Add(new DataTableMapping("Table6", "Topic")); DataSet ds = DGeneric.RunSP_ReturnDataSet("sp_GetAllMasterData", sqlParameterList, dataTableMappingList); List <TopicViewModel> testTypeList = new List <TopicViewModel>(); if (ds.Tables.Count > 0) { foreach (DataTable dt in ds.Tables) { if (dt.Rows.Count > 0) { string tableName = Convert.ToString(dt.Rows[0]["TableName"]); switch (tableName) { case "Topic": testTypeList = DGeneric.BindDataList <TopicViewModel>(dt); break; } } } } return(testTypeList); }
public static Login GetUserDetails1(Login user) { List <SqlParameter> parameter = new List <SqlParameter>(); parameter.Add(new SqlParameter("@UserName", user.UserName)); parameter.Add(new SqlParameter("@Password", user.UserPassword)); parameter.Add(new SqlParameter("@UserTypeID", user.UserTypeID)); DataTable dt = DGeneric.RunSP_ReturnDataSet("sp_Login", parameter, null).Tables[0]; if (dt.Rows.Count > 0) { return(DGeneric.BindDataList <Login>(dt).FirstOrDefault()); } else { return(new Login()); } //Login Userlist = null; //foreach (DataRow dr in dt.Rows) //{ // Userlist = new Login() // { // UserID = Convert.ToInt32(dr["UserID"]), // FirstName = dr["FirstName"].ToString(), // LastName = dr["LastName"].ToString(), // MobileNo = dr["Mobile"].ToString(), // UserName = dr["UserName"].ToString(), // // UserPassword = Convert.ToString(dr["UserPassword"]), // UserTypeID = Convert.ToInt32(dr["UserTypeID"]), // UserType = Convert.ToString(dr["UserType"]) // }; //} //return Userlist; }
public List <EligibleStudentViewModel> GetEligibleStudentByTestID(int OnlineTestID) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("@OnlineTestID", OnlineTestID)); DataTable dt = DGeneric.RunSP_ReturnDataSet("sp_GetEligibleStudentByTestID", sqlParameterList, null).Tables[0]; if (dt.Rows.Count > 0) { return(dt.AsEnumerable().Select(s => new EligibleStudentViewModel() { StudentID = Convert.ToInt32(s["StudentID"]), OnlineTestID = Convert.ToInt32(s["OnlineTestID"]), EnrollmentNo = (s["EnrollmentNo"]).ToString(), StudentName = (s["StudentName"]).ToString(), Gender = (s["Gender"]).ToString(), MobileNumber = (s["MobileNumber"]).ToString(), TestStatusID = Convert.ToInt32((s["TestStatusID"])), TestStatus = (s["TestStatus"]).ToString(), }).ToList()); } else { return(new List <EligibleStudentViewModel>()); } }
public DataTable GetAbsentStudentByTestID(int TestID) { //string query = string.Format("select * from EligibleStudent where OnlineTestID={0} ", TestID); //DataTable dt = DGeneric.GetData(query).Tables[0]; //return dt; DataTable dt = DGeneric.GetData(string.Format("select * from EligibleStudent where OnlineTestID = {0} and TestStatusID in (1,2)", TestID)).Tables[0]; return(dt); }
public AttendenceMainModel GetAttendance(string Date, string EnrollmentNo = null) { var sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("@Date", Date)); sqlParameterList.Add(new SqlParameter("@EnrollmentNo", EnrollmentNo)); DataTable dtAttendance = DGeneric.RunSP_ReturnDataSet("sp_GetAttendance", sqlParameterList, null).Tables[0]; if (dtAttendance.Rows.Count > 0) { var attendanceObj = new AttendenceMainModel(); var studentList = new List <StudentViewModel>(); foreach (DataRow dr in dtAttendance.Rows) { var studentData = studentList.FirstOrDefault(f => f.EnrollmentNo.Equals(dr["EnrollmentNo"].ToString())); if (studentData != null) { studentData.AttendenceList.Add(new Attendance() { AttendanceId = Convert.ToInt64(dr["AttendanceId"]), PunchDate = dr["PunchDate"].ToString(), PunchIn = dr["PunchIn"].ToString(), PunchOut = dr["PunchOut"].ToString(), ArrivalDeparture = dr["ArrivalDeparture"].ToString(), Status = dr["Status"].ToString() }); } else { var studentModel = new StudentViewModel(); studentModel.EnrollmentNo = dr["EnrollmentNo"].ToString(); studentModel.FirstName = dr["FirstName"].ToString(); studentModel.LastName = dr["LastName"].ToString(); if (!string.IsNullOrEmpty(dr["AttendanceID"].ToString())) { studentModel.AttendenceList.Add(new Attendance() { AttendanceId = Convert.ToInt64(dr["AttendanceId"]), PunchDate = dr["PunchDate"].ToString(), PunchIn = dr["PunchIn"].ToString(), PunchOut = dr["PunchOut"].ToString(), ArrivalDeparture = dr["ArrivalDeparture"].ToString(), Status = dr["Status"].ToString() }); } studentList.Add(studentModel); } } attendanceObj.StudentList = studentList; attendanceObj.DateRange = GetDates(Date.ConvertDateTimeToDate().Year, Date.ConvertDateTimeToDate().Month); return(attendanceObj); } else { return(new AttendenceMainModel()); } }
public string AddUpdateTestSeries(TestSeriesViewModel objTestSeries) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("TestSeriesID", objTestSeries.TestSeriesID)); sqlParameterList.Add(new SqlParameter("TestSeries", !string.IsNullOrEmpty(objTestSeries.TestSeries) ? objTestSeries.TestSeries : string.Empty)); sqlParameterList.Add(new SqlParameter("TotalTest", !string.IsNullOrEmpty(objTestSeries.TotalTest) ? objTestSeries.TotalTest : string.Empty)); sqlParameterList.Add(new SqlParameter("Description", !string.IsNullOrEmpty(objTestSeries.Description) ? objTestSeries.Description : string.Empty)); return(DGeneric.RunSP_ExecuteNonQuery("sp_AddUpdateTestSeries", sqlParameterList)); }
public string ChangePassword(ChangePasswordViewModel CP) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("UserID", CP.UserID)); sqlParameterList.Add(new SqlParameter("UserTypeID", CP.UserTypeID)); sqlParameterList.Add(new SqlParameter("CurrentPassword", CP.CurrentPassword)); sqlParameterList.Add(new SqlParameter("NewPassword", CP.NewPassword)); return(DGeneric.RunSP_ReturnScaler("sp_ChangePassword", sqlParameterList)); }
public string AddUpdateSubTopic(SubTopicViewModel objSubTopic) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("SubTopicID", objSubTopic.SubTopicID)); sqlParameterList.Add(new SqlParameter("SubTopic", objSubTopic.SubTopic)); sqlParameterList.Add(new SqlParameter("Description", !string.IsNullOrEmpty(objSubTopic.Description) ? objSubTopic.Description : string.Empty)); sqlParameterList.Add(new SqlParameter("TopicID", objSubTopic.TopicID)); sqlParameterList.Add(new SqlParameter("IsActive", objSubTopic.IsActive)); return(DGeneric.RunSP_ExecuteNonQuery("sp_AddUpdateSubTopic", sqlParameterList)); }
public void LogException(string methodName, string exceptionMessage, string stackTrace, string userName) { var sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("@MethodName", methodName)); sqlParameterList.Add(new SqlParameter("@ErrorMessage", exceptionMessage)); sqlParameterList.Add(new SqlParameter("@StackTrace", stackTrace)); sqlParameterList.Add(new SqlParameter("@UserName", userName)); sqlParameterList.Add(new SqlParameter("@CreateDate", DateTime.Now)); string response = DGeneric.RunSP_ExecuteNonQuery("sp_AddElmahError", sqlParameterList); }
public string AddUpdateTimeTable(TimeTableViewModel objTimeTable) { if (objTimeTable.DateType == "single") { objTimeTable.ToDate = objTimeTable.FromDate; } foreach (DateTime day in EachDay(Convert.ToDateTime(objTimeTable.FromDate), Convert.ToDateTime(objTimeTable.ToDate))) { List <SqlParameter> sqlParameterList = new List <SqlParameter>(); sqlParameterList.Add(new SqlParameter("TimeTableID", objTimeTable.TimeTableID)); sqlParameterList.Add(new SqlParameter("Description", !string.IsNullOrEmpty(objTimeTable.Description) ? objTimeTable.Description : string.Empty)); sqlParameterList.Add(new SqlParameter("TimeTableDate", day.Date)); sqlParameterList.Add(new SqlParameter("ShiftID", objTimeTable.ShiftID)); sqlParameterList.Add(new SqlParameter("SessionID", objTimeTable.SessionID)); sqlParameterList.Add(new SqlParameter("BatchID", string.Join(",", objTimeTable.BatchID))); sqlParameterList.Add(new SqlParameter("LectureID", string.Join(",", objTimeTable.LectureID))); sqlParameterList.Add(new SqlParameter("IsActive", true)); sqlParameterList.Add(new SqlParameter("CreatedByUserID", 1)); sqlParameterList.Add(new SqlParameter("CreatedOnDate", DGeneric.SystemDateTime)); int TimeTableID = Convert.ToInt32(DGeneric.RunSP_ReturnScaler("sp_AddUpdateTimeTable", sqlParameterList)); if (TimeTableID > 0) { for (int i = 0; i < objTimeTable.LectureList.Count; i++) { objTimeTable.LectureList[i].TimeTableID = TimeTableID; objTimeTable.LectureList[i].FacultyID = objTimeTable.LectureList[i].FacultyID; objTimeTable.LectureList[i].CreatedByUserID = 1; objTimeTable.LectureList[i].CreatedOnDate = DGeneric.SystemDateTime; objTimeTable.LectureList[i].IsActive = true; objTimeTable.LectureList[i].Time_From = objTimeTable.LectureList[i].Lecture.Time_From; objTimeTable.LectureList[i].Time_To = objTimeTable.LectureList[i].Lecture.Time_To; objTimeTable.LectureList[i].BatchID = objTimeTable.LectureList[i].Batch.BatchID; objTimeTable.LectureList[i].LectureID = objTimeTable.LectureList[i].Lecture.LectureID; } DataTable dt = DGeneric.ListToDataTable(objTimeTable.LectureList); dt.Columns.Remove("Batch"); dt.Columns.Remove("Lecture"); dt.Columns.Remove("Faculty"); dt.Columns.Remove("ID"); List <SqlParameter> sqlParameterList1 = new List <SqlParameter>(); sqlParameterList1.Add(new SqlParameter("@TimeTableID", TimeTableID)); DGeneric.RunSP_ExecuteNonQuery("sp_DeleteLecture", sqlParameterList1); List <SqlParameter> sqlParameterList2 = new List <SqlParameter>(); sqlParameterList2.Add(new SqlParameter("@LectureDetails", dt)); string LectureID = DGeneric.RunSP_ReturnScaler("sp_AddLecture", sqlParameterList2); } } return("Success"); }
public List <StudentViewModel> GetStudentDetails() { string strQuery = @"SELECT dbo.StudentAccount.StudentAccountID, dbo.StudentAccount.StudentID, dbo.StudentAccount.Password, dbo.StudentAccount.IsActive, dbo.StudentAccount.CreatedByUserID, dbo.StudentAccount.CreatedOnDate, dbo.Student.EnrollmentNo, dbo.Student.EnrollmentDate, dbo.Student.FirstName, dbo.Student.MiddleName, dbo.Student.LastName, dbo.Student.Gender, dbo.Student.DOB, dbo.Student.MobileNumber, dbo.Student.PhoneNumber, dbo.Student.Email, dbo.Student.Address, dbo.Student.Landmark, dbo.Student.CityID, dbo.Student.Pin, dbo.Student.Medium, dbo.Student.Cast, dbo.Student.PhotoUrl, dbo.Student.StreamID, dbo.Student.CourseID, dbo.Student.BatchID, dbo.Student.SessionID, dbo.Student.[School/College], dbo.Student.FatherName, dbo.Student.FatherOccupation, dbo.Student.FatherMobile, dbo.Student.FatherEmail,ss.[Session],s.Stream,c.Course,b.Batch FROM dbo.StudentAccount left JOIN dbo.Student ON dbo.Student.StudentID = dbo.StudentAccount.StudentID left join dbo.[Session] ss on Student.SessionID= ss.SessionID left join dbo.Stream s on Student.StreamID= s.StreamID left join dbo.Course c on Student.CourseID= c.CourseID left join dbo.Batch b on Student.BatchID= b.BatchID" ; DataTable dt = DGeneric.GetData(strQuery).Tables[0]; if (dt.Rows.Count > 0) { return(DGeneric.BindDataList <StudentViewModel>(dt)); } else { return(new List <StudentViewModel>()); } //return dt.AsEnumerable().Select(x => new StudentViewModel() //{ // StudentAccountID = Convert.ToInt32(x["StudentAccountID"]), // StudentID = Convert.ToInt32(x["StudentID"]), // EnrollmentNo = x["EnrollmentNo"].ToString(), // EnrollmentDate = x["EnrollmentDate"].ToString().ConvertDateTimeToString(), // FirstName = x["FirstName"].ToString(), // LastName = x["LastName"].ToString(), // Gender = x["Gender"].ToString(), // DOB = x["DOB"].ToString().ConvertDateTimeToString(), // MobileNo = x["MobileNumber"].ToString(), // Email = x["Email"].ToString(), // Address = x["Address"].ToString(), // Landmark = x["Landmark"].ToString(), // Pincode = x["Pin"].ToString(), // CityID = Convert.ToInt32(x["CityID"]), // Caste = x["Cast"].ToString(), // PhotoUrl = x["PhotoUrl"].ToString(), // Medium = x["Medium"].ToString(), // FatherName = x["FatherName"].ToString(), // FatherMobile = x["FatherMobile"].ToString(), // FatherEmail = x["FatherEmail"].ToString(), // //SessionID = Convert.ToInt32(x["SessionID"]), // //StreamID = Convert.ToInt32(x["StreamID"]), // //CourseID = Convert.ToInt32(x["CourseID"]), // //BatchID = Convert.ToInt32(x["BatchID"]), //}).ToList(); }
public ForgetPassword ForgetPassword(ForgetPassword objForgetPassword) { string MobileNo; if (objForgetPassword.Action == "SendOTP") { string strQuery = string.Format("Select MobileNumber from Student where EnrollmentNo='{0}'", objForgetPassword.UserName); MobileNo = Convert.ToString(DGeneric.GetValue(strQuery)); if (string.IsNullOrEmpty(MobileNo)) { MobileNo = Convert.ToString(DGeneric.GetValue(String.Format("select Mobile from Users where UserName='******'", objForgetPassword.UserName))); if (string.IsNullOrEmpty(MobileNo)) { objForgetPassword.ConfirmOTP = "0"; } else { Random rand = new Random(); objForgetPassword.ConfirmOTP = rand.Next(0, 999999).ToString("D6"); string strMessage = "Your OTP is: " + objForgetPassword.ConfirmOTP; string response = DSMSGeneric.SendSingleSMS("8871171445", strMessage); objForgetPassword.UserTypeID = 1; } } else { Random rand = new Random(); objForgetPassword.ConfirmOTP = rand.Next(0, 999999).ToString("D6"); string strMessage = "Your OTP is: " + objForgetPassword.ConfirmOTP; string response = DSMSGeneric.SendSingleSMS("8871171445", strMessage); objForgetPassword.UserTypeID = 2; } } else if (objForgetPassword.Action == "UpdatePassword") { if (objForgetPassword.UserTypeID == 1) { string strQuery = string.Format("update users set UserPassword='******' where UserName='******'", objForgetPassword.NewPassword, objForgetPassword.UserName); DGeneric.ExecQuery(strQuery); objForgetPassword.Status = "Success"; } else if (objForgetPassword.UserTypeID == 2) { int StudentID = Convert.ToInt32(DGeneric.GetValue(String.Format("select StudentID from Student where EnrollmentNo='{0}'", objForgetPassword.UserName))); string strQuery = string.Format("update StudentAccount set Password='******' where StudentID='{1}'", objForgetPassword.NewPassword, StudentID); DGeneric.ExecQuery(strQuery); objForgetPassword.Status = "Success"; } } return(objForgetPassword); }
public QuizViewModel GetQuestionsByTestId(int OnlineTestID) { List <SqlParameter> paramerterList = new List <SqlParameter>(); paramerterList.Add(new SqlParameter("@OnlineTestID", OnlineTestID)); DataTable dt = DGeneric.RunSP_ReturnDataSet("sp_GetQuiz", paramerterList, null).Tables[0]; QuizViewModel quizViewModel = new QuizViewModel(); quizViewModel.Questions = new List <QuestionViewModel>(); if (dt.Rows.Count > 1) { foreach (DataRow dr in dt.Rows) { if (Convert.ToInt32(dr["OnlineTestID"]) != quizViewModel.OnlineTestID) { quizViewModel.OnlineTestID = Convert.ToInt32(dr["OnlineTestID"]); quizViewModel.TestName = dr["TestName"].ToString(); quizViewModel.TestDuration = dr["TestDuration"].ToString(); quizViewModel.OnlineTestNo = Convert.ToInt32(dr["OnlineTestNo"]); quizViewModel.TestSeries = dr["TestSeries"].ToString(); quizViewModel.TestType = dr["TestType"].ToString(); quizViewModel.TotalMarks = dr["TotalMarks"].ToString().Replace(" ", ""); quizViewModel.PassingPercentage = dr["PassingPercentage"].ToString().Replace(" ", ""); QuestionViewModel questionViewModel = new QuestionViewModel(); questionViewModel.QuestionID = Convert.ToInt32(dr["QuestionId"]); questionViewModel.TestQuestionNo = dr["TestQuestionNo"].ToString(); questionViewModel.Subject = dr["Subject"].ToString(); questionViewModel.Image_English = ConfigurationManager.AppSettings["BaseURL"].ToString() + "/" + dr["Image_English"]; questionViewModel.Image_Hindi = ConfigurationManager.AppSettings["BaseURL"].ToString() + "/" + dr["Image_Hindi"]; questionViewModel.CorrectAnswer = dr["Answer"].ToString(); quizViewModel.Questions.Add(questionViewModel); } else { QuestionViewModel questionViewModel = new QuestionViewModel(); questionViewModel.QuestionID = Convert.ToInt32(dr["QuestionId"]); questionViewModel.TestQuestionNo = dr["TestQuestionNo"].ToString(); questionViewModel.Subject = dr["Subject"].ToString(); questionViewModel.Image_English = ConfigurationManager.AppSettings["BaseURL"].ToString() + "/" + dr["Image_English"]; questionViewModel.Image_Hindi = ConfigurationManager.AppSettings["BaseURL"].ToString() + "/" + dr["Image_Hindi"]; questionViewModel.CorrectAnswer = dr["Answer"].ToString(); quizViewModel.Questions.Add(questionViewModel); } } return(quizViewModel); } else { return(quizViewModel = null); } }
public List <StudyMaterialViewModel> GetStudyMaterial() { DataTable dt = DGeneric.RunSP_ReturnDataSet("sp_GetStudyMaterial", null, null).Tables[0]; if (dt.Rows.Count > 0) { return(DGeneric.BindDataList <StudyMaterialViewModel>(dt)); } else { return(new List <StudyMaterialViewModel>()); } }
public List <GeneralSettingsViewModel> GetGeneralSettings() { DataTable dt = DGeneric.GetData("Select * from GeneralSettings").Tables[0]; if (dt.Rows.Count > 0) { return(DGeneric.BindDataList <GeneralSettingsViewModel>(dt)); } else { return(new List <GeneralSettingsViewModel>()); } }