public bool Save(risTabulky risContext) { bool success = false; try { if (id == 0) // INSERT { this.FillEntity(); risContext.typ_uctu.Add(entityUcet); risContext.SaveChanges(); id = entityUcet.id; success = true; } else // UPDATE { var temp = from a in risContext.typ_uctu where a.id == id 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 = 0; nazov = ""; ucet = new List <BUcet>(); entityUcet = new typ_uctu(); }
public BTyp_uctu(typ_uctu tu) { id = tu.id; nazov = tu.nazov; ucet = new List <BUcet>(); foreach (var ucet1 in tu.ucet) { BUcet pom = new BUcet(ucet1); ucet.Add(pom); } entityUcet = tu; }
public bool Get(risTabulky risContext, int idT) { bool success = false; try { var temp = from a in risContext.typ_uctu where a.id == idT 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); }