internal void PushVareUp(Vare v) { dataProvider.PushVareUp(v); }
internal void UpdateVare(Vare v) { dataProvider.UpdateVare(v); }
private Color GetButtonColor(Vare vare) { if (vare.Farge != null) { return Color.FromArgb(Convert.ToInt32(vare.Farge)); } else { return System.Drawing.Color.Yellow; } }
internal void PushVareDown(Vare v) { dataProvider.PushVareDown(v); }
public void UpdateVare(Vare v) { db.Varer.Attach(v); db.Entry(v).State = EntityState.Modified; db.SaveChanges(); }
private void button1_Click(object sender, EventArgs e) { try { if (navn.Text.Length < 2) { label1.ForeColor = System.Drawing.Color.Red; return; } else { label1.ForeColor = System.Drawing.Color.Black; } if (pris.Text.Length == 0) { label2.ForeColor = System.Drawing.Color.Red; return; } else { label2.ForeColor = System.Drawing.Color.Black; } Vare vare = new Vare() { Navn = navn.Text, Pris = int.Parse(pris.Text) }; mc.SaveVare(vare); try { mc.UpdateMainButtons(); } catch (Exception ew) { } settingsWindow.ReactivateSettingsWindow(); settingsWindow.InitializeList(); Dispose(); } catch (Exception ee) { label2.ForeColor = System.Drawing.Color.Red; } }
public void Save(Vare vare) { int rank = 0; if (db.Varer.Any()) { rank = db.Varer.Max(x => x.Rank); } if (rank == 0) { rank = 1; } else { rank++; } vare.Rank = rank; db.Varer.Add(vare); db.SaveChanges(); }
public void PushVareUp(Vare v) { if (v.Rank != 1) { var temp = v.Rank--; var vare = db.Varer.FirstOrDefault(x => x.Rank == v.Rank); vare.Rank++; db.Entry(vare).State = EntityState.Modified; db.Entry(v).State = EntityState.Modified; db.SaveChanges(); } }
public void PushVareDown(Vare v) { var max = db.Varer.Max(x => x.Rank); if (v.Rank != max) { var temp = v.Rank++; var vare = db.Varer.FirstOrDefault(x => x.Rank == v.Rank); vare.Rank--; db.Entry(vare).State = EntityState.Modified; db.Entry(v).State = EntityState.Modified; db.SaveChanges(); } }
//FERIDG public void LagreSalg(Vare v) { var s = new Salg() { Pris = v.Pris, SlagsTid = DateTime.Now, VareId = v.Id }; db.Salg.Add(s); db.SaveChanges(); }
internal void SaveVare(DomainObjectsSalg.Sales.Vare vare) { dataProvider.Save(vare); }