public GroupSubjectType(UserMarkFacade userMarkFacade, SubjectFacade subjectFacade, UserFacade userFacade, GroupFacade groupFacade) { Field(x => x.Id); Field <IntGraphType>( "orderNumber", resolve: context => context.Source.OrderNumber); Field <IntGraphType>( "dayOfWeek", resolve: context => context.Source.DayOfWeek); Field <ListGraphType <UserMarkType> >( "userMarks", resolve: context => userMarkFacade.GetByGroupSubjectId(context.Source.Id)); Field <SubjectType>("subject", resolve: context => subjectFacade.GetById(context.Source.SubjectId) ); Field <UserType>("teacher", resolve: context => userFacade.GetById(context.Source.TeacherId) ); Field <GroupType>("group", resolve: context => groupFacade.GetById(context.Source.GroupId) ); }
public Mutations(MarkFacade markFacade, UserFacade userFacade, GroupFacade groupFacade, GroupSubjectFacade groupSubjectFacade, NotificationFacade notificationFacade, NotificationStudentFacade notificationStudentFacade, SubjectFacade subjectFacade, UserGroupFacade userGroupFacade, UserMarkFacade userMarkFacade, UserRoleFacade userRoleFacade) { AddMarkMutations(markFacade); AddUserMutations(userFacade, userRoleFacade, userGroupFacade, groupFacade); AddGroupMutations(groupFacade); AddGroupSubjectMutations(groupSubjectFacade, userFacade); AddNotificationMutations(notificationFacade, groupFacade, notificationStudentFacade); AddNotificationStudentMutations(notificationStudentFacade); AddSubjectMutations(subjectFacade); AddUserGroupMutations(userGroupFacade); AddUserMarkMutations(userMarkFacade); AddUserRoleMutations(userRoleFacade); }
public Queries(MarkFacade markFacade, UserFacade userFacade, GroupFacade groupFacade, GroupSubjectFacade groupSubjectFacade, NotificationFacade notificationFacade, NotificationStudentFacade notificationStudentFacade, SubjectFacade subjectFacade, UserGroupFacade userGroupFacade, UserMarkFacade userMarkFacade, UserRoleFacade userRoleFacade) { AddMarkQueries(markFacade); AddUserQueries(userFacade, userRoleFacade); AddGroupQueries(groupFacade); AddGroupSubjectQueries(groupSubjectFacade, subjectFacade, userFacade); AddNotificationQueries(notificationFacade); AddNotificationStudentQueries(notificationStudentFacade); AddSubjectQueries(subjectFacade); AddUserGroupQueries(userGroupFacade); AddUserMarkQueries(userMarkFacade); AddUserRoleQueries(userRoleFacade); AddAuthorizeQueries(userFacade, userRoleFacade); }
public void Initilize(IUnitOfWork uow) { SubjectFacade subjectFacade = new SubjectFacade(uow); SubjectList = subjectFacade.GetSubjectList(); DomainFacade domainFacade = new DomainFacade(uow); DomainSettingList = domainFacade.GetDomainSettingList(); ApplicationSettingFacade settingFacade = new ApplicationSettingFacade(uow); ApplicationOption = settingFacade.GetApplicationOption(); LanguageFacade languageFacade = new LanguageFacade(uow); LanguageDic = languageFacade.RetrievePublishedLanguagesAndPhrases(ApplicationOption.IsMultiLanguageSupported); LanguageDicByCulture = new Dictionary <string, LanguageDto>(); foreach (var language in LanguageDic.Values) { LanguageDicByCulture.Add(language.Culture, language); } DefaultLanguage = LanguageDic[ApplicationOption.DefaultLanguageId]; SetupEmailSender(ApplicationOption); SetupNotificationtemplate(uow); }
public void TestAll() { SubjectFacade facade = new SubjectFacade(UnitOfWork); IList <SubjectDto> result = facade.RetrieveAllSubject(new SubjectConverter()); Assert.IsNotNull(result); }
private void LoadData() { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { SubjectFacade subjectFacade = new SubjectFacade(uow); CurrentInstances = subjectFacade.RetrieveAllSubject(); } }
private void RetrieveSubjectFieldInfos() { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { SubjectFacade subjectFacade = new SubjectFacade(uow); SubjectFieldInfos = subjectFacade.RetrieveSubjectFieldInfos(SubjectId); } }
private void RetrieveSubject() { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { SubjectFacade facade = new SubjectFacade(uow); CurrentSubject = facade.RetrieveSubject(SubjectId); } }
public IEnumerable <SubjectDto> GetSubjects() { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CMSDataStoreKey)) { SubjectFacade facade = new SubjectFacade(uow); IList <SubjectDto> result = facade.RetrieveAllSubject(new SubjectConverter()); return(result); } }
private IFacadeUpdateResult <SubjectData> DeleteSubjectChildList(object subjectId, object childListId) { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { SubjectFacade subjectFacade = new SubjectFacade(uow); IFacadeUpdateResult <SubjectData> result = subjectFacade.DeleteSubjectChildList(subjectId, childListId); return(result); } }
private IFacadeUpdateResult <SubjectData> SaveSubjectField(object subjectId, SubjectFieldInfoDto subjectFieldInfo) { if (subjectFieldInfo.SubjectFieldId == null) { subjectFieldInfo.FieldKey = subjectFieldInfo.TableColumn; } using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { SubjectFacade subjectFacade = new SubjectFacade(uow); IFacadeUpdateResult <SubjectData> result = subjectFacade.SaveSubjectField(subjectId, subjectFieldInfo); return(result); } }
public ResponseData <int> SaveSubject(SaveSubject saveSubject) { ResponseData <int> response = new ResponseData <int>(); SubjectFacade facade = new SubjectFacade(); try { response.Data = facade.Save(saveSubject); } catch (Exception ex) { ExceptionHandlerFactory.Factory.GetResponseExceptionHandler(response).Handle(ex); } return(response); }
public ResponseData <List <Subject> > GetSubjects() { ResponseData <List <Subject> > response = new ResponseData <List <Subject> >(); SubjectFacade facade = new SubjectFacade(); try { response.Data = facade.GetAll(); } catch (Exception ex) { ExceptionHandlerFactory.Factory.GetResponseExceptionHandler(response).Handle(ex); } return(response); }
public ResponseData <object> DeleteSubject(DeleteSubject deleteSubject) { ResponseData <object> response = new ResponseData <object>(); SubjectFacade facade = new SubjectFacade(); try { facade.Delete(deleteSubject); } catch (Exception ex) { ExceptionHandlerFactory.Factory.GetResponseExceptionHandler(response).Handle(ex); } return(response); }
private void RetrieveData() { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { SubjectFacade facade = new SubjectFacade(uow); CurrentSubject = facade.RetrieveSubject(SubjectId); SubjectList = facade.GetBindingList(); DataTypeFacade dataTypeFacade = new DataTypeFacade(uow); DataTypeList = dataTypeFacade.GetBindingList(); DEntityFacade entityFacade = new DEntityFacade(uow); EntityList = entityFacade.GetBindingList(); } RetrieveSubjectFieldInfos(); }
private void AddSubjectQueries(SubjectFacade subjectFacade) { Field <ListGraphType <SubjectType> >( "allSubjects", resolve: context => subjectFacade.GetAll() ); Field <SubjectType>("subject", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => { var id = context.GetArgument <int?>("id"); return(id != null ? (subjectFacade.GetById((int)id)) : null); } ); }
public void Initilize(IUnitOfWork uow) { SubjectFacade subjectFacade = new SubjectFacade(uow); SubjectList = subjectFacade.GetSubjectList(); DomainFacade domainFacade = new DomainFacade(uow); DomainSettingList = domainFacade.GetDomainSettingList(); ApplicationSettingFacade settingFacade = new ApplicationSettingFacade(uow); ApplicationOption = settingFacade.GetApplicationOption(); LanguageFacade languageFacade = new LanguageFacade(uow); LanguageList = languageFacade.RetrievePublishedLanguagesAndPhrases(ApplicationOption.IsMultiLanguageSupported); SetupEmailSender(ApplicationOption); SetupNotificationtemplate(uow); }
public ResponseData <Subject> GetSubjectById(string id) { ResponseData <Subject> response = new ResponseData <Subject>(); int currId = 0; int.TryParse(id, out currId); if (currId != default(int)) { try { SubjectFacade subjectFacade = new SubjectFacade(); response.Data = subjectFacade.GetById(currId); } catch (Exception ex) { ExceptionHandlerFactory.Factory.GetResponseExceptionHandler(response).Handle(ex); } } return(response); }
private void AddSubjectMutations(SubjectFacade subjectFacade) { }
private void AddGroupSubjectQueries(GroupSubjectFacade groupSubjectFacade, SubjectFacade subjectFacade, UserFacade userFacade) { Field <ListGraphType <GroupSubjectType> >( "allGroupSubjects", resolve: context => groupSubjectFacade.GetAll() ); Field <ListGraphType <GroupSubjectType> >("subjectListOnWeek", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "groupId" }), resolve: context => { var groupId = context.GetArgument <int>("groupId"); IEnumerable <GroupSubject> groupSubjects = groupSubjectFacade.GetByGroupId(groupId); foreach (var groupSubject in groupSubjects) { groupSubject.Subject = subjectFacade.GetById(groupSubject.SubjectId); groupSubject.Teacher = userFacade.GetById(groupSubject.TeacherId); } return(groupSubjects); } ); Field <ListGraphType <GroupSubjectType> >("subjectsForTeacher", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "teacherId" }), resolve: context => { var teacherId = context.GetArgument <int>("teacherId"); IEnumerable <GroupSubject> groupSubjects = groupSubjectFacade.GetScheduleByTeacherId(teacherId); foreach (var groupSubject in groupSubjects) { groupSubject.Subject = subjectFacade.GetById(groupSubject.SubjectId); groupSubject.Teacher = userFacade.GetById(groupSubject.TeacherId); } return(groupSubjects); } ); Field <ListGraphType <GroupSubjectType> >("teachersDisabled", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "dayOfWeek" }, new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "orderNumber" }, new QueryArgument <ListGraphType <IntGraphType> > { Name = "teachers" }), resolve: context => { var teachers = context.GetArgument <List <int> >("teachers"); var dayOfWeek = context.GetArgument <int>("dayOfWeek"); var orderNumber = context.GetArgument <int>("orderNumber"); List <GroupSubject> groupSubjects = new List <GroupSubject>(); foreach (var teacher in teachers) { GroupSubject groupSubject = groupSubjectFacade.GetByDayAndOrderAndTeacher(dayOfWeek, orderNumber, teacher); if (groupSubject != null) { groupSubjects.Add(groupSubject); } } return(groupSubjects); } ); Field <ListGraphType <GroupSubjectType> >("subjectsOnDay", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "groupId" }, new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "dayOfWeek" }), resolve: context => { var groupId = context.GetArgument <int>("groupId"); var dayOfWeek = context.GetArgument <int>("dayOfWeek"); return(groupSubjectFacade.GetByDayAndGroup(groupId, dayOfWeek)); } ); Field <GroupSubjectType>("groupSubject", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "id" }), resolve: context => { var id = context.GetArgument <int?>("id"); return(id != null ? (groupSubjectFacade.GetById((int)id)) : null); } ); }