/// <summary> /// Gets the total number of records in the CourseEnrollment table based on search parameters /// </summary> internal static int GetRecordCountDynamicWhere(int?enrollmentId, int?courseName, int?studentName, string comments) { CourseEnquiryContext context = new CourseEnquiryContext(); int enrollmentIdValue = int.MinValue; int courseNameValue = int.MinValue; int studentNameValue = int.MinValue; if (enrollmentId != null) { enrollmentIdValue = enrollmentId.Value; } if (courseName != null) { courseNameValue = courseName.Value; } if (studentName != null) { studentNameValue = studentName.Value; } return(context.CourseEnrollment .Where(c => (enrollmentId != null ? c.EnrollmentId == enrollmentIdValue : 1 == 1) && (courseName != null ? c.CourseName == courseNameValue : 1 == 1) && (studentName != null ? c.StudentName == studentNameValue : 1 == 1) && (!String.IsNullOrEmpty(comments) ? c.Comments.Contains(comments) : 1 == 1) ).Count()); }
/// <summary> /// Gets the total number of records in the Student table based on search parameters /// </summary> internal static int GetRecordCountDynamicWhere(int?studenId, string studentName, string emailId, int?contactNumber, string password) { CourseEnquiryContext context = new CourseEnquiryContext(); int studenIdValue = int.MinValue; int contactNumberValue = int.MinValue; if (studenId != null) { studenIdValue = studenId.Value; } if (contactNumber != null) { contactNumberValue = contactNumber.Value; } return(context.Student .Where(s => (studenId != null ? s.StudenId == studenIdValue : 1 == 1) && (!String.IsNullOrEmpty(studentName) ? s.StudentName.Contains(studentName) : 1 == 1) && (!String.IsNullOrEmpty(emailId) ? s.EmailId.Contains(emailId) : 1 == 1) && (contactNumber != null ? s.ContactNumber == contactNumberValue : 1 == 1) && (!String.IsNullOrEmpty(password) ? s.Password.Contains(password) : 1 == 1) ).Count()); }
/// <summary> /// Gets the total number of records in the UserMaster table based on search parameters /// </summary> internal static int GetRecordCountDynamicWhere(int?userId, string userName, string password, string email, DateTime?createdOn, string createdBy, DateTime?modifiedOn, string modifiedBy) { CourseEnquiryContext context = new CourseEnquiryContext(); int userIdValue = int.MinValue; DateTime createdOnValue = DateTime.MinValue; DateTime?modifiedOnValue = null; if (userId != null) { userIdValue = userId.Value; } if (createdOn != null) { createdOnValue = createdOn.Value; } if (modifiedOn != null) { modifiedOnValue = modifiedOn.Value; } return(context.UserMaster .Where(u => (userId != null ? u.UserId == userIdValue : 1 == 1) && (!String.IsNullOrEmpty(userName) ? u.UserName.Contains(userName) : 1 == 1) && (!String.IsNullOrEmpty(password) ? u.Password.Contains(password) : 1 == 1) && (!String.IsNullOrEmpty(email) ? u.Email.Contains(email) : 1 == 1) && (createdOn != null ? u.CreatedOn == createdOnValue : 1 == 1) && (!String.IsNullOrEmpty(createdBy) ? u.CreatedBy.Contains(createdBy) : 1 == 1) && (modifiedOn != null ? u.ModifiedOn == modifiedOnValue : 1 == 1) && (!String.IsNullOrEmpty(modifiedBy) ? u.ModifiedBy.Contains(modifiedBy) : 1 == 1) ).Count()); }
/// <summary> /// Gets the total number of records in the RoleMaster table based on search parameters /// </summary> internal static int GetRecordCountDynamicWhere(int?roleId, string roleDescription, DateTime?createdOn, string createdBy, DateTime?modifiedOn, string modifiedBy) { CourseEnquiryContext context = new CourseEnquiryContext(); int roleIdValue = int.MinValue; DateTime createdOnValue = DateTime.MinValue; DateTime?modifiedOnValue = null; if (roleId != null) { roleIdValue = roleId.Value; } if (createdOn != null) { createdOnValue = createdOn.Value; } if (modifiedOn != null) { modifiedOnValue = modifiedOn.Value; } return(context.RoleMaster .Where(r => (roleId != null ? r.RoleId == roleIdValue : 1 == 1) && (!String.IsNullOrEmpty(roleDescription) ? r.RoleDescription.Contains(roleDescription) : 1 == 1) && (createdOn != null ? r.CreatedOn == createdOnValue : 1 == 1) && (!String.IsNullOrEmpty(createdBy) ? r.CreatedBy.Contains(createdBy) : 1 == 1) && (modifiedOn != null ? r.ModifiedOn == modifiedOnValue : 1 == 1) && (!String.IsNullOrEmpty(modifiedBy) ? r.ModifiedBy.Contains(modifiedBy) : 1 == 1) ).Count()); }
/// <summary> /// Selects UserRoleId and Status columns for use with a DropDownList web control /// </summary> internal static List <UserRoles> SelectUserRolesDropDownListData() { CourseEnquiryContext context = new CourseEnquiryContext(); return((from u in context.UserRoles select new UserRoles { UserRoleId = u.UserRoleId, Status = u.Status }).ToList()); }
/// <summary> /// Selects WorkflowMaster records sorted by the sortByExpression and returns records from the startRowIndex with rows (# of rows) /// </summary> internal static List <WorkflowMaster> SelectSkipAndTake(string sortByExpression, int startRowIndex, int rows) { CourseEnquiryContext context = new CourseEnquiryContext(); if (sortByExpression.Contains(" desc")) { switch (sortByExpression) { case "WorkflowName desc": return(context.WorkflowMaster.OrderByDescending(w => w.WorkflowName).Skip(startRowIndex).Take(rows).ToList()); case "LevelOfApprovals desc": return(context.WorkflowMaster.OrderByDescending(w => w.LevelOfApprovals).Skip(startRowIndex).Take(rows).ToList()); case "CreatedBy desc": return(context.WorkflowMaster.OrderByDescending(w => w.CreatedBy).Skip(startRowIndex).Take(rows).ToList()); case "CreatedOn desc": return(context.WorkflowMaster.OrderByDescending(w => w.CreatedOn).Skip(startRowIndex).Take(rows).ToList()); case "Updatedby desc": return(context.WorkflowMaster.OrderByDescending(w => w.Updatedby).Skip(startRowIndex).Take(rows).ToList()); case "Updatedon desc": return(context.WorkflowMaster.OrderByDescending(w => w.Updatedon).Skip(startRowIndex).Take(rows).ToList()); default: return(context.WorkflowMaster.OrderByDescending(w => w.WorkflowId).Skip(startRowIndex).Take(rows).ToList()); } } else { switch (sortByExpression) { case "WorkflowName": return(context.WorkflowMaster.OrderBy(w => w.WorkflowName).Skip(startRowIndex).Take(rows).ToList()); case "LevelOfApprovals": return(context.WorkflowMaster.OrderBy(w => w.LevelOfApprovals).Skip(startRowIndex).Take(rows).ToList()); case "CreatedBy": return(context.WorkflowMaster.OrderBy(w => w.CreatedBy).Skip(startRowIndex).Take(rows).ToList()); case "CreatedOn": return(context.WorkflowMaster.OrderBy(w => w.CreatedOn).Skip(startRowIndex).Take(rows).ToList()); case "Updatedby": return(context.WorkflowMaster.OrderBy(w => w.Updatedby).Skip(startRowIndex).Take(rows).ToList()); case "Updatedon": return(context.WorkflowMaster.OrderBy(w => w.Updatedon).Skip(startRowIndex).Take(rows).ToList()); default: return(context.WorkflowMaster.OrderBy(w => w.WorkflowId).Skip(startRowIndex).Take(rows).ToList()); } } }
/// <summary> /// Selects EnrollmentId and Comments columns for use with a DropDownList web control /// </summary> internal static List <CourseEnrollment> SelectCourseEnrollmentDropDownListData() { CourseEnquiryContext context = new CourseEnquiryContext(); return((from c in context.CourseEnrollment select new CourseEnrollment { EnrollmentId = c.EnrollmentId, Comments = c.Comments }).ToList()); }
/// <summary> /// Selects RoleId and CreatedBy columns for use with a DropDownList web control /// </summary> internal static List <RoleMaster> SelectRoleMasterDropDownListData() { CourseEnquiryContext context = new CourseEnquiryContext(); return((from r in context.RoleMaster select new RoleMaster { RoleId = r.RoleId, CreatedBy = r.CreatedBy }).ToList()); }
/// <summary> /// Selects UserId and CreatedBy columns for use with a DropDownList web control /// </summary> internal static List <UserMaster> SelectUserMasterDropDownListData() { CourseEnquiryContext context = new CourseEnquiryContext(); return((from u in context.UserMaster select new UserMaster { UserId = u.UserId, CreatedBy = u.CreatedBy }).ToList()); }
/// <summary> /// Selects CourseId and CourseName columns for use with a DropDownList web control /// </summary> internal static List <Course> SelectCourseDropDownListData() { CourseEnquiryContext context = new CourseEnquiryContext(); return((from c in context.Course select new Course { CourseId = c.CourseId, CourseName = c.CourseName }).ToList()); }
/// <summary> /// Selects WorkflowId and WorkflowName columns for use with a DropDownList web control /// </summary> internal static List <WorkflowMaster> SelectWorkflowMasterDropDownListData() { CourseEnquiryContext context = new CourseEnquiryContext(); return((from w in context.WorkflowMaster select new WorkflowMaster { WorkflowId = w.WorkflowId, WorkflowName = w.WorkflowName }).ToList()); }
/// <summary> /// Selects StudenId and StudentName columns for use with a DropDownList web control /// </summary> internal static List <Student> SelectStudentDropDownListData() { CourseEnquiryContext context = new CourseEnquiryContext(); return((from s in context.Student select new Student { StudenId = s.StudenId, StudentName = s.StudentName }).ToList()); }
/// <summary> /// Deletes a record based on primary key(s) /// </summary> internal static void Delete(int enrollmentId) { CourseEnquiryContext context = new CourseEnquiryContext(); var objCourseEnrollment = context.CourseEnrollment.Where(c => c.EnrollmentId == enrollmentId).FirstOrDefault(); if (objCourseEnrollment != null) { context.CourseEnrollment.Remove(objCourseEnrollment); context.SaveChanges(); } }
/// <summary> /// Deletes a record based on primary key(s) /// </summary> internal static void Delete(int courseId) { CourseEnquiryContext context = new CourseEnquiryContext(); var objCourse = context.Course.Where(c => c.CourseId == courseId).FirstOrDefault(); if (objCourse != null) { context.Course.Remove(objCourse); context.SaveChanges(); } }
/// <summary> /// Deletes a record based on primary key(s) /// </summary> internal static void Delete(int userId) { CourseEnquiryContext context = new CourseEnquiryContext(); var objUserMaster = context.UserMaster.Where(u => u.UserId == userId).FirstOrDefault(); if (objUserMaster != null) { context.UserMaster.Remove(objUserMaster); context.SaveChanges(); } }
/// <summary> /// Deletes a record based on primary key(s) /// </summary> internal static void Delete(int roleId) { CourseEnquiryContext context = new CourseEnquiryContext(); var objRoleMaster = context.RoleMaster.Where(r => r.RoleId == roleId).FirstOrDefault(); if (objRoleMaster != null) { context.RoleMaster.Remove(objRoleMaster); context.SaveChanges(); } }
/// <summary> /// Deletes a record based on primary key(s) /// </summary> internal static void Delete(int workflowId) { CourseEnquiryContext context = new CourseEnquiryContext(); var objWorkflowMaster = context.WorkflowMaster.Where(w => w.WorkflowId == workflowId).FirstOrDefault(); if (objWorkflowMaster != null) { context.WorkflowMaster.Remove(objWorkflowMaster); context.SaveChanges(); } }
/// <summary> /// Deletes a record based on primary key(s) /// </summary> internal static void Delete(int studenId) { CourseEnquiryContext context = new CourseEnquiryContext(); var objStudent = context.Student.Where(s => s.StudenId == studenId).FirstOrDefault(); if (objStudent != null) { context.Student.Remove(objStudent); context.SaveChanges(); } }
/// <summary> /// Selects RoleMaster records sorted by the sortByExpression and returns records from the startRowIndex with rows (# of rows) /// </summary> internal static List <RoleMaster> SelectSkipAndTake(string sortByExpression, int startRowIndex, int rows) { CourseEnquiryContext context = new CourseEnquiryContext(); if (sortByExpression.Contains(" desc")) { switch (sortByExpression) { case "RoleDescription desc": return(context.RoleMaster.OrderByDescending(r => r.RoleDescription).Skip(startRowIndex).Take(rows).ToList()); case "CreatedOn desc": return(context.RoleMaster.OrderByDescending(r => r.CreatedOn).Skip(startRowIndex).Take(rows).ToList()); case "CreatedBy desc": return(context.RoleMaster.OrderByDescending(r => r.CreatedBy).Skip(startRowIndex).Take(rows).ToList()); case "ModifiedOn desc": return(context.RoleMaster.OrderByDescending(r => r.ModifiedOn).Skip(startRowIndex).Take(rows).ToList()); case "ModifiedBy desc": return(context.RoleMaster.OrderByDescending(r => r.ModifiedBy).Skip(startRowIndex).Take(rows).ToList()); default: return(context.RoleMaster.OrderByDescending(r => r.RoleId).Skip(startRowIndex).Take(rows).ToList()); } } else { switch (sortByExpression) { case "RoleDescription": return(context.RoleMaster.OrderBy(r => r.RoleDescription).Skip(startRowIndex).Take(rows).ToList()); case "CreatedOn": return(context.RoleMaster.OrderBy(r => r.CreatedOn).Skip(startRowIndex).Take(rows).ToList()); case "CreatedBy": return(context.RoleMaster.OrderBy(r => r.CreatedBy).Skip(startRowIndex).Take(rows).ToList()); case "ModifiedOn": return(context.RoleMaster.OrderBy(r => r.ModifiedOn).Skip(startRowIndex).Take(rows).ToList()); case "ModifiedBy": return(context.RoleMaster.OrderBy(r => r.ModifiedBy).Skip(startRowIndex).Take(rows).ToList()); default: return(context.RoleMaster.OrderBy(r => r.RoleId).Skip(startRowIndex).Take(rows).ToList()); } } }
/// <summary> /// Inserts a record /// </summary> internal static int Insert(CourseEnrollment objCourseEnrollment) { CourseEnquiryContext context = new CourseEnquiryContext(); CourseEnrollment entCourseEnrollment = new CourseEnrollment(); entCourseEnrollment.CourseName = objCourseEnrollment.CourseName; entCourseEnrollment.StudentName = objCourseEnrollment.StudentName; entCourseEnrollment.Comments = objCourseEnrollment.Comments; context.CourseEnrollment.Add(entCourseEnrollment); context.SaveChanges(); return(entCourseEnrollment.EnrollmentId); }
/// <summary> /// Inserts a record /// </summary> internal static int Insert(UserRoles objUserRoles) { CourseEnquiryContext context = new CourseEnquiryContext(); UserRoles entUserRoles = new UserRoles(); entUserRoles.UserId = objUserRoles.UserId; entUserRoles.RoleId = objUserRoles.RoleId; entUserRoles.Status = objUserRoles.Status; context.UserRoles.Add(entUserRoles); context.SaveChanges(); return(entUserRoles.UserRoleId); }
/// <summary> /// Updates a record /// </summary> internal static void Update(UserRoles objUserRoles) { CourseEnquiryContext context = new CourseEnquiryContext(); UserRoles entUserRoles = context.UserRoles.Where(u => u.UserRoleId == objUserRoles.UserRoleId).FirstOrDefault(); if (entUserRoles != null) { entUserRoles.UserId = objUserRoles.UserId; entUserRoles.RoleId = objUserRoles.RoleId; entUserRoles.Status = objUserRoles.Status; context.SaveChanges(); } }
/// <summary> /// Updates a record /// </summary> internal static void Update(CourseEnrollment objCourseEnrollment) { CourseEnquiryContext context = new CourseEnquiryContext(); CourseEnrollment entCourseEnrollment = context.CourseEnrollment.Where(c => c.EnrollmentId == objCourseEnrollment.EnrollmentId).FirstOrDefault(); if (entCourseEnrollment != null) { entCourseEnrollment.CourseName = objCourseEnrollment.CourseName; entCourseEnrollment.StudentName = objCourseEnrollment.StudentName; entCourseEnrollment.Comments = objCourseEnrollment.Comments; context.SaveChanges(); } }
/// <summary> /// Inserts a record /// </summary> internal static int Insert(Course objCourse) { CourseEnquiryContext context = new CourseEnquiryContext(); Course entCourse = new Course(); entCourse.CourseName = objCourse.CourseName; entCourse.StartDate = objCourse.StartDate; entCourse.EndDate = objCourse.EndDate; entCourse.Fees = objCourse.Fees; context.Course.Add(entCourse); context.SaveChanges(); return(entCourse.CourseId); }
/// <summary> /// Updates a record /// </summary> internal static void Update(Course objCourse) { CourseEnquiryContext context = new CourseEnquiryContext(); Course entCourse = context.Course.Where(c => c.CourseId == objCourse.CourseId).FirstOrDefault(); if (entCourse != null) { entCourse.CourseName = objCourse.CourseName; entCourse.StartDate = objCourse.StartDate; entCourse.EndDate = objCourse.EndDate; entCourse.Fees = objCourse.Fees; context.SaveChanges(); } }
/// <summary> /// Inserts a record /// </summary> internal static int Insert(Student objStudent) { CourseEnquiryContext context = new CourseEnquiryContext(); Student entStudent = new Student(); entStudent.StudentName = objStudent.StudentName; entStudent.EmailId = objStudent.EmailId; entStudent.ContactNumber = objStudent.ContactNumber; entStudent.Password = objStudent.Password; context.Student.Add(entStudent); context.SaveChanges(); return(entStudent.StudenId); }
/// <summary> /// Updates a record /// </summary> internal static void Update(Student objStudent) { CourseEnquiryContext context = new CourseEnquiryContext(); Student entStudent = context.Student.Where(s => s.StudenId == objStudent.StudenId).FirstOrDefault(); if (entStudent != null) { entStudent.StudentName = objStudent.StudentName; entStudent.EmailId = objStudent.EmailId; entStudent.ContactNumber = objStudent.ContactNumber; entStudent.Password = objStudent.Password; context.SaveChanges(); } }
/// <summary> /// Inserts a record /// </summary> internal static int Insert(RoleMaster objRoleMaster) { CourseEnquiryContext context = new CourseEnquiryContext(); RoleMaster entRoleMaster = new RoleMaster(); entRoleMaster.RoleDescription = objRoleMaster.RoleDescription; entRoleMaster.CreatedOn = objRoleMaster.CreatedOn; entRoleMaster.CreatedBy = objRoleMaster.CreatedBy; entRoleMaster.ModifiedOn = objRoleMaster.ModifiedOn; entRoleMaster.ModifiedBy = objRoleMaster.ModifiedBy; context.RoleMaster.Add(entRoleMaster); context.SaveChanges(); return(entRoleMaster.RoleId); }
/// <summary> /// Updates a record /// </summary> internal static void Update(RoleMaster objRoleMaster) { CourseEnquiryContext context = new CourseEnquiryContext(); RoleMaster entRoleMaster = context.RoleMaster.Where(r => r.RoleId == objRoleMaster.RoleId).FirstOrDefault(); if (entRoleMaster != null) { entRoleMaster.RoleDescription = objRoleMaster.RoleDescription; entRoleMaster.CreatedOn = objRoleMaster.CreatedOn; entRoleMaster.CreatedBy = objRoleMaster.CreatedBy; entRoleMaster.ModifiedOn = objRoleMaster.ModifiedOn; entRoleMaster.ModifiedBy = objRoleMaster.ModifiedBy; context.SaveChanges(); } }
/// <summary> /// Updates a record /// </summary> internal static void Update(WorkflowMaster objWorkflowMaster) { CourseEnquiryContext context = new CourseEnquiryContext(); WorkflowMaster entWorkflowMaster = context.WorkflowMaster.Where(w => w.WorkflowId == objWorkflowMaster.WorkflowId).FirstOrDefault(); if (entWorkflowMaster != null) { entWorkflowMaster.WorkflowName = objWorkflowMaster.WorkflowName; entWorkflowMaster.LevelOfApprovals = objWorkflowMaster.LevelOfApprovals; entWorkflowMaster.CreatedBy = objWorkflowMaster.CreatedBy; entWorkflowMaster.CreatedOn = objWorkflowMaster.CreatedOn; entWorkflowMaster.Updatedby = objWorkflowMaster.Updatedby; entWorkflowMaster.Updatedon = objWorkflowMaster.Updatedon; context.SaveChanges(); } }