public void AddStream(StreamTableViewModel model) { var newstream = new StreamTable { Stream_Code = model.Stream_Code, Description = model.Description }; uow.Repository <StreamTable>().Insert(newstream); uow.Save(); }
public void AddGroup(GradesViewModels model) { Grade gr = new Grade { Grade_id = model.Grade_id, GradeName = model.GradeName }; uow.Repository <Grade>().Insert(gr); uow.Save(); }
public void AddSubject(SubjectsViewModel model) { var newsubject = new Subjects { Subject_Code = model.Subject_Code, DescriptiveTitle = model.DescriptiveTitle, Stream_Code = model.Stream_Code }; uow.Repository <Subjects>().Insert(newsubject); uow.Save(); }
public void AddClassGroup(ClassGroupViewModels model) { ClassGroupe grp = new ClassGroupe { ClassGroupe_id = model.ClassGroupe_id, GroupeName = model.GroupeName, Grade_id = model.Grade_id, }; uow.Repository <ClassGroupe>().Insert(grp); uow.Save(); }
public void UpdateStatus(ViewApplicationViewModel viewmodel) { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { var application = uow.Repository <Application>().GetById(viewmodel.IdNumber); if (application != null) { application.Status = viewmodel.Status; uow.Repository <Application>().Update(application); uow.Save(); } } }
private Employee getDataWorkShiftByEmpId(int empId) { var t = _unitOfWork.Repository <Employee>().GetAll().Where(x => x.Active == true && x.Id == empId) .Include(y => y.WorkingShift) .ThenInclude(z => z.Store) .ThenInclude(j => j.Brand) .Include(y => y.CheckFace) .ThenInclude(z => z.FaceScanMachine) .ThenInclude(j => j.Store) .FirstOrDefault(); return(t); }
public List <StaffViewModel> GetAllStaff() { using (var uow = new UnitOfWork.UnitOfWork()) { return (uow.Repository <Staff>().GetAll() .Select( x => new StaffViewModel() { Stuff_Number = x.Stuff_Number, FirstName = x.FirstName, LastName = x.LastName, Registration_Date = x.Registration_Date, Gender = x.Gender, ContactNumber = x.ContactNumber, Email = x.Email, Password = x.Password, AddPhoto = x.AddPhoto, IdentityNumber = x.IdentityNumber, Role = x.Role, }) .ToList()); } }
public void AppClassMark(ClassMarkViewModel model) { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { var mark = new ClassMark { Student_No = model.Student_No, Student_name = model.Student_name, ClassGroupe_id = model.ClassGroupe_id, Subject1 = model.Subject1, Subject2 = model.Subject2, mark = model.mark, mark12 = model.mark12, mark21 = model.mark21, mark23 = model.mark32, mark32 = model.mark32, Subject3 = model.Subject3, Subject4 = model.Subject4, Subject5 = model.Subject5, }; uow.Repository <ClassMark>().Insert(mark); uow.Save(); } }
public void AddStudentMark(StudentMarkViewModel model) { int? m = model.mark; string res = ""; if (m >= 50) { res = model.result = "Pass"; } else if (m < 50) { res = model.result = "Fail"; } else if (m == 0) { res = ""; } var tb = new StudentMarks { Student_Number = model.Student_Number, Student_Name = model.Student_Name, Subject_Code = model.Subject_Code, GroupeName = model.GroupeName, ClassGroupe_id = model.ClassGroupe_id, mark = model.mark, result = res }; uow.Repository <StudentMarks>().Insert(tb); uow.Save(); }
public string loginFireBase(FirebaseToken decodedToken, string tokenFcm) { string json = null; string uid = decodedToken.Uid; decodedToken.Claims.TryGetValue("email", out tmp); string email = (string)tmp; TokenUser tokenUser = new TokenUser { Username = email, Uid = uid, FcmToken = tokenFcm }; var employee = _unitOfWork.Repository <Employee>().Find(e => e.Email.Equals(tokenUser.Username)); if (employee != null) { var tokenString = CommonUtils.GenerateJSONWebToken(_config, tokenUser);// convert JWT tokenUser.JwtToken = tokenString;; if (_unitOfWork.Repository <TokenUser>().Find(e => tokenUser.Uid.Equals(e.Uid)) == null) { _unitOfWork.Repository <TokenUser>().Insert(tokenUser);//add uid _unitOfWork.Commit(); } else { TokenUser updateToken = _unitOfWork.Repository <TokenUser>().Find(e => tokenUser.Uid == e.Uid); updateToken.JwtToken = tokenString; updateToken.FcmToken = tokenFcm; _unitOfWork.Commit(); } JObject newO = new JObject { new JProperty("email", tokenUser.Username), new JProperty("tokenString", tokenString), new JProperty("id", employee.Id), new JProperty("username", employee.Name), new JProperty("image", employee.Image) }; //add JWT in json response json = JsonConvert.SerializeObject(newO, Formatting.Indented); } return(json); }
public ViewApplicationViewModel GetApplication(string id) { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { var application = uow.Repository <Application>().GetById(id); return(new ViewApplicationViewModel { IdNumber = application.IDNumber, Phone = application.Phone, Status = application.Status, ReportCopy = application.ReportCopy }); } }
public List <AssignTeacherToClassViewmodel> GetAllAssignedTeacher() { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { return(uow.Repository <AssignTeacherToClass>().GetAll().Select(t => new AssignTeacherToClassViewmodel { StaffNumber = t.StaffNumber, GradeGroupId = t.GradeGroupId, }).ToList()); }; }
public List <AssignTeacherToSubjectViewModel> GetAllAssignedTeacherToSubject() { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { return(uow.Repository <AssignTeacherToSubject>().GetAll().Select(d => new AssignTeacherToSubjectViewModel { StaffNumber = d.StaffNumber, GradeGroupId = d.GradeGroupId, SubjectCode = d.SubjectCode, }).ToList()); } }
public void AssignTeacherToClass(AssignTeacherToClassViewmodel model) { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { var Ass = new AssignTeacherToClass { StaffNumber = model.StaffNumber, GradeGroupId = model.GradeGroupId, }; uow.Repository <AssignTeacherToClass>().Insert(Ass); uow.Save(); } }
//UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork(); //public void AddGroup(GradesViewModels model) //{ // Grade gr = new Grade // { // Grade_id = model.Grade_id, // GradeName = model.GradeName // }; // uow.Repository<Grade>().Insert(gr); // uow.Save(); //} //public List<GradesViewModels> GetAllGroup() //{ // return uow.Repository<Grade>().GetAll().Select(t => new GradesViewModels // { // Grade_id = t.Grade_id, // GradeName = t.GradeName, // }).ToList(); //} //public GradesViewModels GetById(int id) //{ // //string t= // var appview = new GradesViewModels(); // var app = uow.Repository<Grade>().GetById(id); // appview.Grade_id = app.Grade_id; // appview.GradeName = app.GradeName; // return appview; //} public void AssignTeacherToSubject(AssignTeacherToSubjectViewModel model) { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { var AssT = new AssignTeacherToSubject { StaffNumber = model.StaffNumber, GradeGroupId = model.GradeGroupId, SubjectCode = model.SubjectCode, }; uow.Repository <AssignTeacherToSubject>().Insert(AssT); uow.Save(); } }
public List <AllApplicationsViewModel> GetAllApplications() { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { return(uow.Repository <Application>().GetAll().Select(app => new AllApplicationsViewModel() { IdNumber = app.IDNumber, FirstName = app.Name, Surname = app.Surname, DateOfBirth = app.DateOfBirth, Gender = app.Gender, Status = app.Status, Address = app.Address, Phone = app.Phone, ReportCopy = app.ReportCopy }).ToList()); } }
public List <ClassMarkViewModel> GetAllClassMark() { using (UnitOfWork.UnitOfWork uow = new UnitOfWork.UnitOfWork()) { return(uow.Repository <ClassMark>().GetAll().Select(t => new ClassMarkViewModel { Student_No = t.Student_No, Student_name = t.Student_name, ClassGroupe_id = t.ClassGroupe_id, Subject1 = t.Subject1, mark = t.mark, Subject2 = t.Subject2, mark12 = t.mark12, Subject3 = t.Subject3, mark21 = t.mark21, Subject4 = t.Subject4, mark23 = t.mark23, Subject5 = t.Subject5, mark32 = t.mark32, }).ToList()); } }
public void MakeApplication(MakeApplicationViewModel viewmodel) { using (UnitOfWork.IUnitOfWork uow = new UnitOfWork.UnitOfWork()) { byte[] reportcopy = new byte[viewmodel.ReportCopy.InputStream.Length]; viewmodel.ReportCopy.InputStream.Read(reportcopy, 0, reportcopy.Length); var newaplication = new Application { IDNumber = viewmodel.IdNumber, Name = viewmodel.FirstName, Surname = viewmodel.Surname, DateOfBirth = viewmodel.DateOfBirth, Gender = viewmodel.Gender, Status = "Awaiting", Address = viewmodel.Address, Phone = viewmodel.Phone, ReportCopyType = viewmodel.ReportCopy.ContentType, ReportCopy = reportcopy, }; uow.Repository <Application>().Insert(newaplication); uow.Save(); } }
public void AddApplicant(ApplicationViewModel app) { var newdaplicant = new ApplicationTable { Applicant_IDNumber = app.Applicant_IDNumber, Applicant_Name = app.Applicant_Name, Applicant_Surname = app.Applicant_Surname, Applicant_Date_Of_Birth = app.Applicant_Date_Of_Birth, Applicant_Gender = app.Applicant_Gender, Application_Grade = "Grade_8", Applicant_Religion = app.Applicant_Religion, Applicant_Adress = app.Applicant_Adress, Maths_Mark = app.Maths_Mark, English_Mark = app.English_Mark, ZuluHomeLanguage_Mark = app.ZuluHomeLanguage_Mark, status = "Awaiting", Title = app.Title, Parent_Name = app.Parent_Name, Parent_Surname = app.Parent_Surname, Parent_Number = app.Parent_Number, Parent_Adress = app.Parent_Adress, Parent_Email = app.Parent_Email, }; uow.Repository <ApplicationTable>().Insert(newdaplicant); uow.Save(); EmailViewmodel emv = new EmailViewmodel(); EmailBL email = new EmailBL(); emv.Message = "Dear Admin :" + app.Parent_Email + "\n" + "New Applicant has Submited An Application" + "\n" + "Please Check Application "; emv.Subject = "New Applicant"; emv.To = "*****@*****.**"; /*"*****@*****.**"*/; email.SendMail(emv); }
public void Register(RegistrationViewModel model, HttpPostedFileBase image) { var password = "******"; var user = new ApplicationUser() { UserName = model.Parent_Email, Email = model.Parent_Email }; string gen; string seven = model.Student_IDNumber.Substring(6, 1); int seventh = Convert.ToInt16(seven); if (seventh == 0 || seventh <= 4) { gen = "Female"; } else { gen = "Male"; } if (image != null) { model.AddPhoto = new byte[image.ContentLength]; image.InputStream.Read(model.AddPhoto, 0, image.ContentLength); } StudentTable stud = new StudentTable { Student_Number = model.Student_Number, Student_Name = model.Student_Name, Student_Surname = model.Student_Surname, Student_Gender = gen, Student_Religion = model.Student_Religion, Student_Adress = model.Student_Adress, Student_Date_Of_Birth = model.Student_Date_Of_Birth, Student_IDNumber = model.Student_IDNumber, Enrolment_Date = model.Enrolment_Date, Role = model.Role, //AddPhoto=model.AddPhoto, Stream_Code = model.Stream_Code, ClassGroupe_id = model.ClassGroupe_id, Grade_id = model.Grade_id, status = model.status, Parent_Identity = model.Parent_Identity, }; uow.Repository <StudentTable>().Insert(stud); var result = userManager.Create(user, password); if (result.Succeeded) { if (!roleManager.RoleExists(model.Role)) { roleManager.Create(new IdentityRole() { Name = model.Role }); } userManager.AddToRole(user.Id, model.Role); } Parent ppar = new Parent { Parent_Identity = model.Parent_Identity, Title = model.Title, Parent_Name = model.Parent_Name, Parent_Surname = model.Parent_Surname, Parent_Number = model.Parent_Number, Parent_Adress = model.Parent_Adress, Parent_Email = model.Parent_Email, }; uow.Repository <Parent>().Insert(ppar); uow.Save(); EmailViewmodel emv = new EmailViewmodel(); EmailBL email = new EmailBL(); emv.Message = "Dear Parent :" + model.Parent_Email + "\n" + "Your Child has Registered to JG Zuma High School" + "\n" + "Please make sure you attend meeting " + "Out Standing School Fee:R 150.00" + "\n" + "LogIn Creaditials are: password:"******"UserName :"******"JG-Zuma Registration Feedback"; emv.To = model.Parent_Email; email.SendMail(emv); }
public void AddNewStaffprofile(StaffViewModel model, HttpPostedFileBase image) { var password = "******"; string gen; string seven = model.IdentityNumber.Substring(6, 1); int seventh = Convert.ToInt16(seven); if (seventh == 0 || seventh <= 4) { gen = "Female"; } else { gen = "Male"; } if (image != null) { model.AddPhoto = new byte[image.ContentLength]; image.InputStream.Read(model.AddPhoto, 0, image.ContentLength); } var user = new ApplicationUser { UserName = model.Email, Email = model.Email, }; var st = new Staff { Stuff_Number = model.Stuff_Number, Registration_Date = model.Registration_Date, FirstName = model.FirstName, LastName = model.LastName, ContactNumber = model.ContactNumber, Email = model.Email, Password = password, IdentityNumber = model.IdentityNumber, AddPhoto = model.AddPhoto, Role = model.Role, Gender = gen }; uow.Repository <Staff>().Insert(st); uow.Save(); EmailViewmodel emv = new EmailViewmodel(); EmailBL email = new EmailBL(); emv.Message = "Dear Parent :" + model.Email + "\n" + "Your Child has Registered to JG Zuma High School" + "\n" + "Please make sure you attend meeting " + "Out Standing School Fee:R 150.00" + "\n" + "LogIn Creaditials are: password:"******"UserName :"******"JG-Zuma Registration Feedback"; emv.To = model.Email; email.SendMail(emv); var result = UserManager.Create(user, password); if (result.Succeeded) { if (!RoleManager.RoleExists(model.Role)) { RoleManager.Create(new IdentityRole() { Name = model.Role }); } UserManager.AddToRole(user.Id, model.Role); } }