public TechnicianController(DomainContext context, ILogger <UsersController> log, UserManager <Users> userManag, RoleManager <Role> roleManag, IConfiguration configuration) : base(userManag, roleManag, context) { logger = log; userManager = userManag; roleManager = roleManag; Configuration = configuration; servicesBO = new ServicesBO(context); pServiceBO = new PersonServicesBO(context); }
public void CuandoGetAllPerson() { //Arrange //Act IPersonServices personServices = Substitute.For <IPersonServices>(); var result = personServices.GetAllPerson(); //Assert Assert.IsNotNull(result); }
public AddPersonViewModel(ObservableCollection <Person> peopleList, IPersonServices personProxy, ICommandInvoker commandInvoker) { AddPersonCommand = new RelayCommand(AddPersonExecute, AddPersonCanExecute); PeopleList = peopleList; PersonProxy = personProxy; CommandInvoker = commandInvoker; logger.Debug("AddPersonViewModel constructor successful call."); LoggerHelper.Instance.LogMessage("AddPersonViewModel constructor successful call.", EEventPriority.DEBUG, EStringBuilder.CLIENT); }
public DeletePersonConfirmationViewModel(Person personToBeDeleted, ObservableCollection <Person> peopleList, IPersonServices personProxy, ICommandInvoker commandInvoker) { PersonToBeDeleted = personToBeDeleted; PeopleList = peopleList; DeletePersonCommand = new RelayCommand(DeletePersonConfirmationExecute, DeletePersonConfirmationCanExecute); PersonProxy = personProxy; CommandInvoker = commandInvoker; }
public PersonsController(IPersonServices personService, LinkGenerator linkGanarator, ILoggerService logger, IFileService fileService, IRelatedPersonServices relatedPersonServices, SharedViewLocalizer localizer) { _personService = personService; _linkGanarator = linkGanarator; _logger = logger; _fileService = fileService; _relatedPersonServices = relatedPersonServices; _localizer = localizer; var test = _localizer["Email"].Value; }
public void CuandoUpdatePerson() { //Arrange Person person = new Person { Name = "Caleb", Surname = "Salazar" }; //Act IPersonServices personServices = Substitute.For <IPersonServices>(); var result = personServices.UpdatePerson(person); //Assert Assert.IsNotNull(result); }
public SearchPeopleViewModel(ObservableCollection <Person> peopleList, IPersonServices personProxy) { SearchPeopleCommand = new RelayCommand(SearchPeopleExecute, SearchPeopleCanExecute); CloseSearchPersonCommand = new RelayCommand(CloseSearchPersonExecute, CloseSearchPersonCanExecute); PersonProxy = personProxy; ToBeSearchedPerson = new Person(); SelectedPerson = new Person(); ListOfPeople = new ObservableCollection <Person>(peopleList); logger.Debug("SearchPeopleViewModel constructor success."); LoggerHelper.Instance.LogMessage($"SearchPeopleViewModel constructor success.", EEventPriority.DEBUG, EStringBuilder.CLIENT); }
public static IPersonServices ConnectToPersonService(InstanceContext instanceContext) { NetTcpBinding binding = new NetTcpBinding() { CloseTimeout = new TimeSpan(0, 10, 0), OpenTimeout = new TimeSpan(0, 10, 0), ReceiveTimeout = new TimeSpan(0, 10, 0), SendTimeout = new TimeSpan(0, 10, 0), }; DuplexChannelFactory <IPersonServices> personChannelFactory = new DuplexChannelFactory <IPersonServices>(instanceContext, binding, new EndpointAddress("net.tcp://localhost:6002/IPersonServices")); IPersonServices personProxy = personChannelFactory.CreateChannel(); return(personProxy); }
public HomeViewModel(Account person) { AddPersonCommand = new RelayCommand(AddPersonExecute, AddPersonCanExecute); ModifyPersonCommand = new RelayCommand(ModifyPersonExecute, ModifyPersonCanExecute); DeletePersonCommand = new RelayCommand(DeletePersonExecute, DeletePersonCanExecute); PersonDetailsCommand = new RelayCommand(PersonDetailsExecute, PersonDetailsCanExecute); DuplicatePersonCommand = new RelayCommand(DuplicatePersonExecute, DuplicatePersonCanExecute); UndoPersonCommand = new RelayCommand(UndoPersonExecute, UndoPersonCanExecute); RedoPersonCommand = new RelayCommand(RedoPersonExecute, RedoPersonCanExecute); ShowPeopleCommand = new RelayCommand(ShowPeopleExecute, ShowPeopleCanExecute); SearchPersonCommand = new RelayCommand(SearchPersonExecute, SearchPersonCanExecute); AddEventCommand = new RelayCommand(AddEventExecute, AddEventCanExecute); ModifyEventCommand = new RelayCommand(ModifyEventExecute, ModifyEventCanExecute); DeleteEventCommand = new RelayCommand(DeleteEventExecute, DeleteEventCanExecute); EventDetailsCommand = new RelayCommand(EventDetailsExecute, EventDetailsCanExecute); ShowEventsCommand = new RelayCommand(ShowEventsExecute, ShowEventsCanExecute); CreateAccountCommand = new RelayCommand(CreateAccountExecute, CreateAccountCanExecute); ModifyAccountCommand = new RelayCommand(ModifyAccountExecute, ModifyAccountCanExecute); ModifyPersonalAccountCommand = new RelayCommand(ModifyPersonalAccountExecute, ModifyPersonalAccountCanExecute); DeleteAccountCommand = new RelayCommand(DeleteAccountExecute, DeleteAccountCanExecute); ShowAccountsCommand = new RelayCommand(ShowAccountsExecute, ShowAccountsCanExecute); LogOutCommand = new RelayCommand(LogOutExecute, LogOutCanExecute); InstanceContext instanceContext = new InstanceContext(this); _personProxy = PersonProxy.ConnectToPersonService(instanceContext); _accountProxy = AccountProxy.ConnectToAccountService(instanceContext); _eventProxy = EventProxy.ConnectToAccountService(instanceContext); _personProxy.Subscribe(); _accountProxy.Subscribe(); _eventProxy.Subscribe(); LoggedInAccount = person; LogText = LoggerHelper.Instance.ClientLogBuilder; PeopleList = new ObservableCollection <Person>(_personProxy.GetAllPeople()); AccountsList = new ObservableCollection <Account>(_accountProxy.GetAllAccounts()); EventsList = new ObservableCollection <Event>(_eventProxy.GetAllEvents()); ListOfCommands = new List <BaseCommand>(); CurrentCommand = 0; logger.Info("HomeViewModel constructor success."); LoggerHelper.Instance.LogMessage($"HomeViewModel constructor success.", EEventPriority.INFO, EStringBuilder.CLIENT); LogText = LoggerHelper.Instance.ClientLogBuilder; }
public ModifyEventViewModel(Event eventToModify, ObservableCollection <Event> eventList, ObservableCollection <Person> peopleList, IEventServices eventProxy, IPersonServices personProxy) { ModifyEventCommand = new RelayCommand(ModifyEventExecute, ModifyEventCanExecute); AddPraticipantCommand = new RelayCommand(AddPraticipantExecute, AddPraticipantCanExecute); RemovePraticipantCommand = new RelayCommand(RemovePraticipantExecute, RemovePraticipantCanExecute); EventList = eventList; PeopleList = peopleList; EventProxy = eventProxy; PersonProxy = personProxy; EventToModify = eventToModify; PersonToParticipate = new Person(); PersonToRevokeParticipation = new Person(); AvailablePeople = new ObservableCollection <Person>(PersonProxy.GetAllPeople().Where(p => p.IsAvailableForEvent(EventToModify.ScheduledDateTimeBeging, EventToModify.ScheduledDateTimeEnd))); Participants = new ObservableCollection <Person>(EventToModify.Participants); }
public AddEventViewModel(ObservableCollection <Event> eventList, ObservableCollection <Person> peopleList, IEventServices eventProxy, IPersonServices personProxy) { AddEventCommand = new RelayCommand(AddEventExecute, AddEventCanExecute); AddPraticipantCommand = new RelayCommand(AddPraticipantExecute, AddPraticipantCanExecute); RemovePraticipantCommand = new RelayCommand(RemovePraticipantExecute, RemovePraticipantCanExecute); EventList = eventList; PeopleList = peopleList; EventToAdd = new Event(); PersonToParticipate = new Person(); PersonToRevokeParticipation = new Person(); AvailablePeople = new ObservableCollection <Person>(); Participants = new ObservableCollection <Person>(); EventProxy = eventProxy; PersonProxy = personProxy; }
public ModifyPersonViewModel(Person person, ObservableCollection <Person> peopleList, IPersonServices personProxy, ICommandInvoker commandInvoker) { ModifyPersonCommand = new RelayCommand(ModifyPersonExecute, ModifyPersonCanExecute); PeopleList = peopleList; PersonToModify = new Person() { FirstName = person.FirstName, LastName = person.LastName, JMBG = person.JMBG, }; PersonProxy = personProxy; CommandInvoker = commandInvoker; logger.Debug("ModifyPersonViewModel constructor success."); LoggerHelper.Instance.LogMessage($"ModifyPersonViewModel constructor success.", EEventPriority.DEBUG, EStringBuilder.CLIENT); }
/// <summary> /// 统一验证Session[Keys.UserInfo],如果为null,则跳转到登录页面 /// </summary> /// <param name="filterContext"></param> public override void OnActionExecuting(ActionExecutingContext filterContext) { //0.0 判断是否有贴[SkipCheckLogin]的特性标签 if (filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(SkipCheckLoginAttribute), false)) { return; } if (filterContext.ActionDescriptor.IsDefined(typeof(SkipCheckLoginAttribute), false)) { return; } //▲思路: //1.0 判断Session[Keys.UserInfo]是否为null //1.0.1 查询Cookie[Keys.IsMember]是否不为空,如果成立则模拟用户登录, //再将用户实体数据存入Session[Keys.UserInfo]中 //1.1 取出Cookie中存入的Id的值 //1.2 根据Id查询用户的实体 //1.2.1 先要从缓存中获取Autofac容器对象 //var container = CacheHelper.GetData<IContainer>(Keys.AutofacContainer); //1.2.2 找Autofac容器获取IUserServices接口的具体实现类的对象实例 //IUserServices userServices = container.Resolve<IUserServices>(); //1.3 根据userServices结合Id查询数据 //var userInfo = userServices.QueryWhere(c => c.Id == userId).FirstOrDefault(); //if (userInfo != null) //{ // //1.4 将userInfo存入Session中 // filterContext.HttpContext.Session[Keys.UserInfo] = userInfo; //} //else //{ // ToLoginView(filterContext); //} //1.0 判断Session[Keys.UserInfo]是否为null filterContext.HttpContext.Session[Keys.UserInfo] = null; if (filterContext.HttpContext.Session[Keys.UserInfo] == null) { //1.0.1 查询Cookie[Keys.IsMember]是否不为空,如果成立则模拟用户登录, //再将用户实体数据存入Session[Keys.UserInfo]中 //1.1 取出Cookie中存入的Id的值 var userEnCryptCookieStr = CookieHelper.Get(Keys.UserInfo); var userCookieStr = ""; if (!string.IsNullOrWhiteSpace(userEnCryptCookieStr)) { userCookieStr = userEnCryptCookieStr.DecryptStr(); Match match = Regex.Match(userCookieStr, @"([\S]+)\|(\d+)"); if (match.Success) { //模拟登录 string userIdStr = match.Groups[1].Value; string idtStr = match.Groups[2].Value; int userId = 0; int.TryParse(userIdStr, out userId); int idt = 0; int.TryParse(idtStr, out idt); switch (idt) { //求职者 case 1: { //1.2 根据Id查询用户的实体 //1.2.1 先要从缓存中获取Autofac容器对象 var container = CacheHelper.GetData <IContainer>(Keys.AutofacContainer); //1.2.2 找Autofac容器获取IUserServices接口的具体实现类的对象实例 IPersonServices personServices = container.Resolve <IPersonServices>(); //1.3 根据personServices结合userId查询数据 var person = personServices.QueryWhere(item => item.PerID == userId).FirstOrDefault(); if (person != null) { Model.User.UserInfo userInfo = new Model.User.UserInfo() { IdentityType = Model.User.IdentityType.Person, UserId = person.PerID, RealName = person.RealName, Phone = person.Phne, Email = person.Email }; //求职者登录成功 //1.4 将userInfo存入Session中 UserManage.SetCurrentUserInfo(userInfo); } else { ToLoginView(filterContext); } } break; //经纪人 case 2: { var container = CacheHelper.GetData <IContainer>(Keys.AutofacContainer); IServerUserServices serverUserServices = container.Resolve <IServerUserServices>(); var serverUser = serverUserServices.QueryWhere(item => item.SerUserID == userId).FirstOrDefault(); if (serverUser != null) { Model.User.UserInfo userInfo = new Model.User.UserInfo() { IdentityType = Model.User.IdentityType.ServerUser, UserId = serverUser.SerUserID, RealName = serverUser.RealName, Phone = serverUser.Phone, Email = serverUser.Email }; UserManage.SetCurrentUserInfo(userInfo); } else { ToLoginView(filterContext); } } break; default: { ToLoginView(filterContext); } break; } } else { ToLoginView(filterContext); } } else { ToLoginView(filterContext); } } base.OnActionExecuting(filterContext); }
public ReportController(DomainContext context, ILogger <ReportController> log) { logger = log; pServiceBO = new PersonServicesBO(context); }
public override Person Modification(Person personToModify, IPersonServices proxy) { return(proxy.ModifyPerson(personToModify)); }
public abstract Person Modification(Person personToModify, IPersonServices proxy);
public PersonController(IPersonServices personService) { _personService = personService; }
public MemberController(IPersonServices _PersonServices , IServerUserServices _ServerUserServices) { base._PersonServices = _PersonServices; base._ServerUserServices = _ServerUserServices; }
public override Person Addition(Person personToAdd, IPersonServices proxy) { return(proxy.AddPerson(personToAdd)); }
public PersonsController(IPersonServices personServices) { this.personService = personServices; }
public PersonController(ILogger <PersonController> logger, IPersonServices personService) { _logger = logger; _personService = personService; }
public BasePersonCommand(BaseCommandReceiver personCommandReceiver, Person receiverParameter, IPersonServices proxy) { PersonCommandReceiver = personCommandReceiver; ReceiverParameter = receiverParameter; PersonProxy = proxy; }
public PersonController(IPersonServices services) { _services = services; }
public ReviewsController(DomainContext context, ILogger <ReviewsController> log, UserManager <Users> userManag, RoleManager <Role> roleManag, IConfiguration configuration) : base(userManag, roleManag, context) { logger = log; pServiceBO = new PersonServicesBO(context); Configuration = configuration; }
public MController(IPersonServices _PersonServices, IView_PersonInfoServices _View_PersonInfoServices) { base._PersonServices = _PersonServices; base._View_PersonInfoServices = _View_PersonInfoServices; }
public abstract Person Addition(Person personToAdd, IPersonServices proxy);
public PersonController(PersonServices _personServices) { personServices = _personServices; }
public abstract Person Removal(Person personToRemove, IPersonServices proxy);
public ModifyPersonCommand(BaseCommandReceiver commandReceiver, Person person, IPersonServices personProxy) : base(commandReceiver, person, personProxy) { }
public override Person Removal(Person personToRemove, IPersonServices proxy) { return(proxy.DeletePerson(personToRemove)); }