示例#1
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                if (kod_jazyka == "") // INSERT
                {
                    this.FillEntity();
                    risContext.jazyk.Add(entityJazyk);
                    risContext.SaveChanges();
                    success = true;
                }
                else // UPDATE
                {
                    var temp = from a in risContext.jazyk where a.kod_jazyka == kod_jazyka select a;
                    entityJazyk = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
示例#2
0
        private void Reset()
        {
            kod_jazyka = "";
            nazov      = "";
            preklad    = new List <BPreklad>();

            entityJazyk = new jazyk();
        }
示例#3
0
        public BJazyk(jazyk j)
        {
            kod_jazyka = j.kod_jazyka;
            nazov      = j.nazov;

            preklad = new List <BPreklad>();


            entityJazyk = j;
        }
示例#4
0
        public bool Get(risTabulky risContext, string kod)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.jazyk where a.kod_jazyka == kod select a;
                entityJazyk = temp.Single();
                this.FillBObject();
                success = true;
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex);
            }

            return(success);
        }