public Simulation(string argName, TestParam argTestParam, ref PersonForm view, ref UInt32 currentThreadNum) { currentThreadNum++; name = argName; testParam = argTestParam; currentStatus = PositionStatus.None; currentPosition.closePrice = 0.0; tradeTimes = 0; badTradeTimes = 0; goodTradeTimes = 0; profit = 0; simulationIndex = 0; currentPriceTrend = Trend.None; lastPriceTrend = Trend.None; TradeDt = new DataTable(); MAs = new List <MA>(8); MAs.Add(new MA(5)); MAs.Add(new MA(10)); MAs.Add(new MA(20)); MAs.Add(new MA(30)); MAs.Add(new MA(60)); MAs.Add(new MA(120)); MAs.Add(new MA(240)); updateCurrentStatusDelegate = new Model.Simulation.UpdateCurrentStatusDelegate(view.updateCurrentStatus); updateTradeLogParallelDelegate = new Model.Simulation.UpdateTradeLogParallelDelegate(view.updateTradeLogParallelTextBox); }
public PersonPresenter() { Person = new Person(); var form = new PersonForm(); form.FormClosed += OnFormClosed; _personView = form; }
public async Task<PersonSummary> Post(PersonForm form) { var request = Mapper.Map<CreatePersonRequest>(form); var person = await _mediator.SendAsync(request); _mediator.PublishAsync(new PersonCreatedNotification(person.Id)); return Mapper.Map<PersonSummary>(person); }
public ActionResult Edit(PersonForm form) { var p = PersonFromForm(form); var pp = FindPerson((string)TempData["personName"]); if (p.Birth != null) { db.Delete(p.Birth); } if (p.Death != null) { db.Delete(p.Death); } if (pp.Father != null) { pp.Father.Children.Remove(pp); db.Store(pp.Father.Children); } if (pp.Mother != null) { pp.Mother.Children.Remove(pp); db.Store(pp.Mother.Children); } pp.Name = p.Name; pp.Sex = p.Sex; pp.Mother = p.Mother; pp.Father = p.Father; pp.Birth = p.Birth; pp.Death = p.Death; if (p.Father != null) { pp.Father.Children.Add(pp); db.Store(pp.Father.Children); } if (p.Mother != null) { pp.Mother.Children.Add(pp); db.Store(pp.Mother.Children); } db.Store(pp); TempData["error"] = ValidatePerson(pp); if (TempData["error"] != null) { db.Rollback(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public async Task <PersonSummary> Post(PersonForm form) { var request = Mapper.Map <CreatePersonRequest>(form); var person = await _mediator.SendAsync(request); _mediator.PublishAsync(new PersonCreatedNotification(person.Id)); return(Mapper.Map <PersonSummary>(person)); }
public IActionResult Create(PersonForm pf) { if (ModelState.IsValid) { _service.Create(pf.toLocal()); return(RedirectToAction("Index", "Movie")); } return(View(pf)); }
protected override bool OnBackButtonPressed() { if (BindingContext is UpdatePersonViewModel vm) { vm.Unsubscribe(); PersonForm.Unsubscribe(); } return(base.OnBackButtonPressed()); }
private void btnPersonManager_Click(object sender, EventArgs e) { EnabledRefreshPage = true; if (PersonForm == null || PersonForm.IsDisposed) { PersonForm = new PersonManagerForm(); } PersonForm.WindowState = FormWindowState.Normal; PersonForm.Show(); PersonForm.BringToFront(); }
private Person PersonFromForm(PersonForm form) { return(new Person() { Name = form.Name, Mother = FindPerson(form.Mother), Father = FindPerson(form.Father), Birth = ParseDate(form.Birth), Death = ParseDate(form.Death), Sex = form.Sex, Children = new List <Person>() }); }
public PersonControllor(PersonForm view) { Model = new Person() { ID = "1", Name = "None" }; this.View = view; this.View.Controllor = this; this.InstrumentDT = Model.Csv.dataTable; }
public SimulationHouse(UInt16 artParallelNum, UInt16 argStartIndex, UInt16 argEndIndex, TestParamsRange argTpr, ref PersonForm argView) { parallelNum = artParallelNum; startIndex = argStartIndex; endIndex = argEndIndex; tpr = argTpr; view = argView; shareTable = new DataTable(); simulations = new List <Simulation>(1000); listTestParams = new List <TestParam>(); loadTestParams(); currentThreadNum = 0; }
private void EditPerson() { using (PersonForm form = new PersonForm(_cur_ent.Copy(), _base_map.Entities)) { form.AddLayers(_base_map.Layers); if (form.ShowDialog() == DialogResult.OK) { _base_map.Entities[_base_map.Entities.IndexOf(_cur_ent)] = form.Person; if (Edited != null) { Edited(this, EventArgs.Empty); } } } }
private void btnAddPerson_Click(object sender, EventArgs e) { PersonForm form = PersonForm.GetInstance(PersonForm.FormType.ADDITION); form.FormClosing += OnFormClosing; if (!form.Visible) { form.Show(); } else { form.BringToFront(); } }
private void dgvOverview_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { PersonForm form = PersonForm.GetInstance(PersonForm.FormType.MODIFICATION, int.Parse(dgvOverview.Rows[e.RowIndex].Cells["colOverPersonID"].Value.ToString())); form.FormClosing += OnFormClosing; if (!form.Visible) { form.Show(); } else { form.BringToFront(); } }
public void getHistoryPrice() { O2GSession session = null; try { LoginParams loginParams = new LoginParams(ConfigurationManager.AppSettings); SampleParams sampleParams = new SampleParams(ConfigurationManager.AppSettings); PrintSampleParams("GetHistPrices", loginParams, sampleParams); session = O2GTransport.createSession(); SessionStatusListener statusListener = new SessionStatusListener(session, loginParams.SessionID, loginParams.Pin); session.subscribeSessionStatus(statusListener); statusListener.Reset(); session.login(loginParams.Login, loginParams.Password, loginParams.URL, loginParams.Connection); if (statusListener.WaitEvents() && statusListener.Connected) { ResponseListener responseListener = new ResponseListener(session); session.subscribeResponse(responseListener); GetHistoryPrices(session, sampleParams.Instrument, sampleParams.Timeframe, sampleParams.DateFrom, sampleParams.DateTo, responseListener); Console.WriteLine("Done!"); updateLogDelegate("Done!"); PersonForm.EnableStandby(); // writeHistoryPriceToFile(sampleParams.Instrument); // updateNames(sampleParams.Instrument); statusListener.Reset(); session.logout(); statusListener.WaitEvents(); session.unsubscribeResponse(responseListener); } session.unsubscribeSessionStatus(statusListener); } catch (Exception e) { Console.WriteLine("Exception: {0}", e.ToString()); // updateLogDelegate(string.Format("Exception: {0}", e.ToString())); } finally { if (session != null) { session.Dispose(); } } }
private void PersonItem_Click(object sender, EventArgs e) { using (PersonForm form = new PersonForm(_base_map.Entities)) { form.AddLayers(_base_map.Layers); form.SelectedIndex = CurrentLayer; if (form.ShowDialog() == DialogResult.OK) { form.Person.X = (short)(_mouse.X / Zoom + TileWidth / 2 - 1); form.Person.Y = (short)(_mouse.Y / Zoom + TileHeight / 2 - 1); _base_map.Entities.Add(form.Person); form.Person.Visible = _base_map.Layers[CurrentLayer].Visible; Invalidate(); if (Edited != null) { Edited(this, EventArgs.Empty); } } } }
// handle the case for both entities and players: private void EditEntityItem_Click(object sender, EventArgs e) { Entity ent = GetEntityAt(cur_x, cur_y); if (ent.Type == 1) { PersonForm form = new PersonForm(ent, Entities); foreach (Layer l in Layers) { form.AddString(l.Name); } form.SelectedIndex = (int)ent.Layer; if (form.ShowDialog() == DialogResult.OK) { Entities[Entities.IndexOf(ent)] = form.Person; UpdateAllLayers(); if (MapEdited != null) { MapEdited(this, new EventArgs()); } } } else if (ent.Type == 2) { TriggerForm form = new TriggerForm(ent); foreach (Layer l in Layers) { form.AddString(l.Name); } form.SelectedIndex = ent.Layer; if (form.ShowDialog() == DialogResult.OK) { Entities[Entities.IndexOf(ent)] = form.Trigger; UpdateAllLayers(); if (MapEdited != null) { MapEdited(this, new EventArgs()); } } } }
private void PersonItem_Click(object sender, EventArgs e) { PersonForm personform = new PersonForm(Entities); foreach (Layer l in Layers) { personform.AddString(l.Name); } personform.SelectedIndex = _layer; personform.Person.X = (short)((cur_x) * tile_width + (tile_width / 2)); personform.Person.Y = (short)((cur_y) * tile_height + (tile_height / 2)); if (personform.ShowDialog() == DialogResult.OK) { Entities.Add(personform.Person); if (MapEdited != null) { MapEdited(this, new EventArgs()); } Refresh(); } }
/// <summary> /// Creates an individual account for the specified customer /// </summary> /// <param name="newCustomer">The customer.</param> private void createIndividual(Customer newCustomer) { newCustomer = getAccountType(newCustomer); try { PersonForm newPerson = new PersonForm(); newCustomer.Name = newPerson.Name; newCustomer.Occupation = newPerson.Occupation; newCustomer.PhoneNo = newPerson.PhoneNo; newCustomer.Pin = newPerson.Pin; newCustomer.Address = newPerson.Address; newCustomer.DOB = newPerson.DOB; newCustomer.Email = newPerson.Email; newCustomer.Gender = newPerson.Gender; cDatabase.Add(newCustomer.GetAccount.GetAccNum, newCustomer); } catch (Exception) { Console.WriteLine("Operation not successful...Please try again"); createAccount(); } }
public async Task <ActionResult> Create([FromForm] PersonForm personForm) { try { // now send blob up to Azure await _blobStorageService.CreateBlobAsync( personForm.File.OpenReadStream(), personForm.File.FileName); // send to Cosmos await _personService.AddItemAsync(new Person { Id = personForm.Id, Name = personForm.Name, Ssn = personForm.Ssn }); //Ændre dette til at returnere et til detail view return(View("Person")); } catch (Exception ex) { return(BadRequest(ex)); } }
public ActionResult Index(PersonForm form) { if (FindPerson(form.Name) != null) { TempData["error"] = "that person allready exists"; return(RedirectToAction("Index")); } var p = PersonFromForm(form); if (p.Mother != null) { p.Mother.Children.Add(p); } if (p.Father != null) { p.Father.Children.Add(p); } TempData["error"] = ValidatePerson(p); if (TempData["error"] == null) { if (p.Mother != null) { db.Store(p.Mother.Children); } if (p.Father != null) { db.Store(p.Father.Children); } db.Store(p); } return(RedirectToAction("Index")); }
protected override void OnAppearing() { base.OnAppearing(); PersonForm.OnAttached(); }
public InstitutionalAgreementContactForm() { Person = new PersonForm(); }
public IActionResult Edit(PersonForm p) { _service.Update(p.toLocal()); return(RedirectToAction("Index")); }
private void btnManageEmployee_Click(object sender, EventArgs e) { PersonForm <Employee> dialog = new PersonForm <Employee>(_unitOfWork); }
private void btnManageCustomer_Click(object sender, EventArgs e) { PersonForm <Customer> dialog = new PersonForm <Customer>(_unitOfWork); }
// handle the case for both entities and players: private void EditEntityItem_Click(object sender, EventArgs e) { Entity ent = GetEntityAt(cur_x, cur_y); if (ent.Type == 1) { PersonForm form = new PersonForm(ent, Entities); foreach (Layer l in Layers) form.AddString(l.Name); form.SelectedIndex = (int)ent.Layer; if (form.ShowDialog() == DialogResult.OK) { Entities[Entities.IndexOf(ent)] = form.Person; UpdateAllLayers(); if (MapEdited != null) MapEdited(this, new EventArgs()); } } else if (ent.Type == 2) { TriggerForm form = new TriggerForm(ent); foreach (Layer l in Layers) form.AddString(l.Name); form.SelectedIndex = ent.Layer; if (form.ShowDialog() == DialogResult.OK) { Entities[Entities.IndexOf(ent)] = form.Trigger; UpdateAllLayers(); if (MapEdited != null) MapEdited(this, new EventArgs()); } } }
private void PersonItem_Click(object sender, EventArgs e) { PersonForm personform = new PersonForm(Entities); foreach (Layer l in Layers) personform.AddString(l.Name); personform.SelectedIndex = _layer; personform.Person.X = (short)((cur_x) * tile_width + (tile_width / 2)); personform.Person.Y = (short)((cur_y) * tile_height + (tile_height / 2)); if (personform.ShowDialog() == DialogResult.OK) { Entities.Add(personform.Person); if (MapEdited != null) MapEdited(this, new EventArgs()); Refresh(); } }
/// <summary> /// Updates the profile of a customer with an individual account. /// </summary> /// <param name="customer">The customer.</param> private void updatePerson(Customer customer) { PersonForm newForm = new PersonForm(); int opr; if (Int32.TryParse(Console.ReadLine(), out opr)) { try { switch (opr) { case 1: Console.WriteLine("Old Name: " + customer.Name); string newName = newForm.getName(); customer.Name = newName; break; case 2: Console.WriteLine("Old Email: " + customer.Email); string newEmail = newForm.getEmail(); customer.Email = newEmail; break; case 3: Console.WriteLine("Old Address: " + customer.Address); string newAddress = newForm.getAddress(); customer.Address = newAddress; break; case 4: Console.WriteLine("Old Phone: " + customer.PhoneNo); string newPhone = newForm.getPhoneNumber(); customer.PhoneNo = newPhone; break; case 5: Console.WriteLine("Old Occupation: " + customer.Occupation); string newOccupation = newForm.getOccupation(); customer.Occupation = newOccupation; break; case 6: Console.WriteLine("Old Pin: " + customer.Pin); int newPin = newForm.getPin(); customer.Pin = newPin; break; case 7: Console.WriteLine("Old Account Type: " + customer.GetAccount.GetAccType); int op; Console.WriteLine("Select Your New account Type"); Console.WriteLine("1. Saving Account"); Console.WriteLine("1. Curent Account"); Console.WriteLine("1. Fixed Deposit Account"); if (Int32.TryParse(Console.ReadLine(), out op)) { customer.newCustomer(op); } else { Console.WriteLine("invalid input"); updatePerson(customer); } break; case 8: Console.WriteLine("Invalid Input"); updatePerson(customer); break; } } catch (CustomerException) { Console.WriteLine("Updating not successful...Please try again"); updatePerson(customer); } } else { Console.WriteLine("Invalid Operation"); updatePerson(customer); } }
private void Button4_Click(object sender, EventArgs e) { PersonForm PersonForm = new PersonForm(); PersonForm.Show(); }