public async Task <IActionResult> Edit(int id, [Bind("InversionId,ProyectoId,ApplicationUserId,TipoInversionesId,Cuota,Intereses,Total")] Inversion inversion) { if (id != inversion.InversionId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inversion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InversionExists(inversion.InversionId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["InversorId"] = new SelectList(_context.Users, "Id", "Id", inversion.InversorId); ViewData["ProyectoId"] = new SelectList(_context.Proyecto, "ProyectoId", "Nombre", inversion.ProyectoId); ViewData["TipoInversionesId"] = new SelectList(_context.TiposInversiones, "TiposInversionesId", "Nombre", inversion.TipoInversionesId); return(View(inversion)); }
public void InversionCount_BruteForce_Int_TestOnArrayWithOneElement() { var array = new int[] { 1 }; var count = Inversion.CountBruteForce(array); Assert.AreEqual(0, count); }
public void InversionCount_BruteForce_Int_TestOnEmptyArray() { var array = new int[] { }; var count = Inversion.CountBruteForce(array); Assert.AreEqual(0, count); }
public ActionResult Financiar(decimal monto) { int idProyecto = (int)Session["proyectoAFinanciar"]; Proyecto p = db.Proyectos.Find(idProyecto); //Solicitante s = (Solicitante)db.Usuarios.Find(p.cedula); //p.solicitante = s; //creacion de nueva inversion Inversion i = new Inversion { fechaHora = DateTime.Now, idProyecto = p.id, Inversor_cedula = (string)Session["usuario"], montoInversion = monto }; //calculos previos al update de proyecto var montoFinal = p.montoRestante - monto; if (montoFinal <= 0) { p.estado = "Cerrado"; } var tareaPost = cliente.PutAsJsonAsync(proyectoUri + "/update/" + p.id, p); var result = tareaPost.Result; if (result.IsSuccessStatusCode) { db.Inversiones.Add(i); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ResultadoOperación = "Ups! Verifique los datos"; return(View(p)); }
public void InversionCount_BruteForce_Int_TestOnReverseSortedArray() { var array = new int[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; var count = Inversion.CountBruteForce(array); Assert.AreEqual(45, count); }
public void InversionCount_BruteForce_Int_TestOnUnsortedArrayWithDuplicates() { var array = new int[] { 0, 3, 9, 7, 1, 4, 5, 2, 7, 8, 6, 3, 1 }; var count = Inversion.CountBruteForce(array); Assert.AreEqual(36, count); }
public void InversionCount_BruteForce_Int_TestOnUnsortedArray() { var array = new int[] { 0, 3, 9, 1, 4, 5, 2, 7, 8, 6 }; var count = Inversion.CountBruteForce(array); Assert.AreEqual(13, count); }
public void InversionCount_BruteForce_Int_TestOnSortedArray() { var array = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var count = Inversion.CountBruteForce(array); Assert.AreEqual(0, count); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Monto,Plazo,TasaInteres,FechaIngreso")] Inversion inversion) { if (id != inversion.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inversion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InversionExists(inversion.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inversion)); }
public PitchSave(Pitch pitch) { letterName = pitch.LetterName.LN; degree = pitch.Degree; inversion = pitch.Inversion; octave = pitch.Octave; }
/// <summary> /// 和音の構成音を戻す。そのままバスの音名を戻す関数としても使える。 /// </summary> /// <param name="bassInversion">None: 根音、First: 第3音、Second: 第5音、Third: 第7音、Fourth: 第9音</param> /// <returns></returns> public LnDegInversion GetChordLnDegInversion(Inversion inversion) { System.Diagnostics.Debug.Assert(0 <= (int)inversion); switch (ct.chordDegree) { case CD.I: case CD.II: case CD.III: case CD.IV: case CD.VI: case CD.VII: { int idx = (int)ct.chordDegree + (int)inversion * 2; idx %= 7; return(new LnDegInversion(chordLnDeg123467[idx], inversion)); } case CD.V: return(new LnDegInversion(chordLnDeg5[(int)inversion], inversion)); default: break; } System.Diagnostics.Debug.Assert(false); return(LnDegInversion.INVALID); }
public FinderViewModel() { this.Title = "Chord Finder"; this.FinderKeyboardTappedCommand = new Command(this.OnFinderKeyboardTapped); this.selectedInversion = this.Inversions[0]; this.ResetFinderChord(); }
public void InversionCount_Int_TestOnLargeData() { var integers = LoadIntegers(); var count = Inversion.Count(integers); Assert.AreEqual(2407905288, count); }
private ISampleProvider[] CreateTriad(int newDoNoteNumber, int degree, TimeSpan noteDuration) { ISampleProvider[] samples; switch (degree) { case 1: case 4: case 5: samples = Inversion.CreateTriadInversionEx(InversionType.Root, noteDuration, newDoNoteNumber, newDoNoteNumber + Interval.UpMajor3rd, newDoNoteNumber + Interval.UpPerfect5th); break; case 2: case 3: case 6: samples = Inversion.CreateTriadInversionEx(InversionType.Root, noteDuration, newDoNoteNumber, newDoNoteNumber + Interval.UpMinor3rd, newDoNoteNumber + Interval.UpPerfect5th); break; case 7: samples = Inversion.CreateTriadInversionEx(InversionType.Root, noteDuration, newDoNoteNumber, newDoNoteNumber + Interval.UpMinor3rd, newDoNoteNumber + Interval.UpDiminished5th); break; default: throw new NotImplementedException($"degree '{degree}' is not supported."); } return(samples); }
public void InversionCount_String_TestOnSortedArray() { var array = new string[] { "a", "b", "c", "d", "e", "f", "g" }; var ethalon = Inversion.CountBruteForce(array); var count = Inversion.Count(array); Assert.AreEqual(ethalon, count); }
public ActionResult DeleteConfirmed(int id) { Inversion inversion = db.Inversiones.Find(id); db.Inversiones.Remove(inversion); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Initializes a new instance of the <see cref="ChordDataViewModel" /> class. /// </summary> public ChordDataViewModel() { this.ChordKeyboardTappedCommand = new DelegateCommand(this.OnChordKeyboardTapped, this.ChordKeyboardTappedCanExecute); this.FinderKeyboardTappedCommand = new DelegateCommand(this.OnFinderKeyboardTapped, this.FinderKeyboardTappedCanExecute); this.ScaleKeyboardTappedCommand = new DelegateCommand(this.OnScaleKeyboardTapped, this.ScaleKeyboardTappedCanExecute); this.selectedInversion = this.Inversions[0]; this.FinderChord = Chord.Create("Mystery Chord", new List <int>()); }
private void Refrescarbutton_Click(object sender, EventArgs e) { Inversion inversion = InversionBLL.Buscar(1); Montolabel.Text = 0.ToString(); Montolabel.Text = $"${inversion.Monto.ToString()}"; Montolabel.ForeColor = Color.Green; }
private void InversionEmpresa_Load(object sender, EventArgs e) { Inversion inversion = InversionBLL.Buscar(1); Montolabel.Text = 0.ToString(); Montolabel.Text = $"${inversion.Monto.ToString()}"; Montolabel.ForeColor = Color.Green; }
public void InversionMutationTest() { IChromosome<int> a = new DigitalChromosome().GenerateFromArray(new int[] { 12, 13, 14, 15, 16, 17, 18, 19, 20 }); Inversion<int> mutation = new Inversion<int>(3, 5); IChromosome<int> res = mutation.Mutate(a); IChromosome<int> exp = new DigitalChromosome().GenerateFromArray(new int[] { 12, 13, 14, 17, 16, 15, 18, 19, 20 }); Assert.AreEqual(exp, res); }
// Start is called before the first frame update void Start() { inversion = PostProcessManager.I.Inversion; _mask.onValueChanged.AddListener(SetMask); _color.onValueChanged.AddListener(SetColor); _uv.onValueChanged.AddListener(SetUV); }
private MixingSampleProvider CreateMajorTriad(string doNoteName, string chordAndInversion, string movement) { _log.Debug($"doNoteName: {doNoteName}, chordAndInversion: {chordAndInversion}, movement: {movement ?? "null"}"); double bpm = double.Parse(ConfigurationManager.AppSettings["BPM"]); double quarterNoteMillis = (60 / bpm) * 1000; double halfNoteMillis = quarterNoteMillis * 2; TimeSpan noteDuration = TimeSpan.FromMilliseconds(halfNoteMillis); string doNoteRegisterString = Regex.Replace(doNoteName, "[A-G#b]", ""); int doNoteRegister = int.Parse(doNoteRegisterString); string[] parts = chordAndInversion.Trim().Split(' '); string chord = parts[0].Trim(); string inversion = parts[1].Trim(); InversionType inversionType; switch (inversion) { case "(root)": inversionType = InversionType.Root; break; case "(1st)": inversionType = InversionType.LowFirst; break; case "(2nd)": inversionType = InversionType.LowSecond; break; default: inversionType = InversionType.Root; break; } string thisChordRootNote = GetClosestNote(doNoteName, chord); //thisChordRootNote = chord + doNoteRegister.ToString(); _log.Debug($"doNoteName: {doNoteName}, thisChordRootNote: {thisChordRootNote}"); string doFileName = NAudioHelper.GetFileNameFromNoteName(thisChordRootNote); doFileName = Path.GetFileName(doFileName); int doNoteNumber = int.Parse(doFileName.Split('.')[0]); ISampleProvider[] samples; samples = Inversion.CreateTriadInversionEx(inversionType, noteDuration, doNoteNumber, doNoteNumber + Interval.UpMajor3rd, doNoteNumber + Interval.UpPerfect5th, doNoteNumber.BassNoteNumber()); MixingSampleProvider msp = new MixingSampleProvider(samples[0].WaveFormat); msp.AddMixerInput(samples[0]); msp.AddMixerInput(samples[1]); msp.AddMixerInput(samples[2]); msp.AddMixerInput(samples[3]); return(msp); }
static void Main(string[] args) { var file = new FileReader(); file.ReadToArray("numbers.txt"); var inv = new Inversion(); var sor = inv.CountInversion(file.GetArray()); Int64 a = inv.inversionCount; Console.WriteLine(a); }
public void InversionCount_Int_TestOnUnsortedArrayWithDuplicates() { // inversion count = 36 var array = new int[] { 0, 3, 9, 7, 1, 4, 5, 2, 7, 8, 6, 3, 1 }; var ethalon = Inversion.CountBruteForce(array); var count = Inversion.Count(array); Assert.AreEqual(ethalon, count); }
public void InversionCount_String_TestOnUnsortedArrayWithDuplicates() { // inversion count = 22 var array = new string[] { "f", "b", "g", "a", "d", "e", "a", "c", "b" }; var ethalon = Inversion.CountBruteForce(array); var count = Inversion.Count(array); Assert.AreEqual(ethalon, count); }
public ChordDataViewModel() { this.Title = "Chord Factory"; this.ChordKeyboardTappedCommand = new Command(this.OnChordKeyboardTapped); this.FinderKeyboardTappedCommand = new Command(this.OnFinderKeyboardTapped); this.ScaleKeyboardTappedCommand = new Command(this.OnScaleKeyboardTapped); this.selectedInversion = this.Inversions[0]; this.FinderChord = Chord.Create("Mystery Chord", new List <int>()); }
public TestingContext() { store = new TokenStore(); Inversion = new Inversion(store); var inner = new InnerRegistration(store, null, DefaultPriority); var innerHighLevel = new InnerHighLevelRegistration(store, null, DefaultPriority); reg = new Registration(store, inner, innerHighLevel); }
public override LogicElementViewModel Clone() { var model = new Inversion(); model.CopyValues(GetModel()); return(new InversionViewModel(model, _globalCommands) { Caption = this.Caption }); }
public ActionResult Edit([Bind(Include = "id_inversion,fecha,monto_capital,monto_ganancia, id_operacion")] Inversion inversion) { if (ModelState.IsValid) { db.Entry(inversion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(inversion)); }
public void InversionCount_Int_TestOnReverseSortedArray() { // inversion count = 45 // formula: max inversion count = n(n-1)/2 var array = new int[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; var ethalon = Inversion.CountBruteForce(array); var count = Inversion.Count(array); Assert.AreEqual(ethalon, count); }
public ActionResult Create([Bind(Include = "id_inversion,fecha,monto_capital,monto_ganancia, id_operacion")] Inversion inversion) { if (ModelState.IsValid) { db.Inversiones.Add(inversion); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(inversion)); }
public async Task <IActionResult> Create([Bind("Id,Monto,Plazo,TasaInteres,FechaIngreso")] Inversion inversion) { if (ModelState.IsValid) { _context.Add(inversion); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(inversion)); }