public bool Save(risTabulky risContext) { bool success = false; try { if (typ_platnosti == 0) // INSERT { this.FillEntity(); risContext.platnost_zaznamu.Add(entityPlatnostZaznamu); risContext.SaveChanges(); typ_platnosti = entityPlatnostZaznamu.typ_platnosti; success = true; } else // UPDATE { var temp = from a in risContext.platnost_zaznamu where a.typ_platnosti == typ_platnosti select a; entityPlatnostZaznamu = 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() { typ_platnosti = 0; menu = new List <BMenu>(); entityPlatnostZaznamu = new platnost_zaznamu(); }
public BPlatnost_zaznamu(platnost_zaznamu pz) { typ_platnosti = pz.typ_platnosti; menu = new List <BMenu>(); foreach (var menu1 in pz.menu) { BMenu pom = new BMenu(menu1); menu.Add(pom); } entityPlatnostZaznamu = pz; }
public bool Get(risTabulky risContext, int typ) { bool success = false; try { var temp = from a in risContext.platnost_zaznamu where a.typ_platnosti == typ select a; entityPlatnostZaznamu = temp.Single(); this.FillBObject(); success = true; } catch (Exception ex) { throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex); } return(success); }