public bool Save(risTabulky risContext) { bool success = false; try { if (id_uctu == 0) // INSERT { this.FillEntity(); risContext.ucet.Add(entityUcet); risContext.SaveChanges(); id_uctu = entityUcet.id_uctu; success = true; } else // UPDATE { var temp = from a in risContext.ucet where a.id_uctu == id_uctu select a; entityUcet = temp.Single(); this.FillEntity(); risContext.SaveChanges(); success = true; } } catch (Exception ex) { throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex); } return(success); }
private void Reset() { id_uctu = 0; id = 0; login = ""; heslo = ""; typ_uctu = new BTyp_uctu(); objednavka = new List <BObjednavka>(); entityUcet = new ucet(); }
public BUcet(ucet u) { id_uctu = u.id_uctu; id = u.id; login = u.login; heslo = u.heslo; typ_uctu = new BTyp_uctu(u.typ_uctu); objednavka = new List <BObjednavka>(); foreach (var objednavka1 in u.objednavka) { BObjednavka pom = new BObjednavka(objednavka1); objednavka.Add(pom); } entityUcet = u; }
public bool Get(risTabulky risContext, int idU) { bool success = false; try { var temp = from a in risContext.ucet where a.id_uctu == idU select a; entityUcet = temp.Single(); this.FillBObject(); success = true; } catch (Exception ex) { throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex); } return(success); }