public void Add(FunctionalArea functionalArea) { lock (_session) { _session.Store(functionalArea); } }
public void UpdateFaultTypesSelections(FunctionalArea functionalArea) { lock (_session) { _session.Store(functionalArea); } }
private void addFaultTypeToFunctionalArea(FunctionalArea functionalArea, FaultType faultType) { if (!functionalArea.FaultTypes.Exists(f => f.Id == faultType.Id)) { functionalArea.FaultTypes.Add(faultType); } }
private void LoadFields(VoucherFields fields) { this.Ledger = Ledger.Parse(fields.LedgerUID); this.AccountingDate = fields.AccountingDate; this.Concept = fields.Concept; this.VoucherType = VoucherType.Parse(fields.VoucherTypeUID); this.TransactionType = TransactionType.Parse(fields.TransactionTypeUID); this.FunctionalArea = FunctionalArea.Parse(fields.FunctionalAreaId); }
public void Apply() { foreach (var tenantConnectionString in _tenantConnectionStrings) { using (var documentStore = DocumentStoreFactory.CreateStore(tenantConnectionString)) using (var session = documentStore.OpenSession()) { const int tarpsFaultTypeId = 82; const string slottingControlsFunctionalAreaDescription = "Slotting Controls"; const string tarpsFaultTypeDescription = "Min TARPs not met"; var functionalAreas = session.GetAll <FunctionalArea>(); var slottingControlsFunctionalArea = functionalAreas.FirstOrDefault(fa => fa.Description.ContainsValue(slottingControlsFunctionalAreaDescription)); if (slottingControlsFunctionalArea is null) { var descriptionDictionary = new Dictionary <string, string>(); foreach (var language in Globals.SupportedLanguages) { descriptionDictionary.Add(language, slottingControlsFunctionalAreaDescription); } slottingControlsFunctionalArea = new FunctionalArea { Description = descriptionDictionary, FaultTypes = new List <FaultType>() }; session.Store(slottingControlsFunctionalArea); } if (slottingControlsFunctionalArea.FaultTypes.All( ft => ft.Id != tarpsFaultTypeId)) { var faultTypeDescriptionDictionary = new Dictionary <string, string>(); foreach (var language in Globals.SupportedLanguages) { faultTypeDescriptionDictionary.Add(language, tarpsFaultTypeDescription); } slottingControlsFunctionalArea.FaultTypes.Add(new FaultType { Id = tarpsFaultTypeId, Description = faultTypeDescriptionDictionary, IsSelected = true }); } session.SaveChanges(); } } }
public async Task <IActionResult> Create([Bind("Id,Name")] FunctionalArea functionalArea) { if (ModelState.IsValid) { await _repo.Add(functionalArea); return(RedirectToAction(nameof(Index))); } return(View(functionalArea)); }
private void GetEventPanel(string eventName) { if (!Panel.IsPanelHeader(eventName)) { BBCRMHomePage.OpenEventsFA(); //Panel.CollapseSection("Event calendar", "CalendarViewForm"); // this causes an issues sometimes? FunctionalArea.OpenLink("Fundraising events", "Event search"); //Panel.WaitClick("//button[not(contains(@class,'actiongroup-tooltip-header'))]/div[./text()='Event search']"); BaseComponent.SetTextField("//div[contains(@style,'visible')]//input[contains(@id,'_NAME_value')]", eventName); SearchDialog.Search(); SearchDialog.SelectFirstResult(); } }
public void Apply() { foreach (var tenantConnectionString in _tenantConnectionStrings) { using (var documentStore = DocumentStoreFactory.CreateStore(tenantConnectionString)) using (var session = documentStore.OpenSession()) { const int programmeRequirementFaultTypeId = 78; const string campaignRequirementFunctionalAreaName = "Campaign Requirement"; var functionalAreas = session.GetAll <FunctionalArea>(); var programmeRequirementFunctionalArea = functionalAreas.FirstOrDefault(fa => fa.Description.ContainsValue(campaignRequirementFunctionalAreaName)); if (programmeRequirementFunctionalArea is null) { programmeRequirementFunctionalArea = new FunctionalArea { Description = new Dictionary <string, string> { { "ENG", campaignRequirementFunctionalAreaName }, { "ARA", campaignRequirementFunctionalAreaName } }, FaultTypes = new List <FaultType>() }; session.Store(programmeRequirementFunctionalArea); } if (programmeRequirementFunctionalArea.FaultTypes.All( ft => ft.Id != programmeRequirementFaultTypeId)) { programmeRequirementFunctionalArea.FaultTypes.Add(new FaultType { Id = programmeRequirementFaultTypeId, Description = new Dictionary <string, string> { { "ENG", "Programme Requirement (Achieved/Oversupply)" }, { "ARA", "Programme Requirement (Achieved/Oversupply)" } }, IsSelected = true }); } session.SaveChanges(); } } }
private void CreateRecord(string SmallDescription, string description) { using (var db = new Models.SmizeeContext()) { FunctionalArea entity = new FunctionalArea(); entity.SmallDescription = SmallDescription; entity.Description = description; db.FunctionalAreas.Add(entity); db.SaveChanges(); } BackPanel.Visible = true; ConfirmButtonPanel.Visible = false; DetailPanel.Visible = false; ShowInfo(MessagePanel, Resources.Resource.mRecordCreateOK); }
public void ThenEventDisplaysRegistrantSOnRegistrationsTab(string EventName, Table table) { IList <dynamic> registrants = table.CreateDynamicSet().ToList(); //navigate to Event EventName += uniqueStamp; BBCRMHomePage.OpenEventsFA(); try { Panel.WaitClick(XpathHelper.xPath.VisiblePanel + "//input[@placeholder='Enter the name of an event']/../span/img", 5); //use this for the timeout } catch { try { BaseComponent.GetEnabledElement("//span[contains(.,'Cannot read property')]", 5); Dialog.OK(); } catch { } FunctionalArea.OpenLink("Fundraising events", "Event search"); } //GetEventPanel(EventName); BaseComponent.SetTextField("//div[contains(@style,'visible')]//input[contains(@id,'_NAME_value')]", EventName); SearchDialog.Search(); SearchDialog.SelectFirstResult(); //Click Registrations tab Panel.SelectTab("Registrations"); foreach (dynamic registrant in registrants) { string guestOf = registrant.Extra + " " + registrant.RegistrantFirstName + " " + registrant.RegistrantLastName + uniqueStamp; guestOf = guestOf.Trim(); string registeredConstituent = registrant.RegistrantLastName + uniqueStamp + ", " + registrant.RegistrantFirstName; //check fields if (!string.IsNullOrEmpty(registrant.Extra)) { BaseComponent.GetEnabledElement(string.Format(XpathHelper.xPath.VisiblePanel + "//div[not(contains(@class,'x-hide-display')) and contains(@class,'bbui-pages-pagesection') and not(contains(@class,'row'))]//a[text()='{0}']", guestOf)); } else { BaseComponent.GetEnabledElement(string.Format(XpathHelper.xPath.VisiblePanel + "//div[not(contains(@class,'x-hide-display')) and contains(@class,'bbui-pages-pagesection') and not(contains(@class,'row'))]//a[text()='{0}']", registeredConstituent)); } BaseComponent.GetEnabledElement(string.Format(XpathHelper.xPath.VisiblePanel + "//div[not(contains(@class,'x-hide-display')) and contains(@class,'bbui-pages-pagesection') and not(contains(@class,'row'))]//div[text()='{0}']", Convert.ToString(registrant.Balance))); } }
public async Task <IActionResult> Edit(int id, [Bind("Id, Name")] FunctionalArea functionalArea) { if (id != functionalArea.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await _repo.Update(functionalArea); } catch (DbUpdateConcurrencyException) { throw; } return(RedirectToAction(nameof(Index))); } return(View(functionalArea)); }
public void Apply() { foreach (string tenantConnectionString in _tenantConnectionStrings) { using (IDocumentStore documentStore = DocumentStoreFactory.CreateStore(tenantConnectionString)) using (IDocumentSession session = documentStore.OpenSession()) { FunctionalArea functionalArea = getFunctionalAreaByDescription(session, _campaignRequirements); if (functionalArea != null) { foreach (var ft in _faultTypes) { addFaultTypeToFunctionalArea(functionalArea, generateFaultType(ft.Key, ft.Value)); } } session.SaveChanges(); } } }
public void GivenIAddAnAppealMailing(Table table) { //setup date field. StepHelper for date must come before dynamic objects StepHelper.SetTodayDateInTableRow("Mail date", table); dynamic objectData = table.CreateDynamicInstance(); //sorts out date format due to datetime adding 00:00:00 DateTime findDate = objectData.MailDate; //Naviate to Appeal Mailings BBCRMHomePage.OpenMarketingAndCommunicationsFA(); FunctionalArea.OpenLink("Appeal mailings"); //Click Add button Panel.WaitClick(@"//td[contains(@class,'x-toolbar-cell') and not (contains(@class,'x-hide-display'))]//button[text()='Add']"); //Populate Add appeal mailing form using Dialog.SetField Dialog.SetTextField("//input[contains(@id,'_NAME_value')]", objectData.Name + uniqueStamp); //need to convert date to a string Dialog.SetTextField("//input[contains(@id,'_MAILDATE_value')]", findDate.ToShortDateString()); Dialog.SetTextField("//input[contains(@id,'_APPEALID_value')]", objectData.Appeal + uniqueStamp); //need to appeand (Ad-hoc Query) string in order to match on input Dialog.SetTextField("//input[contains(@id,'_IDSETREGISTERID_value')]", objectData.Selection + uniqueStamp + " (Ad-hoc Query)"); Dialog.SetTextField("//input[contains(@id,'_MKTPACKAGEID_value')]", objectData.Package + uniqueStamp); Dialog.Save(); }
//private void GenerateJSON() //{ // List<FunctionalArea> functionalAreas = _functionalAreaRepository.GetAll().ToList(); // foreach (string language in new string[] { "ENG", "ARA" }) // { // StringBuilder json = new StringBuilder("[" + Environment.NewLine); // foreach (FunctionalArea functionalArea in functionalAreas) // { // json.Append(GenerateJSON(functionalArea, language)); // } // json.AppendLine("]"); // System.IO.File.WriteAllText(Path.Combine(string.Format(@"C:\Temp\FunctionalAreas-{0}.json", language)), json.ToString()); // } //} //private string GenerateJSON(FunctionalArea functionalArea, string language) //{ // Char quotes = '\"'; // StringBuilder json = new StringBuilder("\t{" + Environment.NewLine); // json.AppendLine(string.Format("\t\t{0}{1}{0}: ", quotes, functionalArea.Id.ToString()) + "{" + Environment.NewLine + // string.Format("\t\t\t{0}description{0}: {0}{1}{0},", quotes, functionalArea.Description[language]) + Environment.NewLine + // string.Format("\t\t\t{0}items{0}: ", quotes) + "{"); // foreach(FaultType faultType in functionalArea.FaultTypes) // { // json.Append(string.Format("\t\t\t\t{0}{1}{0}: {0}{2}{0}", quotes, faultType.Id, faultType.Description[language])); // if (faultType != functionalArea.FaultTypes.Last()) // { // json.Append(","); // } // json.Append(Environment.NewLine); // } // json.AppendLine("\t\t\t}"); // json.AppendLine("\t\t}"); // json.AppendLine("\t},"); // /* // { // “cbbba5e3 - 298c - 49a7 - b384 - 35a6f9a8f1d0”: { // “description”: “Campaign Requirement”, // “items”: { // “1”: “Outside Campaign Strike Weights”, // “2”: “Programme not in Requirement” // } // } // } // */ // return json.ToString(); //} /// <summary> /// Loads functional area data to repository from CSV /// </summary> /// <param name="inputFile"></param> /// <param name="languages"></param> /// <param name="funtionalAreaRepository"></param> private void LoadFunctionalAreasFromCSV(string inputFile, string[] languages, IFunctionalAreaRepository funtionalAreaRepository) { if (!File.Exists(inputFile)) { return; } List <FunctionalArea> functionalAreas = new List <FunctionalArea>(); Char delimiter = (Char)9; using (StreamReader reader = new StreamReader(inputFile)) { int rowCount = 0; while (!reader.EndOfStream) { rowCount++; if (rowCount > 1) // Ignore header { string[] values = reader.ReadLine().Split(delimiter); FaultType faultType = new FaultType() { Id = Convert.ToInt32(values[0]) }; foreach (string language in languages) { faultType.Description.Add(language, values[1].Trim()); } string functionalAreaDescription = values[2].Trim(); FunctionalArea functionalArea = null; foreach (FunctionalArea currentFunctionalArea in functionalAreas) { if (currentFunctionalArea.Description[languages[0]].ToUpper() == functionalAreaDescription.ToUpper()) { functionalArea = currentFunctionalArea; break; } } if (functionalArea == null) // New functional area { functionalArea = new FunctionalArea() { Id = Guid.NewGuid() }; foreach (string language in languages) { functionalArea.Description.Add(language, functionalAreaDescription); } functionalAreas.Add(functionalArea); } functionalArea.FaultTypes.Add(faultType); } } reader.Close(); } // Save foreach (FunctionalArea functionalArea in functionalAreas) { funtionalAreaRepository.Add(functionalArea); } }
public FixedList <NamedEntityDto> FunctionalAreas() { var list = FunctionalArea.GetList(); return(new FixedList <NamedEntityDto>(list.Select(x => x.MapToNamedEntity()))); }
public async Task Update(FunctionalArea functionalArea) { _myJob.FunctionalAreas.Update(functionalArea); await _myJob.SaveChangesAsync(); }
public async Task Add(FunctionalArea functionalArea) { await _myJob.FunctionalAreas.AddAsync(functionalArea); await _myJob.SaveChangesAsync(); }
public ValidateAccessAttribute2(FunctionalArea area) { _area = area; }