public async Task <IActionResult> Edit(int id, Plata plata) { if (id != plata.PlataId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Plati.Update(plata); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlataExists(plata.PlataId)) { return(NotFound()); } else { throw; } } TempData["Message"] = "Plata actualizata cu succes!"; TempData["Success"] = "true"; return(RedirectToAction(nameof(Index))); } ViewData["ClientId"] = new SelectList(_context.Client.OrderBy(x => x.Denumire), "ClientId", "Denumire", plata.ClientId); ViewData["TipPlataId"] = new SelectList(_context.TipPlati.OrderBy(x => x.Denumire), "TipPlataId", "Denumire", plata.TipPlataId); return(View(plata)); }
public ActionResult Snimi(UrediVM model) { Plata x; if (!ModelState.IsValid) { model.ZaposlenikStavka = ZaposlenikStavka(); return(View("Uredi", model)); } if (model.Id == 0) { x = new Plata(); db.Plate.Add(x); } else { x = db.Plate.Find(model.Id); } x.RokIsplate = model.RokIsplate; x.IznosPlate = model.iznosPlate; x.Isplaceno = model.Isplaceno; x.ZaposlenikId = model.ZaposlenikId; db.SaveChanges(); return(RedirectToAction("Prikazi")); }
public async Task <Plata> GenereazaPlata(Contract contract) { if (contract == null) { throw new ArgumentNullException("Contractul este null"); } if (!contract.Valabil) { throw new ArgumentException("Nu poate fi emisa factura pentru un contract incheiat"); } if (contract.Abonament.Expirat) { throw new ArgumentException("Contract invalid. Abonamentul este expirat"); } double costTotal = this.GetCost(contract); Plata plata = new Plata { TotalDePlata = new Pret { Id = new Guid(), Suma = costTotal, Valuta = "RON" }, Contract = contract, DataScadenta = new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, DateTime.Now.Day), SumaPlatita = new Pret { Id = new Guid(), Suma = 0, Valuta = "RON" } }; await this.plataRepository.Insert(plata); return(plata); }
public static List <Plata> findAllPlata() { string query = "SELECT * FROM Plati"; List <Plata> plati = new List <Plata>(); using (SQLiteConnection connection = new SQLiteConnection(Connection.ConnectionString)) { connection.Open(); using (SQLiteCommand command = new SQLiteCommand(query, connection)) { using (SQLiteDataReader sqlReader = command.ExecuteReader()) { while (sqlReader.Read()) { long id = (long)sqlReader["Id"]; double valoare = Convert.ToDouble((long)sqlReader["Valoare"]); DateTime scadenta = DateTime.Parse((string)sqlReader["Scadenta"]); Plata plata = new Plata(id, valoare, scadenta); plati.Add(plata); } } } return(plati); } }
public IActionResult SnimiPlatu(PlataVM plata) { if (_context.Plata.SingleOrDefault(x => x.KorisnickiNalogId == plata.KorisnickiNalogID) == null) { Plata p = new Plata(); p.Osnovica = plata.Osnova; p.Bonus = plata.Bonus; p.KorisnickiNalogId = plata.KorisnickiNalogID; p.Ukupno = plata.Osnova + plata.Bonus; _context.Plata.Add(p); _context.SaveChanges(); return(RedirectToAction("Prikazi")); } else { Plata pl = _context.Plata.SingleOrDefault(x => x.KorisnickiNalogId == plata.KorisnickiNalogID); pl.Osnovica = plata.Osnova; pl.Bonus = plata.Bonus; pl.Ukupno = plata.Osnova + plata.Bonus; _context.Plata.Update(pl); _context.SaveChanges(); return(RedirectToAction("Prikazi")); } }
public static Plata findPlataById(long idPlata) { string query = "SELECT * FROM Plati where Id = @id"; Plata plata = null; using (SQLiteConnection connection = new SQLiteConnection(Connection.ConnectionString)) { connection.Open(); using (SQLiteCommand command = new SQLiteCommand(query, connection)) { command.Parameters.AddWithValue("@id", idPlata); using (SQLiteDataReader sqlReader = command.ExecuteReader()) { while (sqlReader.Read()) { long id = (long)sqlReader["Id"]; double valoare = (double)sqlReader["Valoare"]; DateTime scadenta = DateTime.Parse((string)sqlReader["Scadenta"]); plata = new Plata(id, valoare, scadenta); } } } return(plata); } }
public IActionResult UrediSave(PlataDodajVM model) { if (ModelState.IsValid) { Plata p = _db.Plata.Find(model.PlataId); if (p == null) { p = new Plata { Datum = DateTime.Now }; _db.Add(p); } p.Iznos = model.Iznos; p.ZaposlenikId = model.ZaposlenikId; _db.SaveChanges(); return(RedirectToAction("List")); } else { GenerisiCmbStavke(model); return(View("Uredi", model)); } }
public JsonResult Edit(Plata Plata) { response toReturn = new response(true, "", null, null, new List <Error>()); string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]); if (Plata.ID == null) // insert { Plata p = new Plata(_CURENT_USER_ID, conStr); PropertyInfo[] pis = Plata.GetType().GetProperties(); foreach (PropertyInfo pi in pis) { pi.SetValue(p, pi.GetValue(Plata)); } toReturn = p.Insert(); } else // { Plata p = new Plata(_CURENT_USER_ID, conStr, Convert.ToInt32(Plata.ID)); string s = JsonConvert.SerializeObject(Plata, Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = CommonFunctions.DATE_FORMAT }); toReturn = p.Update(s); } return(Json(toReturn, JsonRequestBehavior.AllowGet)); }
public JsonResult MovePendingToOk(PlataExtended plata) { string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]); Plata p = new Plata(_CURENT_USER_ID, conStr); PropertyInfo[] pis = plata.Plata.GetType().GetProperties(); foreach (PropertyInfo pi in pis) { pi.SetValue(p, pi.GetValue(plata.Plata)); // ca sa avem un obiect si cu credentiale } response toReturn = p.UpdateWithErrors(); if (!toReturn.Status) { return(Json(toReturn, JsonRequestBehavior.AllowGet)); } toReturn = p.Validare(); if (!toReturn.Status) { return(Json(toReturn, JsonRequestBehavior.AllowGet)); } PlatiRepository pr = new PlatiRepository(_CURENT_USER_ID, conStr); toReturn = pr.MovePendingToOk(Convert.ToInt32(p.ID)); return(Json(toReturn, JsonRequestBehavior.AllowGet)); }
public void TestDataPlataProperty() { Plata plata = new Plata(); plata.DataPlata = DateTime.Today; Assert.AreEqual(DateTime.Today, plata.DataPlata); }
private bool ProvjeriFormu() { foreach (var entry in entries) { if (string.IsNullOrWhiteSpace(entry.Text)) { entry.PlaceholderColor = Color.Red; entry.Focus(); return(false); } entry.StyleClass = new[] { "" }; } if (!ValidateDigits(Jmbg.Text)) { this.DisplayAlert("JMBG", "Molimo unesite samo brojeve", "OK"); Jmbg.Focus(); return(false); } if (!ValidateDigits(Telefon.Text)) { this.DisplayAlert("Telefon", "Molimo unesite samo brojeve", "OK"); Telefon.Focus(); return(false); } if (!ValidateEmail(Email.Text)) { this.DisplayAlert("Email", "Niste unijeli pravilan email", "OK"); Email.Focus(); return(false); } if (!ValidateDigits(Plata.Text)) { this.DisplayAlert("Plata", "Molimo unesite samo brojeve (. - delimitor)", "OK"); Plata.Focus(); return(false); } if (NovaLozinka.Text != PonovljenaLozinka.Text) { this.DisplayAlert("Lozinka", "Ponovljena lozinka nije ista", "OK"); PonovljenaLozinka.Focus(); return(false); } if (Uloga.SelectedIndex == 0) { Uloga.Focus(); return(false); } return(true); }
public void TestTotalDePlataProperty() { Plata plata = new Plata(); Pret pret = new Pret(); plata.TotalDePlata = pret; Assert.AreEqual(pret, plata.TotalDePlata); }
public void TestContractProperty() { Plata plata = new Plata(); Contract contract = new Contract(); plata.Contract = contract; Assert.AreEqual(contract, plata.Contract); }
public EditClientForm(Client client, Plata plata) { InitializeComponent(); this.client = client; this.plata = plata; abonamente = new List <TipAbonament>(); extraOptiuni = new List <ExtraOptiune>(); }
public void TestIdProperty() { Plata plata = new Plata(); Guid id = new Guid(); plata.Id = id; Assert.AreEqual(id, plata.Id); }
public async Task TestDeletePlataNull() { Plata plata = null; ArgumentNullException exception = await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => controller.DeletePlata(plata)); Assert.AreEqual(exception.ParamName, nameof(plata)); }
public async Task TestGetById() { this.plataRepositoryMock.Setup(mock => mock.GetById(It.IsAny <Guid>())).ReturnsAsync(new Plata()); Plata plata = await controller.GetById(Guid.NewGuid()); Assert.IsNotNull(plata); }
public void TestClientProperty() { Plata plata = new Plata(); Client client = new Client(); plata.Client = client; Assert.AreEqual(client, plata.Client); }
public IActionResult Obrisi(int id) { Plata obrisi = _db.Plata.Find(id); _db.Remove(obrisi); _db.SaveChanges(); return(RedirectToAction("List")); }
public void GetAllPlataTest() { var target = Plata.GetAll(); if (target == null) { Assert.Fail(); } }
private bool PlatesteFactura(FacturaIesire factura, decimal plataPartiala = 0, bool plataAutomata = true) { var sumaDePlatit = sumaDisponibila > factura.SumaRamasaDePlatit ? factura.SumaRamasaDePlatit : sumaDisponibila; if (plataPartiala != 0) { sumaDePlatit = plataPartiala; } else { if (!plataAutomata) { if (MessageBox.Show("Doriti sa achitati aceasta factua integral?", "Plata factura", MessageBoxButtons.YesNo) != DialogResult.Yes) { return(false); } } } var plata = new Plata { Data = dataDtp.Value, Numar = nrTbox.Text, Serie = serieTbox.Text, Suma = sumaDePlatit, TipPlata = TipPlata }; var errors = plata.GetErrorString(); if (errors.Trim() != string.Empty) { MessageBox.Show(errors); return(false); } factura.AdaugaPlata(plata); var result = factura.AchitareFactura(); if (result.Status == GestiuneBusiness.Enums.StatusEnum.Saved) { MessageBox.Show(String.Format("Plata inregistrata pentru factura cu seria '{0}' si numarul '{1}'", factura.Serie, factura.Numar)); sumaDisponibila = sumaDisponibila - sumaDePlatit; if (sumaDisponibila == 0) { nrTbox.Text = string.Empty; serieTbox.Text = string.Empty; sumaDisponibilaTbox.Text = string.Empty; } RefreshFacturiIesireGrid(); } else { MessageBox.Show(String.Format("Plata pentru factura cu seria '{0}' si numarul '{1}' nu a fost efectuata cu succes, suma nu a fost retrasa", factura.Serie, factura.Numar)); } sumaDisponibilaTbox.Enabled = sumaDisponibila == 0m; nrTbox.Enabled = sumaDisponibilaTbox.Enabled; serieTbox.Enabled = sumaDisponibilaTbox.Enabled; return(true); }
public async Task UpdatePlata(Plata plata) { if (plata == null) { throw new ArgumentNullException(nameof(plata)); } await this.plataRepository.Update(plata); }
public JsonResult Delete(int id) { response r = new response(); string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]); //DosareRepository dr = new DosareRepository(_CURENT_USER_ID, conStr); Plata p = new Plata(_CURENT_USER_ID, conStr, id); r = p.Delete(); return(Json(r, JsonRequestBehavior.AllowGet)); }
public IActionResult Uredi(int id) { Plata p = _db.Plata.Find(id); PlataDodajVM model = new PlataDodajVM(); model.Iznos = p.Iznos; model.ZaposlenikId = p.ZaposlenikId; GenerisiCmbStavke(model); return(View(model)); }
public async Task AddPlata(Plata plata) { if (plata == null) { throw new ArgumentNullException(nameof(plata)); } this.Validate(plata); await this.plataRepository.Insert(plata); }
public IActionResult UrediPlatu(int PlataId) { Plata pronadjenaPlata = reposPlata.GetById(PlataId); List <Uposlenik> uposlenici = reposUposlenici.GetAll(); PlataViewModel plataVM = new PlataViewModel() { Plata = pronadjenaPlata, Uposlenici = uposlenici }; return(View(plataVM)); }
public async Task TestDeletPlata() { Plata plata = new Plata() { Id = new Guid() }; this.plataRepositoryMock.Setup(t => t.Delete(It.IsAny <Plata>())).Verifiable(); await controller.DeletePlata(plata); this.plataRepositoryMock.VerifyAll(); }
public void TestEsteAchitatProperty() { Plata plata = new Plata(); plata.TotalDePlata = new Pret() { Suma = 100 }; plata.SumaPlatita = new Pret() { Suma = 0 }; Assert.AreEqual(false, plata.EsteAchitat); }
public async Task TestUpdate() { Plata plata = new Plata() { Id = new Guid() }; plata.TotalDePlata = new Pret(); this.plataRepositoryMock.Setup(t => t.Update(It.IsAny <Plata>())).Verifiable(); await controller.UpdatePlata(plata); this.plataRepositoryMock.VerifyAll(); }
private void LoadData() { progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca bancile..."; Banca.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca delegatii..."; Delegat.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca drepturile..."; Drept.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca facturile..."; FacturaIntrare.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca facturile..."; FacturaIesire.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca firmele..."; Firma.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca platile..."; Plata.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca platile..."; PlataFactura.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca platile..."; PozitieFacturaIesire.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca platile..."; PozitieFacturaIntrare.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca produsele..."; Produs.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca rolurile..."; Rol.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca platile..."; RolDrept.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca stocurile..."; Stoc.GetAll(); progressBar.Invoke(new UpdateDelegate(UpdateProgressBar)); runningOperationLbl.Text = "Se incarca utilizatorii..."; Utilizator.GetAll(); }
public override void Recompile() { foreach(Asiento a in delant) a.Recompile(); foreach(LimpParab a in lp) a.Recompile(); t.Recompile(); respuesto.Recompile(); Gl.glNewList(idVisualizar,Gl.GL_COMPILE); Gl.glPushMatrix(); Gl.glDisable(Gl.GL_CULL_FACE); Material pn=new PlasticoNegro(); Gl.glColor3d(pn.Ambient.r,pn.Ambient.g,pn.Ambient.b); pn.Set(); Gl.glBegin(Gl.GL_POLYGON); Gl.glNormal3d(0,-1,0); Gl.glVertex3d(start.x-1.7,start.y-1.9,start.z-2.5); Gl.glVertex3d(start.x+3.35,start.y-1.9,start.z-2.5); Gl.glVertex3d(start.x+3.35,start.y-1.9,start.z+2.5); Gl.glVertex3d(start.x-1.7,start.y-1.9,start.z+2.5); Gl.glEnd(); Gl.glBegin(Gl.GL_POLYGON); Gl.glVertex3d(start.x-1.7,start.y-1.9,start.z-2.4); Gl.glVertex3d(start.x-1.7,start.y-1.9,start.z+2.4); Gl.glVertex3d(start.x-3.7,start.y+0.1,start.z+2.4); Gl.glVertex3d(start.x-3.7,start.y+0.1,start.z-2.4); Gl.glEnd(); Gl.glBegin(Gl.GL_POLYGON); Gl.glNormal3d(0,1,0); Gl.glVertex3d(start.x+7,start.y-0.2,start.z-2.4); Gl.glVertex3d(start.x+7,start.y-0.9,start.z-2.4); Gl.glVertex3d(start.x+7,start.y-0.9,start.z+2.4); Gl.glVertex3d(start.x+7,start.y-0.2,start.z+2.4); Gl.glEnd(); Gl.glBindTexture(Gl.GL_TEXTURE_2D,Otros.texture[4]); Gl.glBegin(Gl.GL_POLYGON); Gl.glNormal3d(0,1,0); Gl.glTexCoord2d(0,0); Gl.glVertex3d(start.x+3,start.y-0.2,start.z-2.4); Gl.glTexCoord2d(1,0); Gl.glVertex3d(start.x+3,start.y-0.2,start.z+2.4); Gl.glTexCoord2d(1,1); Gl.glVertex3d(start.x+2,start.y-1.9,start.z+2.4); Gl.glTexCoord2d(0,1); Gl.glVertex3d(start.x+2,start.y-1.9,start.z-2.4); Gl.glEnd(); Gl.glBindTexture(Gl.GL_TEXTURE_2D,0); pn.UnSet(); pn=new Plata(); Gl.glColor3d(pn.Ambient.r,pn.Ambient.g,pn.Ambient.b); pn.Set(); Gl.glBegin(Gl.GL_POLYGON); Gl.glNormal3d(0,1,0); Gl.glVertex3d(start.x-6,start.y-1,start.z-2); Gl.glVertex3d(start.x-4,start.y-1,start.z-2); Gl.glVertex3d(start.x-4,start.y-1,start.z+2); Gl.glVertex3d(start.x-6,start.y-1,start.z+2); Gl.glEnd(); pn.UnSet(); Gl.glBindTexture(Gl.GL_TEXTURE_2D,Otros.texture[3]); Gl.glBegin(Gl.GL_POLYGON); Gl.glNormal3d(0,1,0); Gl.glTexCoord2d(1,0);Gl.glVertex3d(start.x+7,start.y-0.2,start.z-2.4); Gl.glTexCoord2d(1,1);Gl.glVertex3d(start.x+3,start.y-0.2,start.z-2.4); Gl.glTexCoord2d(0,1);Gl.glVertex3d(start.x+3,start.y-0.2,start.z+2.4); Gl.glTexCoord2d(0,0);Gl.glVertex3d(start.x+7,start.y-0.2,start.z+2.4); Gl.glEnd(); Gl.glBindTexture(Gl.GL_TEXTURE_2D,0); Gl.glColor3d(0.7,0.7,0.5); Gl.glBindTexture(Gl.GL_TEXTURE_2D,Otros.texture[0]); Gl.glBegin(Gl.GL_POLYGON); Gl.glNormal3d(0,-1,0); Gl.glTexCoord2d(0,0);Gl.glVertex3d(start.x+2.3,start.y+0.2,start.z-2.45); Gl.glTexCoord2d(1,0);Gl.glVertex3d(start.x+2.3,start.y+0.2,start.z+2.45); Gl.glTexCoord2d(1,1);Gl.glVertex3d(start.x+2,start.y-0.5,start.z+2.45); Gl.glTexCoord2d(0,1);Gl.glVertex3d(start.x+2,start.y-0.5,start.z-2.45); Gl.glEnd(); Gl.glBindTexture(Gl.GL_TEXTURE_2D,0); Gl.glColor3d(0,0,0); Gl.glBegin(Gl.GL_POLYGON); Gl.glNormal3d(0,1,0); Gl.glVertex3d(start.x+2.35,start.y+0.2,start.z-2.45); Gl.glVertex3d(start.x+2.35,start.y+0.2,start.z+2.45); Gl.glVertex3d(start.x+2.05,start.y-0.5,start.z+2.45); Gl.glVertex3d(start.x+2.05,start.y-0.5,start.z-2.45); Gl.glEnd(); Gl.glBegin(Gl.GL_POLYGON); Gl.glNormal3d(0,1,0); Gl.glVertex3d(start.x+2.35,start.y+0.4,start.z-1); Gl.glVertex3d(start.x+2.35,start.y+0.4,start.z+1); Gl.glVertex3d(start.x+2.25,start.y,start.z+1); Gl.glVertex3d(start.x+2.25,start.y,start.z-1); Gl.glEnd(); Gl.glBegin(Gl.GL_TRIANGLE_STRIP); Gl.glNormal3d(0,1,0); Gl.glVertex3d(start.x+2.35,start.y+0.4,start.z+1); Gl.glVertex3d(start.x+2.25,start.y,start.z+2.3); Gl.glVertex3d(start.x+2.25,start.y,start.z+1); Gl.glEnd(); Gl.glBegin(Gl.GL_TRIANGLE_STRIP); Gl.glNormal3d(0,1,0); Gl.glVertex3d(start.x+2.35,start.y+0.4,start.z-1); Gl.glVertex3d(start.x+2.25,start.y,start.z-2.3); Gl.glVertex3d(start.x+2.25,start.y,start.z-1); Gl.glEnd(); Gl.glEnable(Gl.GL_CULL_FACE); Gl.glPopMatrix(); Gl.glEndList(); }