예제 #1
0
        /// <summary>
        /// This method creates an automat.
        /// </summary>
        /// <param name="kunde_id"></param>
        /// <param name="serienummer"></param>
        /// <param name="spilnavn"></param>
        /// <returns>string</returns>
        public string Create(int kunde_id, string serienummer, string spilnavn)
        {
            Table_Automat automat;
            string        result;

            try
            {
                automat = new Table_Automat
                {
                    kunde_id    = kunde_id,
                    serienummer = serienummer,
                    spilnavn    = spilnavn
                };
                db.SubmitChanges();

                result = "Success";
            }

            catch (Exception exception)
            {
                result = exception.Message;
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// This method lists all automats.
        /// </summary>
        /// <returns>List<Table_Automat></returns>
        public List <Table_Automat> ListAll()
        {
            List <Table_Automat> automater;

            try
            {
                automater = (from a in db.Table_Automats select a).ToList();
            }

            catch (Exception exception)
            {
                Table_Automat automat = new Table_Automat
                {
                    automat_id  = -1000,
                    kunde_id    = -1000,
                    serienummer = "ERROR",
                    spilnavn    = exception.Message
                };

                automater = new List <Table_Automat>
                {
                    automat
                };
            }

            return(automater);
        }
예제 #3
0
        /// <summary>
        /// This method finds a list of automates by their kunde_id.
        /// </summary>
        /// <param name="kunde_id"></param>
        /// <returns>List<Table_Automat></returns>
        public List <Table_Automat> FindByKundeId(int kunde_id)
        {
            List <Table_Automat> automater;

            try
            {
                automater = (from a in db.Table_Automats where a.kunde_id.Equals(kunde_id) select a).ToList();
            }

            catch (Exception exception)
            {
                Table_Automat automat = new Table_Automat
                {
                    automat_id  = -1000,
                    kunde_id    = -1000,
                    serienummer = "ERROR",
                    spilnavn    = exception.Message
                };

                automater = new List <Table_Automat>
                {
                    automat
                };
            }

            return(automater);
        }
예제 #4
0
        /// <summary>
        /// This method finds a list of automates by their spilnavn.
        /// </summary>
        /// <param name="spilnavn"></param>
        /// <returns>List<Table_Automat></returns>
        public List <Table_Automat> FindBySpilnavn(string spilnavn)
        {
            List <Table_Automat> automater;

            try
            {
                automater = (from a in db.Table_Automats where a.spilnavn.Contains(spilnavn) select a).ToList();
            }

            catch (Exception exception)
            {
                Table_Automat automat = new Table_Automat
                {
                    automat_id  = -1000,
                    kunde_id    = -1000,
                    serienummer = "ERROR",
                    spilnavn    = exception.Message
                };

                automater = new List <Table_Automat>
                {
                    automat
                };
            }

            return(automater);
        }
예제 #5
0
        /// <summary>
        /// This method finds an automat by their automat_id.
        /// </summary>
        /// <param name="automat_id"></param>
        /// <returns>Table_Automat</returns>
        public Table_Automat FindByAutomatId(int automat_id)
        {
            Table_Automat automat;

            try
            {
                automat = db.Table_Automats.First(a => a.automat_id.Equals(automat_id));
            }

            catch (Exception exception)
            {
                automat = new Table_Automat
                {
                    automat_id  = -1000,
                    kunde_id    = -1000,
                    serienummer = "ERROR",
                    spilnavn    = exception.Message
                };
            }

            return(automat);
        }
예제 #6
0
 private void detach_Table_Automats(Table_Automat entity)
 {
     this.SendPropertyChanging();
     entity.Table_Kunde = null;
 }
예제 #7
0
 partial void DeleteTable_Automat(Table_Automat instance);
예제 #8
0
 partial void UpdateTable_Automat(Table_Automat instance);
예제 #9
0
 partial void InsertTable_Automat(Table_Automat instance);