/// <summary>
        /// Gets the total number of records in the Student table based on search parameters
        /// </summary>
        internal static int GetRecordCountDynamicWhere(int?studentId, string studentName, string emailId, Int64?contactNo, string studentPassword)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            int   studentIdValue = int.MinValue;
            Int64 contactNoValue = Int64.MinValue;

            if (studentId != null)
            {
                studentIdValue = studentId.Value;
            }

            if (contactNo != null)
            {
                contactNoValue = contactNo.Value;
            }

            return(context.Student
                   .Where(s =>
                          (studentId != null ? s.StudentId == studentIdValue : 1 == 1) &&
                          (!String.IsNullOrEmpty(studentName) ? s.StudentName.Contains(studentName) : 1 == 1) &&
                          (!String.IsNullOrEmpty(emailId) ? s.EmailId.Contains(emailId) : 1 == 1) &&
                          (contactNo != null ? s.ContactNo == contactNoValue : 1 == 1) &&
                          (!String.IsNullOrEmpty(studentPassword) ? s.StudentPassword.Contains(studentPassword) : 1 == 1)
                          ).Count());
        }
Exemplo n.º 2
0
        /// <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)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            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 Admin records sorted by the sortByExpression and returns records from the startRowIndex with rows (# of rows)
        /// </summary>
        internal static List <Admin> SelectSkipAndTake(string sortByExpression, int startRowIndex, int rows)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            if (sortByExpression.Contains(" desc"))
            {
                switch (sortByExpression)
                {
                case "AdminName desc":
                    return(context.Admin.OrderByDescending(a => a.AdminName).Skip(startRowIndex).Take(rows).ToList());

                case "AdminPassword desc":
                    return(context.Admin.OrderByDescending(a => a.AdminPassword).Skip(startRowIndex).Take(rows).ToList());

                default:
                    return(context.Admin.OrderByDescending(a => a.AdminId).Skip(startRowIndex).Take(rows).ToList());
                }
            }
            else
            {
                switch (sortByExpression)
                {
                case "AdminName":
                    return(context.Admin.OrderBy(a => a.AdminName).Skip(startRowIndex).Take(rows).ToList());

                case "AdminPassword":
                    return(context.Admin.OrderBy(a => a.AdminPassword).Skip(startRowIndex).Take(rows).ToList());

                default:
                    return(context.Admin.OrderBy(a => a.AdminId).Skip(startRowIndex).Take(rows).ToList());
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the total number of records in the CourseEnrollmentInfo table based on search parameters
        /// </summary>
        internal static int GetRecordCountDynamicWhere(int?enrollmentId, int?courseId, int?studentId, string comments)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            int enrollmentIdValue = int.MinValue;
            int courseIdValue     = int.MinValue;
            int studentIdValue    = int.MinValue;

            if (enrollmentId != null)
            {
                enrollmentIdValue = enrollmentId.Value;
            }

            if (courseId != null)
            {
                courseIdValue = courseId.Value;
            }

            if (studentId != null)
            {
                studentIdValue = studentId.Value;
            }

            return(context.CourseEnrollmentInfo
                   .Where(c =>
                          (enrollmentId != null ? c.EnrollmentId == enrollmentIdValue : 1 == 1) &&
                          (courseId != null ? c.CourseId == courseIdValue : 1 == 1) &&
                          (studentId != null ? c.StudentId == studentIdValue : 1 == 1) &&
                          (!String.IsNullOrEmpty(comments) ? c.Comments.Contains(comments) : 1 == 1)
                          ).Count());
        }
Exemplo n.º 5
0
        /// <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)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            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());
        }
Exemplo n.º 6
0
        /// <summary>
        /// Selects EnrollmentId and Comments columns for use with a DropDownList web control
        /// </summary>
        internal static List <CourseEnrollmentInfo> SelectCourseEnrollmentInfoDropDownListData()
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            return((from c in context.CourseEnrollmentInfo
                    select new CourseEnrollmentInfo {
                EnrollmentId = c.EnrollmentId, Comments = c.Comments
            }).ToList());
        }
Exemplo n.º 7
0
        /// <summary>
        /// Selects RoleId and CreatedBy columns for use with a DropDownList web control
        /// </summary>
        internal static List <RoleMaster> SelectRoleMasterDropDownListData()
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            return((from r in context.RoleMaster
                    select new RoleMaster {
                RoleId = r.RoleId, CreatedBy = r.CreatedBy
            }).ToList());
        }
Exemplo n.º 8
0
        /// <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)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            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());
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Selects UserRoleId and Status columns for use with a DropDownList web control
        /// </summary>
        internal static List <UserRoles> SelectUserRolesDropDownListData()
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            return((from u in context.UserRoles
                    select new UserRoles {
                UserRoleId = u.UserRoleId, Status = u.Status
            }).ToList());
        }
Exemplo n.º 10
0
        /// <summary>
        /// Selects UserId and CreatedBy columns for use with a DropDownList web control
        /// </summary>
        internal static List <UserMaster> SelectUserMasterDropDownListData()
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            return((from u in context.UserMaster
                    select new UserMaster {
                UserId = u.UserId, CreatedBy = u.CreatedBy
            }).ToList());
        }
        /// <summary>
        /// Selects AdminId and AdminName columns for use with a DropDownList web control
        /// </summary>
        internal static List <Admin> SelectAdminDropDownListData()
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            return((from a in context.Admin
                    select new Admin {
                AdminId = a.AdminId, AdminName = a.AdminName
            }).ToList());
        }
        /// <summary>
        /// Selects StudentId and StudentName columns for use with a DropDownList web control
        /// </summary>
        internal static List <Student> SelectStudentDropDownListData()
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            return((from s in context.Student
                    select new Student {
                StudentId = s.StudentId, StudentName = s.StudentName
            }).ToList());
        }
Exemplo n.º 13
0
        /// <summary>
        /// Selects WorkflowId and WorkflowName columns for use with a DropDownList web control
        /// </summary>
        internal static List <WorkflowMaster> SelectWorkflowMasterDropDownListData()
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            return((from w in context.WorkflowMaster
                    select new WorkflowMaster {
                WorkflowId = w.WorkflowId, WorkflowName = w.WorkflowName
            }).ToList());
        }
        /// <summary>
        /// Selects CourseId and CourseName columns for use with a DropDownList web control
        /// </summary>
        internal static List <Course> SelectCourseDropDownListData()
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            return((from c in context.Course
                    select new Course {
                CourseId = c.CourseId, CourseName = c.CourseName
            }).ToList());
        }
        /// <summary>
        /// Deletes a record based on primary key(s)
        /// </summary>
        internal static void Delete(int adminId)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            var objAdmin = context.Admin.Where(a => a.AdminId == adminId).FirstOrDefault();

            if (objAdmin != null)
            {
                context.Admin.Remove(objAdmin);
                context.SaveChanges();
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Deletes a record based on primary key(s)
        /// </summary>
        internal static void Delete(int userRoleId)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            var objUserRoles = context.UserRoles.Where(u => u.UserRoleId == userRoleId).FirstOrDefault();

            if (objUserRoles != null)
            {
                context.UserRoles.Remove(objUserRoles);
                context.SaveChanges();
            }
        }
        /// <summary>
        /// Deletes a record based on primary key(s)
        /// </summary>
        internal static void Delete(int studentId)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            var objStudent = context.Student.Where(s => s.StudentId == studentId).FirstOrDefault();

            if (objStudent != null)
            {
                context.Student.Remove(objStudent);
                context.SaveChanges();
            }
        }
        /// <summary>
        /// Deletes a record based on primary key(s)
        /// </summary>
        internal static void Delete(int courseId)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            var objCourse = context.Course.Where(c => c.CourseId == courseId).FirstOrDefault();

            if (objCourse != null)
            {
                context.Course.Remove(objCourse);
                context.SaveChanges();
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Deletes a record based on primary key(s)
        /// </summary>
        internal static void Delete(int workflowId)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            var objWorkflowMaster          = context.WorkflowMaster.Where(w => w.WorkflowId == workflowId).FirstOrDefault();

            if (objWorkflowMaster != null)
            {
                context.WorkflowMaster.Remove(objWorkflowMaster);
                context.SaveChanges();
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// Deletes a record based on primary key(s)
        /// </summary>
        internal static void Delete(int roleId)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            var objRoleMaster = context.RoleMaster.Where(r => r.RoleId == roleId).FirstOrDefault();

            if (objRoleMaster != null)
            {
                context.RoleMaster.Remove(objRoleMaster);
                context.SaveChanges();
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Deletes a record based on primary key(s)
        /// </summary>
        internal static void Delete(int enrollmentId)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            var objCourseEnrollmentInfo    = context.CourseEnrollmentInfo.Where(c => c.EnrollmentId == enrollmentId).FirstOrDefault();

            if (objCourseEnrollmentInfo != null)
            {
                context.CourseEnrollmentInfo.Remove(objCourseEnrollmentInfo);
                context.SaveChanges();
            }
        }
        /// <summary>
        /// Updates a record
        /// </summary>
        internal static void Update(Admin objAdmin)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            Admin entAdmin = context.Admin.Where(a => a.AdminId == objAdmin.AdminId).FirstOrDefault();

            if (entAdmin != null)
            {
                entAdmin.AdminName     = objAdmin.AdminName;
                entAdmin.AdminPassword = objAdmin.AdminPassword;

                context.SaveChanges();
            }
        }
        /// <summary>
        /// Inserts a record
        /// </summary>
        internal static int Insert(Admin objAdmin)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            Admin entAdmin = new Admin();

            entAdmin.AdminName     = objAdmin.AdminName;
            entAdmin.AdminPassword = objAdmin.AdminPassword;

            context.Admin.Add(entAdmin);
            context.SaveChanges();

            return(entAdmin.AdminId);
        }
Exemplo n.º 24
0
        /// <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)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();

            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());
                }
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Updates a record
        /// </summary>
        internal static void Update(UserRoles objUserRoles)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            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();
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Inserts a record
        /// </summary>
        internal static int Insert(UserRoles objUserRoles)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            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);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Updates a record
        /// </summary>
        internal static void Update(CourseEnrollmentInfo objCourseEnrollmentInfo)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            CourseEnrollmentInfo   entCourseEnrollmentInfo = context.CourseEnrollmentInfo.Where(c => c.EnrollmentId == objCourseEnrollmentInfo.EnrollmentId).FirstOrDefault();

            if (entCourseEnrollmentInfo != null)
            {
                entCourseEnrollmentInfo.CourseId  = objCourseEnrollmentInfo.CourseId;
                entCourseEnrollmentInfo.StudentId = objCourseEnrollmentInfo.StudentId;
                entCourseEnrollmentInfo.Comments  = objCourseEnrollmentInfo.Comments;

                context.SaveChanges();
            }
        }
        /// <summary>
        /// Updates a record
        /// </summary>
        internal static void Update(Student objStudent)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            Student entStudent             = context.Student.Where(s => s.StudentId == objStudent.StudentId).FirstOrDefault();

            if (entStudent != null)
            {
                entStudent.StudentName     = objStudent.StudentName;
                entStudent.EmailId         = objStudent.EmailId;
                entStudent.ContactNo       = objStudent.ContactNo;
                entStudent.StudentPassword = objStudent.StudentPassword;

                context.SaveChanges();
            }
        }
        /// <summary>
        /// Updates a record
        /// </summary>
        internal static void Update(Course objCourse)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            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)
        {
            CourseEnquiryDBContext context = new CourseEnquiryDBContext();
            Student entStudent             = new Student();

            entStudent.StudentName     = objStudent.StudentName;
            entStudent.EmailId         = objStudent.EmailId;
            entStudent.ContactNo       = objStudent.ContactNo;
            entStudent.StudentPassword = objStudent.StudentPassword;

            context.Student.Add(entStudent);
            context.SaveChanges();

            return(entStudent.StudentId);
        }