public StateContextExtension(StateService stateService, StateRepository stateRepo, JqGridCustomCriteria<StateBoxMap, StateEntity> jqgridCriteria) { _stateRepo = stateRepo; _jqgridCriteria = jqgridCriteria; _stateService = stateService; }
public override void Observe() { RefreshDb(); SaveAndFlush(StateMother.Draft, StateMother.Published); _repository = new StateRepository(Session); }
public DonationInformation() { //dtpDate.MinDate = DateTime.Now; this.MaximizeBox = false; InitializeComponent(); dtpEnglishDateType.Format = DateTimePickerFormat.Custom; dtpEnglishDateType.CustomFormat = "dd/MM"; donorRepo = new DonorRepository(); datetypeRepo = new DateTypeRepository(); desigRepo = new DesignationRepository(); employeeRepo = new EmployeeRepository(); prefixRepo = new PrefixesRepository(); roleRepo = new RoleRepository(); serviceNameRepo = new ServiceNameRepository(); serviceTypeRepo = new ServiceTypeRepository(); specialDayRepo = new SpecialDayRepository(); starRepo = new StarsRepository(); monthsRepo = new MonthsRepository(); pakshaRepo = new PakshaRepository(); thithiRepo = new ThidhiRepository(); monthlyAnnaRepo = new MonthlyAnnaRepository(); gothramRepo = new GothramsRepository(); transTypeRepo = new TransactionTypeRepository(); lstTokenPrint = new List<TokenPrint>(); stateRepo = new StateRepository(); lstStates = new List<State>(); prefixesRepo = new PrefixesRepository(); bindData(); btnUpdate.Visible = false; btnCancel.Visible = false; lblSpecialDay.Visible = false; cmbSpecialDay.Visible = false; lblMonth.Visible = false; cmbMonth.Visible = false; lblThithi.Visible = false; cmbThithi.Visible = false; lblMonthlyAnna.Visible = false; cmbMonthlyAnna.Visible = false; lblEnglishDatetype.Visible = false; dtpEnglishDateType.Visible = false; rbdEnglish.Checked = false; rbdTelugu.Checked = false; lblMonthyAnnaThithi.Visible = false; cmbMonthyAnnaThithi.Visible = false; }
// <snippet906> public static ValidationResult ValidateZipCodeState(object value, ValidationContext validationContext) { bool isValid = false; try { if (value == null) { throw new ArgumentNullException("value"); } if (validationContext == null) { throw new ArgumentNullException("validationContext"); } string stateName = ((Address)validationContext.ObjectInstance).State; State state = new StateRepository().GetAll().FirstOrDefault(c => c.Name == stateName); int zipCode = Convert.ToInt32(((Address)validationContext.ObjectInstance).ZipCode.Substring(0, 3), CultureInfo.InvariantCulture); foreach (var range in state.ValidZipCodeRanges) { // If the first 3 digits of the Zip Code falls within the given range, it is valid. int minValue = Convert.ToInt32(range.Split('-')[0], CultureInfo.InvariantCulture); int maxValue = Convert.ToInt32(range.Split('-')[1], CultureInfo.InvariantCulture); isValid = zipCode >= minValue && zipCode <= maxValue; if (isValid) break; } } catch (ArgumentNullException) { isValid = false; } if (isValid) { return ValidationResult.Success; } else { return new ValidationResult(Resources.ErrorInvalidZipCodeInState); } }
public RpgController() { EventRepository = new EventRepository(_context); EventLinkItemRepository = new EventLinkItemRepository(_context); QuestRepository = new QuestRepository(_context); HeroRepository = new HeroRepository(_context); SkillRepository = new SkillRepository(_context); GuildRepository = new GuildRepository(_context); SkillSchoolRepository = new SkillSchoolRepository(_context); TrainingRoomRepository = new TrainingRoomRepository(_context); CharacteristicRepository = new CharacteristicRepository(_context); CharacteristicTypeRepository = new CharacteristicTypeRepository(_context); StateRepository = new StateRepository(_context); StateTypeRepository = new StateTypeRepository(_context); //using (var scope = StaticContainer.Container.BeginLifetimeScope()) //{ // EventRepository = scope.Resolve<IEventRepository>(); // QuestRepository = scope.Resolve<IQuestRepository>(); // HeroRepository = scope.Resolve<IHeroRepository>(); // SkillRepository = scope.Resolve<ISkillRepository>(); //} }
public ActionResult DeleteState(string id) { var state = StateRepository.Get(id); return(View(state)); }
public ActionResult State() { var get = StateRepository.GetAll(); return(View(get)); }
private void LoadStateComboBox() { View.InitializeStateComboBox(StateRepository.GetStates()); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IGoodIdentificationMvoAggregate aggregate, IGoodIdentificationMvoState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IGoodIdentificationMvoStateProperties)state).ProductVersion, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IGoodIdentificationMvoAggregate, IGoodIdentificationMvoState>(aggregate, state, aggregate.Changes)); } }
public StateBrowsingService(StateService stateService, StateRepository stateRepo) { _stateService = stateService; _stateRepo = stateRepo; }
protected virtual void Update(IInOutCommand c, Action <IInOutAggregate> action) { var aggregateId = c.AggregateId; var state = StateRepository.Get(aggregateId, false); var aggregate = GetInOutAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); var repeated = IsRepeatedCommand(c, eventStoreAggregateId, state); if (repeated) { return; } aggregate.ThrowOnInvalidStateTransition(c); action(aggregate); EventStore.AppendEvents(eventStoreAggregateId, ((IInOutStateProperties)state).Version, aggregate.Changes, () => { StateRepository.Save(state); }); }
public ActionResult EditState(string id) { var model = StateRepository.Get(id); return(View(model)); }
public ActionResult EditState(State state) { StateRepository.Edit(state); return(RedirectToAction("States")); }
public virtual IUserLoginMvoState Get(UserLoginId userLoginId) { var state = StateRepository.Get(userLoginId, true); return(state); }
public StatesController() { repository = new StateRepository(); }
public virtual IOrganizationStructureTypeState Get(string id) { var state = StateRepository.Get(id, true); return(state); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IAttributeSetInstanceExtensionFieldGroupAggregate aggregate, IAttributeSetInstanceExtensionFieldGroupState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IAttributeSetInstanceExtensionFieldGroupStateProperties)state).Version, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IAttributeSetInstanceExtensionFieldGroupAggregate, IAttributeSetInstanceExtensionFieldGroupState>(aggregate, state, aggregate.Changes)); } }
public virtual IAttributeSetInstanceExtensionFieldGroupState Get(string id) { var state = StateRepository.Get(id, true); return(state); }
public DataServiceController() { _CustomerRepository = new CustomerRepository(); _StateReporitory = new StateRepository(); }
public void CanLoadStates() { List <State> States = StateRepository.GetAll().ToList(); Assert.AreEqual(States.Count, 3); }
public StateRepositoryTest() { ServiceLocator.SetLocatorProvider(() => new RepositoryLocatorProvider()); _stateRepository = ServiceLocator.Current.GetInstance <IStateRepository>() as StateRepository; _zipCodeRepository = ServiceLocator.Current.GetInstance <IZipCodeRepository>() as ZipCodeRepository; }
public virtual IInOutState Get(string documentNumber) { var state = StateRepository.Get(documentNumber, true); return(state); }
public virtual IOrderRoleMvoState Get(OrderRoleId orderRoleId) { var state = StateRepository.Get(orderRoleId, true); return(state); }
public virtual IGoodIdentificationMvoState Get(ProductGoodIdentificationId productGoodIdentificationId) { var state = StateRepository.Get(productGoodIdentificationId, true); return(state); }
public virtual IOrderState Get(string orderId) { var state = StateRepository.Get(orderId, true); return(state); }
public StateMachine() { this.repository = new StateRepository(); this.Register(); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IOrderAggregate aggregate, IOrderState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IOrderStateProperties)state).Version, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IOrderAggregate, IOrderState>(aggregate, state, aggregate.Changes)); } }
public ActionResult States() { var model = StateRepository.GetAll(); return(View(model.ToList())); }
public void AddTest() { int key = 0; string naturalKey = String.Empty; using (DBContext db = new DBContext(settings.Database.ConnectionString, logger)) { Assert.NotNull(db); ContactRepository contactRepos = new ContactRepository(settings, logger, db); CityRepository cityRepos = new CityRepository(settings, logger, db); StateRepository stateRepos = new StateRepository(settings, logger, db); #region Add Contact Test Contact contact = new Contact() { FirstName = "New", LastName = "User", Address1 = "Address1", Address2 = "Address2", CellPhone = "8005551212", HomePhone = "8005551212", WorkPhone = "8005551212", Notes = String.Empty, ZipCode = "99999", EMail = "*****@*****.**", CityId = 1 }; ICollection <Contact> contacts = contactRepos.FindAll(); Assert.Null(contacts.Where(c => c.LastName == contact.LastName && c.FirstName == contact.FirstName).FirstOrDefault()); key = (int)contactRepos.Add(contact); Assert.True(key > 0); Assert.NotNull(contactRepos.FindByPK(new PrimaryKey() { Key = key })); #endregion #region Add City Test City city = new City() { Name = "New City", StateId = "FL" }; ICollection <City> cities = cityRepos.FindAll(); Assert.Null(cities.Where(c => c.Name == city.Name).FirstOrDefault()); key = (int)cityRepos.Add(city); Assert.True(key > 0); Assert.NotNull(cityRepos.FindByPK(new PrimaryKey() { Key = key })); #endregion #region Add State Test State newState = new State() { Id = "ZZ", Name = "New State" }; State state = stateRepos.FindByPK(new PrimaryKey() { Key = newState.Id, IsIdentity = false }); Assert.Null(state); naturalKey = (string)stateRepos.Add(newState); Assert.True(naturalKey == (string)newState.PK.Key); Assert.NotNull(stateRepos.FindByPK(new PrimaryKey() { Key = newState.Id, IsIdentity = false })); #endregion } }
public ActionResult AddState(State state) { StateRepository.Add(state); return(RedirectToAction("State")); }
public void DeleteTest() { int rows = 0; using (DBContext db = new DBContext(settings.Database.ConnectionString, logger)) { Assert.NotNull(db); ContactRepository contactRepos = new ContactRepository(settings, logger, db); CityRepository cityRepos = new CityRepository(settings, logger, db); StateRepository stateRepos = new StateRepository(settings, logger, db); #region Delete Contact Test Contact contact = contactRepos.FindByPK(new PrimaryKey() { Key = 8 }); Assert.NotNull(contact); rows = contactRepos.Delete(new PrimaryKey() { Key = 8 }); Assert.Equal(1, rows); contact = contactRepos.FindByPK(new PrimaryKey() { Key = 8 }); Assert.Null(contact); #endregion #region Delete City Test City city = cityRepos.FindByPK(new PrimaryKey() { Key = 17 }); Assert.NotNull(city); rows = cityRepos.Delete(new PrimaryKey() { Key = 17 }); Assert.Equal(1, rows); city = cityRepos.FindByPK(new PrimaryKey() { Key = 17 }); Assert.Null(city); #endregion #region Delete State Test State state = stateRepos.FindByPK(new PrimaryKey() { Key = "WA" }); Assert.NotNull(state); rows = stateRepos.Delete(new PrimaryKey() { Key = "WA" }); Assert.Equal(1, rows); state = stateRepos.FindByPK(new PrimaryKey() { Key = "WA" }); Assert.Null(state); #endregion } }
public ActionResult DeleteState(State state) { StateRepository.Delete(state.StateAbbreviation); return(RedirectToAction("State")); }
protected void Page_Load(object sender, EventArgs e) { Master.PAGEID = 1; Page.Header.DataBind(); if (!Page.IsPostBack) { /*Countries Drop Down List Generation*/ CountryRepository CntryList = new CountryRepository(); ExtendedCollection<Country> LC = CntryList.GetCountryList(); Country[] Countries = new Country[LC.Count]; LC.CopyTo(Countries, 0); for (int i = 0; i < Countries.GetLength(0); i++) { Cntry.Items.Add(Countries[i].Name); } /*State List - Sample Code*/ StateRepository StateList = new StateRepository(); ExtendedCollection<State> LS = StateList.GetStateList(97); /*City List - Sample Code*/ CityRepository CityList = new CityRepository(); ExtendedCollection<City> LCity = CityList.GetCityList(8); /*ExamCategory Repeater Bind */ ExamCategoryRepository ECList = new ExamCategoryRepository(); ExtendedCollection<ExamCategory> EC = ECList.GetECList(); ExamCategory[] ECs = new ExamCategory[EC.Count]; EC.CopyTo(ECs, 0); for (int i = 0; i < ECs.GetLength(0); i++) { ExamCategoryList.Items.Add(new ListItem(ECs[i].ExamName.ToString(), ECs[i].ECID.ToString())); } } HideFormIfLogin.Visible = true; if (Page.IsPostBack) { securecode = HttpContext.Current.Session["randomstruserreg"].ToString(); } //Check whether user is login, if login, hide the registration form. //We don't want to allow users who are logon to register. //if they want to regsiter a new a count, they must logout first. if (Authentication.IsUserAuthenticated) { HideFormIfLogin.Visible = false; lblWarningMessage.Visible = true; lblWarningMessage.Text = "Sorry! You cannot register a new account when you are logon.<br>If you want to register for a new account, you must logout first."; } }
public virtual IStatusItemState Get(string statusId) { var state = StateRepository.Get(statusId, true); return(state); }
public void UpdateTest() { string oldString = String.Empty; string updateString = String.Empty; int rows = 0; using (DBContext db = new DBContext(settings.Database.ConnectionString, logger)) { ContactRepository contactRepos = new ContactRepository(settings, logger, db); CityRepository cityRepos = new CityRepository(settings, logger, db); StateRepository stateRepos = new StateRepository(settings, logger, db); #region Update Contact Test oldString = "No notes"; updateString = "Updated note."; Contact contact = contactRepos.FindByPK(new PrimaryKey() { Key = 1 }); Assert.NotNull(contact); Assert.Equal(contact.Notes, oldString); contact.Notes = updateString; rows = contactRepos.Update(contact); Assert.Equal(1, rows); contact = contactRepos.FindByPK(new PrimaryKey() { Key = 1 }); Assert.Equal(contact.Notes, updateString); #endregion #region Update City Test oldString = "Tampa"; updateString = "Tampa(Updated)"; City city = cityRepos.FindByPK(new PrimaryKey() { Key = 1 }); Assert.NotNull(city); Assert.Equal(city.Name, oldString); city.Name = updateString; rows = cityRepos.Update(city); Assert.Equal(1, rows); city = cityRepos.FindByPK(new PrimaryKey() { Key = 1 }); Assert.Equal(city.Name, updateString); #endregion #region Update State Test oldString = "NA"; updateString = "NA(Updated)"; State state = stateRepos.FindByPK(new PrimaryKey() { Key = "00" }); Assert.NotNull(state); Assert.Equal(state.Name, oldString); state.Name = updateString; rows = stateRepos.Update(state); Assert.Equal(1, rows); state = stateRepos.FindByPK(new PrimaryKey() { Key = "00" }); Assert.Equal(state.Name, updateString); #endregion } }
public StatesController(ApiControllerErrorHandler _errorHandler, StateRepository repository, IMapper mapper) : base(_errorHandler) { _repository = repository; _mapper = mapper; }
private List<State> GetStates() { var stateRepo = new StateRepository(); var states = stateRepo.GetAllStates(); return states; }
public virtual IShipmentState Get(string shipmentId) { var state = StateRepository.Get(shipmentId, true); return(state); }