public static List <City> GetListCities() { var cityList = new List <City>(); try { using (var db = new SMSContext()) { cityList = db.Cities.ToList(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(cityList); }
public static List <PhoneDirectoryDetail> GetListPhoneDirectoryDetails() { var phoneDirectoryDetailList = new List <PhoneDirectoryDetail>(); try { using (var db = new SMSContext()) { phoneDirectoryDetailList = db.PhoneDirectoryDetails.ToList(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(phoneDirectoryDetailList); }
public static PhoneDirectory GetPhoneDirectory(int phoneDirectoryId) { var phoneDirectoryObj = new PhoneDirectory(); try { using (var db = new SMSContext()) { phoneDirectoryObj = db.PhoneDirectories.Single(x => x.Id == phoneDirectoryId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(phoneDirectoryObj); }
public static void UpdateBranch(Branch branch) { try { using (var db = new SMSContext()) { var tempBranch = db.Branches.Single(x => x.Id == branch.Id); tempBranch.BranchName = branch.BranchName; tempBranch.CityId = branch.CityId; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static List <Branch> GetListBranchesByCityId(int cityId) { var branchObj = new List <Branch>(); try { using (var db = new SMSContext()) { branchObj = db.Branches.Where(x => x.CityId == cityId).ToList(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(branchObj); }
public static List <SystemLog> GetAllSystemLog() { var systemLogList = new List <SystemLog>(); try { using (var db = new SMSContext()) { systemLogList = db.SystemLogs.ToList(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(systemLogList); }
public static void UpdatePhoneDirectory(PhoneDirectory phoneDirectory) { try { using (var db = new SMSContext()) { var tempPhoneDirectory = db.PhoneDirectories.Single(x => x.Id == phoneDirectory.Id); tempPhoneDirectory.ContactPerson = phoneDirectory.ContactPerson; tempPhoneDirectory.Description = phoneDirectory.Description; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static Class GetClassById(int classId) { var classobj = new Class(); try { using (var db = new SMSContext()) { classobj = db.Classes.Single(x => x.Id == classId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(classobj); }
public static void DeleteSystemLog(int systemLogId) { try { using (var db = new SMSContext()) { var obj = db.SystemLogs.Where(x => x.Id == systemLogId).FirstOrDefault(); db.SystemLogs.Remove(obj); db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static Section GetSectionById(int sectionId) { var section = new Section(); try { using (var db = new SMSContext()) { section = db.Sections.Single(x => x.Id == sectionId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(section); }
public static List <RoleItem> GetAllRoleItems() { var roleItemList = new List <RoleItem>(); try { using (var db = new SMSContext()) { roleItemList = db.RoleItems.ToList(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(roleItemList); }
public static Subject GetSubjectById(int subjectId) { var subjectObj = new Subject(); try { using (var db = new SMSContext()) { subjectObj = db.Subjects.Single(x => x.Id == subjectId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(subjectObj); }
public static void UpdateSession(Session session) { try { using (var db = new SMSContext()) { var tempSession = db.Sessions.Single(x => x.Id == session.Id); tempSession.SessionName = session.SessionName; tempSession.IsCurrent = session.IsCurrent; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static Module GetModuleById(int moduleId) { var moduleobj = new Module(); try { using (var db = new SMSContext()) { moduleobj = db.Modules.Single(x => x.Id == moduleId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(moduleobj); }
public static Grade GetGradeById(int gradeId) { var grade = new Grade(); try { using (var db = new SMSContext()) { grade = db.Grades.Single(x => x.Id == gradeId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(grade); }
public static void UpdatePhoneDirectoryDetail(PhoneDirectoryDetail phoneDirectoryDetail) { try { using (var db = new SMSContext()) { var tempPhoneDirectoryDetail = db.PhoneDirectoryDetails.Single(x => x.Id == phoneDirectoryDetail.Id); tempPhoneDirectoryDetail.PhoneDirectoryId = phoneDirectoryDetail.PhoneDirectoryId; tempPhoneDirectoryDetail.PhoneNumber = phoneDirectoryDetail.PhoneNumber; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static List <User> GetAllUser() { var userList = new List <User>(); try { using (var db = new SMSContext()) { userList = db.Users.ToList(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(userList); }
public static RoleItem GetIdByRoleItem(int roleItemId) { var roleItemObj = new RoleItem(); try { using (var db = new SMSContext()) { roleItemObj = db.RoleItems.Single(x => x.Id == roleItemId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(roleItemObj); }
public static UserRole GetIdByUserRole(int userRoleId) { var userRoleObj = new UserRole(); try { using (var db = new SMSContext()) { userRoleObj = db.UserRoles.Single(x => x.Id == userRoleId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(userRoleObj); }
public static SystemLog GetSystemLogById(int systemLogId) { var systemLog = new SystemLog(); try { using (var db = new SMSContext()) { systemLog = db.SystemLogs.Single(x => x.Id == systemLogId); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(systemLog); }
public static void UpdatePreviousSchool(PreviousSchool previousSchool) { try { using (var db = new SMSContext()) { var tempPreviousSchool = db.PreviousSchools.Single(x => x.Id == previousSchool.Id); tempPreviousSchool.StudentId = previousSchool.StudentId; tempPreviousSchool.InstituteName = previousSchool.InstituteName; tempPreviousSchool.JoinDate = previousSchool.JoinDate; tempPreviousSchool.LeaveDate = previousSchool.LeaveDate; } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static void UpdateModule(Module module) { try { using (var db = new SMSContext()) { var tempModule = db.Modules.Single(x => x.Id == module.Id); tempModule.ModuleName = module.ModuleName; tempModule.Subject = module.Subject; tempModule.SubjectId = module.SubjectId; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static void UpdateClass(Class classObj) { try { using (var db = new SMSContext()) { var tempClass = db.Classes.Single(x => x.Id == classObj.Id); tempClass.ClassName = classObj.ClassName; tempClass.GradeId = classObj.GradeId; tempClass.Grade = classObj.Grade; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static User GetUserValidate(string username, string password) { var user = new User(); try { using (var db = new SMSContext()) { user = db.Users.Where(x => x.Username == username && x.Password == password).SingleOrDefault(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } return(user); }
public static void UpdateUserRole(UserRole userRole) { try { using (var db = new SMSContext()) { var objUserRole = db.UserRoles.Single(x => x.Id == userRole.Id); objUserRole.UserId = userRole.UserId; objUserRole.User = userRole.User; objUserRole.RoleId = userRole.RoleId; objUserRole.Role = userRole.Role; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static void UpdateRoleItem(RoleItem roleItem) { try { using (var db = new SMSContext()) { var objRoleitem = db.RoleItems.Single(x => x.Id == roleItem.Id); objRoleitem.RoleId = roleItem.RoleId; objRoleitem.Role = roleItem.Role; objRoleitem.ItemId = roleItem.ItemId; objRoleitem.Item = roleItem.Item; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static void UpdateStudentEnrollment(StudentEnrollment studentEnrollment) { try { using (var db = new SMSContext()) { var tempStudentEnrollment = db.StudentEnrollments.Single(x => x.Id == studentEnrollment.Id); tempStudentEnrollment.StudentId = studentEnrollment.StudentId; tempStudentEnrollment.SectionId = studentEnrollment.SectionId; tempStudentEnrollment.SessionId = studentEnrollment.SessionId; tempStudentEnrollment.EnrollmentDate = studentEnrollment.EnrollmentDate; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static void UpdateSystemLog(SystemLog systemLog) { try { using (var db = new SMSContext()) { var obj = db.SystemLogs.Where(x => x.Id == systemLog.Id).SingleOrDefault(); obj.Date = systemLog.Date; obj.Event = systemLog.Event; obj.Time = systemLog.Time; obj.LoggedInUser = systemLog.LoggedInUser; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static void UpdateUser(User user) { try { using (var db = new SMSContext()) { var tempUser = db.Users.Single(x => x.Id == user.Id); tempUser.FirstName = user.FirstName; tempUser.LastName = user.LastName; tempUser.Password = user.Password; tempUser.EmailAddress = user.EmailAddress; tempUser.Phone1 = user.Phone1; tempUser.Phone2 = user.Phone2; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public static void UpdateCompany(Company company) { try { using (var db = new SMSContext()) { var tempCompany = db.Companies.Single(x => x.Id == company.Id); tempCompany.CompanyName = company.CompanyName; tempCompany.Logo = company.Logo; tempCompany.TagLink = company.TagLink; tempCompany.DetailDescription = company.DetailDescription; tempCompany.ShortDescription = company.ShortDescription; tempCompany.PhoneNumber = company.PhoneNumber; tempCompany.FounderName = company.FounderName; tempCompany.FoundedOn = company.FoundedOn; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }