Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void Reset()
        {
            id    = 0;
            nazov = "";

            ucet = new List <BUcet>();

            entityUcet = new typ_uctu();
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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);
        }