public bool SaveUpdateAttendance(DTOAttendance toAtt) { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); try { if (dbContext.tblAttendanceDetails.Where(x => x.colStudentId == toAtt.StudentId && x.colMonth == toAtt.Month && x.colYear == toAtt.Year).ToList().Count > 0) { tblAttendanceDetail Attendance = dbContext.tblAttendanceDetails.Where(x => x.colStudentId == toAtt.StudentId && x.colMonth == toAtt.Month && x.colYear == toAtt.Year).FirstOrDefault(); Attendance.colBranchId = toAtt.BranchId; Attendance.colSemesterId = toAtt.SemesterId; Attendance.colMonth = toAtt.Month; Attendance.colYear = toAtt.Year; Attendance.colInstituteId = toAtt.InstituteId; Attendance.colClassesAttendedMonth = toAtt.ClassesAttended; Attendance.colClassesAttendedMonthPercent = toAtt.ClassesPercentage; Attendance.colClassesHeldMonth = toAtt.ClassesHeld; Attendance.colAccumulatedClassesAttended = toAtt.CumClassesAttended; Attendance.colAccumulatedClassesHeld = toAtt.CumClassesHeld; Attendance.colAccumulatedClassesAttendedPercent = toAtt.CumClassesPercentage; Attendance.colStudentId = toAtt.StudentId; Attendance.colSubjectId = toAtt.SubjectId; Attendance.colRemarks = toAtt.Remarks; Attendance.colDescription = toAtt.Description; dbContext.SubmitChanges(); return true; } else { tblAttendanceDetail Attendance = new tblAttendanceDetail(); Attendance.colBranchId = toAtt.BranchId; Attendance.colSemesterId = toAtt.SemesterId; Attendance.colMonth = toAtt.Month; Attendance.colYear = toAtt.Year; Attendance.colInstituteId = toAtt.InstituteId; Attendance.colClassesAttendedMonth = toAtt.ClassesAttended; Attendance.colClassesAttendedMonthPercent = toAtt.ClassesPercentage; Attendance.colClassesHeldMonth = toAtt.ClassesHeld; Attendance.colAccumulatedClassesAttended = toAtt.CumClassesAttended; Attendance.colAccumulatedClassesHeld = toAtt.CumClassesHeld; Attendance.colAccumulatedClassesAttendedPercent = toAtt.CumClassesPercentage; Attendance.colStudentId = toAtt.StudentId; Attendance.colSubjectId = toAtt.SubjectId; Attendance.colRemarks = toAtt.Remarks; Attendance.colDescription = toAtt.Description; dbContext.tblAttendanceDetails.InsertOnSubmit(Attendance); dbContext.SubmitChanges(); return true; } } catch { return false; } }
public bool DeleteInstituteDetails(DTOInstituteDetails toins) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); // Institute Details tblInstituteDetail InstDetail = dbContext.tblInstituteDetails.Where(x => x.colInstituteId == toins.InstituteID).FirstOrDefault(); dbContext.tblInstituteDetails.DeleteOnSubmit(InstDetail); dbContext.SubmitChanges(); return true; } catch { return false; } }
public bool DeleteStudentDetails(DTOStudentRegistration tostu) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); // Institute Details tblStudentDetail StudDetail = dbContext.tblStudentDetails.Where(x => x.colStudentId == tostu.StudentId).FirstOrDefault(); dbContext.tblStudentDetails.DeleteOnSubmit(StudDetail); dbContext.SubmitChanges(); return true; } catch { return false; } }
public bool SaveClasses(DTOPersonalizeApplication DTOPApplication) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); foreach (string _classname in DTOPApplication.Classes) { tblBranchDetail brnchDetail = new tblBranchDetail(); brnchDetail.colBranchName = _classname; brnchDetail.colInstituteId = DTOPApplication.InstituteId; dbContext.tblBranchDetails.InsertOnSubmit(brnchDetail); } dbContext.SubmitChanges(); return true; } catch (Exception ex) { return false; } }
public bool CheckParentsLoginUser(DTOParentsLoginDetails tologin) { try { using (Campus2CaretakerDataContext ctx = new Campus2CaretakerDataContext()) { var usr = (from u in ctx.tblParentsLoginOTPs where u.colMobileNumber == tologin.Mobilenumber && u.colOTP == tologin.Otp select u); if (usr.Count() > 0) { usr.FirstOrDefault().colisUsed = 1; ctx.SubmitChanges(); return true; } return false; } } catch { return false; } }
public bool SaveSubjects(DTOPersonalizeApplication DTOPApplication) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); foreach (string _theorysubject in DTOPApplication.TheorySubjects) { tblSubjectDetail subjDetail = new tblSubjectDetail(); subjDetail.colBranchId = DTOPApplication.ClassId; subjDetail.colInstituteId = DTOPApplication.InstituteId; subjDetail.colIsTheory = "Y"; subjDetail.colSubjectName = _theorysubject; subjDetail.colSemester = DTOPApplication.Semester; dbContext.tblSubjectDetails.InsertOnSubmit(subjDetail); } foreach (string _labsubject in DTOPApplication.LabSubjects) { tblSubjectDetail subjDetail = new tblSubjectDetail(); subjDetail.colBranchId = DTOPApplication.ClassId; subjDetail.colInstituteId = DTOPApplication.InstituteId; subjDetail.colIsTheory = "N"; subjDetail.colSubjectName = _labsubject; subjDetail.colSemester = DTOPApplication.Semester; dbContext.tblSubjectDetails.InsertOnSubmit(subjDetail); } dbContext.SubmitChanges(); return true; } catch (Exception ex) { return false; } }
public bool UpdateInstituteDetails(DTOInstituteDetails toins) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); // Institute Details tblInstituteDetail InstDetail = dbContext.tblInstituteDetails.Where(x => x.colInstituteId == toins.InstituteID).FirstOrDefault(); InstDetail.colAddress = toins.InstituteAddress; InstDetail.colInstituteName = toins.InstituteName; InstDetail.colInstituteType = toins.InstituteType; InstDetail.colLogoPath = toins.LogoPath; InstDetail.colPhone = toins.InstitutePhoneNo; InstDetail.colPrincipalContact = toins.PrincipalContact; InstDetail.colPrincipalName = toins.PrincipalName; InstDetail.colState = toins.State; InstDetail.colDistrict = toins.District; InstDetail.colMaxStudents = toins.MaxStudents; dbContext.SubmitChanges(); return true; } catch { return false; } }
public bool InsertInstituteDetails(DTOInstituteDetails toins) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); // Institute Details tblInstituteDetail InstDetail = new tblInstituteDetail(); InstDetail.colAddress = toins.InstituteAddress; InstDetail.colInstituteName = toins.InstituteName; InstDetail.colInstituteType = toins.InstituteType; InstDetail.colLogoPath = toins.LogoPath; InstDetail.colPhone = toins.InstitutePhoneNo; InstDetail.colPrincipalContact = toins.PrincipalContact; InstDetail.colPrincipalName = toins.PrincipalName; InstDetail.colState = toins.State; InstDetail.colDistrict = toins.District; InstDetail.colMaxStudents = toins.MaxStudents; dbContext.tblInstituteDetails.InsertOnSubmit(InstDetail); dbContext.SubmitChanges(); // Institute Login Details tblInstituteLogin InstLogin = new tblInstituteLogin(); InstLogin.colInstituteId = dbContext.tblInstituteDetails.Select(x => x.colInstituteId).Max(); InstLogin.colPassword = toins.InstituteDefaultPwd; InstLogin.colUsername = toins.InstituteEmail; InstLogin.colUserType = toins.InstituteUserType; dbContext.tblInstituteLogins.InsertOnSubmit(InstLogin); dbContext.SubmitChanges(); return true; } catch { return false; } }
public bool InsertParentsLoginOTP(DTOParentsLoginDetails tologin) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); tblParentsLoginOTP otpDetail = new tblParentsLoginOTP(); otpDetail.colMobileNumber = tologin.Mobilenumber; otpDetail.colOTP = tologin.Otp; otpDetail.colisUsed = Convert.ToByte(tologin.Isused); dbContext.tblParentsLoginOTPs.InsertOnSubmit(otpDetail); dbContext.SubmitChanges(); return true; } catch (Exception ex) { return false; } }
public bool SaveUpdateInternals(DTOInternals toInt) { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); try { if (dbContext.tblInternalMarks.Where(x => x.colStudentId == toInt.StudentId && x.colMonth == toInt.Month && x.colYear == toInt.Year && x.colSubjectId == toInt.SubjectId).ToList().Count > 0) { tblInternalMark InternalMarks = dbContext.tblInternalMarks.Where(x => x.colStudentId == toInt.StudentId && x.colMonth == toInt.Month && x.colYear == toInt.Year && x.colSubjectId == toInt.SubjectId).FirstOrDefault(); InternalMarks.colBranchId = toInt.BranchId; InternalMarks.colSemesterId = toInt.SemesterId; InternalMarks.colMonth = toInt.Month; InternalMarks.colYear = toInt.Year; InternalMarks.colInstituteId = toInt.InstituteId; InternalMarks.colMarksScored = toInt.MarksScored; InternalMarks.colMaxMarks = toInt.MaxMarks; InternalMarks.colMinMarks = toInt.MinMarks; InternalMarks.colStudentId = toInt.StudentId; InternalMarks.colSubjectId = toInt.SubjectId; InternalMarks.colRemarks = toInt.Remarks; InternalMarks.colDescription = toInt.Description; dbContext.SubmitChanges(); return true; } else { tblInternalMark InternalMarks = new tblInternalMark(); InternalMarks.colBranchId = toInt.BranchId; InternalMarks.colSemesterId = toInt.SemesterId; InternalMarks.colMonth = toInt.Month; InternalMarks.colYear = toInt.Year; InternalMarks.colInstituteId = toInt.InstituteId; InternalMarks.colMarksScored = toInt.MarksScored; InternalMarks.colMaxMarks = toInt.MaxMarks; InternalMarks.colMinMarks = toInt.MinMarks; InternalMarks.colStudentId = toInt.StudentId; InternalMarks.colSubjectId = toInt.SubjectId; InternalMarks.colRemarks = toInt.Remarks; InternalMarks.colDescription = toInt.Description; dbContext.tblInternalMarks.InsertOnSubmit(InternalMarks); dbContext.SubmitChanges(); return true; } } catch { return false; } }
public bool UpdateStudentDetails(DTOStudentRegistration tostud) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); // Student Details tblStudentDetail studDetail = dbContext.tblStudentDetails.Where(x => x.colStudentId == tostud.StudentId).FirstOrDefault(); studDetail.colStudentName = tostud.StudentName; studDetail.colLastName = tostud.LastName; studDetail.colAddress = tostud.Address; studDetail.colFatherName = tostud.FatherName; studDetail.colMotherName = tostud.MotherName; studDetail.colDOB = tostud.DOB; studDetail.colSemesterId = tostud.SemesterId; studDetail.colBranchId = tostud.BranchId; studDetail.colSection = tostud.Section; studDetail.colRollNo = tostud.RollNo; studDetail.colParentsMobileNo = tostud.ParentsMobileNo; studDetail.colParentsEmail = tostud.ParentsEmail; studDetail.colInstituteId = tostud.InstituteId; studDetail.colGender = tostud.Gender; dbContext.SubmitChanges(); return true; } catch { return false; } }
public bool SaveStudentRegistrationExcel(DataTable dt, string instituteId) { try { System.Data.Common.DbTransaction trans = null; using (Campus2CaretakerDataContext db = new Campus2CaretakerDataContext()) { db.Connection.Open(); trans = db.Connection.BeginTransaction(); db.Transaction = trans; for (int i = 0; i < dt.Rows.Count; i++) { tblStudentDetail table = new tblStudentDetail { colStudentName = dt.Rows[i][0].ToString(), colLastName = dt.Rows[i][1].ToString(), colFatherName = dt.Rows[i][2].ToString(), colMotherName = dt.Rows[i][3].ToString(), colDOB = DateTime.Parse(dt.Rows[i][4].ToString()), colSemesterId = int.Parse(dt.Rows[i][5].ToString()), colBranchId = int.Parse(dt.Rows[i][6].ToString()), colSection = dt.Rows[i][7].ToString(), colRollNo = dt.Rows[i][8].ToString(), colParentsMobileNo = dt.Rows[i][9].ToString(), colAddress = dt.Rows[i][10].ToString(), colInstituteId = int.Parse(instituteId), colGender = dt.Rows[i][11].ToString(), colParentsEmail = dt.Rows[i][12].ToString(), }; db.tblStudentDetails.InsertOnSubmit(table); try { db.SubmitChanges(); } catch { if (trans != null) trans.Rollback(); if (db.Connection.State == ConnectionState.Open) db.Connection.Close(); return false; } } trans.Commit(); return true; } } catch { return false; } }
public bool SaveStudentDetails(DTOStudentRegistration tostudentreg) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); tblStudentDetail studDetail = new tblStudentDetail(); studDetail.colStudentName = tostudentreg.StudentName; studDetail.colLastName = tostudentreg.LastName; studDetail.colAddress = tostudentreg.Address; studDetail.colFatherName = tostudentreg.FatherName; studDetail.colMotherName = tostudentreg.MotherName; studDetail.colDOB = tostudentreg.DOB; studDetail.colSemesterId = tostudentreg.SemesterId; studDetail.colBranchId = tostudentreg.BranchId; studDetail.colSection = tostudentreg.Section; studDetail.colRollNo = tostudentreg.RollNo; studDetail.colParentsMobileNo = tostudentreg.ParentsMobileNo; studDetail.colParentsEmail = tostudentreg.ParentsEmail; studDetail.colInstituteId = tostudentreg.InstituteId; studDetail.colGender = tostudentreg.Gender; dbContext.tblStudentDetails.InsertOnSubmit(studDetail); dbContext.SubmitChanges(); return true; } catch (Exception ex) { return false; } }
public bool SavePromoteStudents(int pstudentId, int ptoClass, int ptoSemester) { try { Campus2CaretakerDataContext dbContext = new Campus2CaretakerDataContext(); // Student Details tblStudentDetail studDetail = dbContext.tblStudentDetails.Where(x => x.colStudentId == pstudentId).FirstOrDefault(); studDetail.colSemesterId = ptoSemester; studDetail.colBranchId = ptoClass; dbContext.SubmitChanges(); return true; } catch { return false; } }