Ejemplo n.º 1
0
        private void InsertDefault()
        {
            try
            {
                using (_db)
                {
                    FrontOffice fo = new FrontOffice();
                    fo.Options = "";

                    _db.FrontOffice.InsertOnSubmit(fo);

                    Commit();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("error: inserting new option - " + ex.Message + " ...");
            }
        }
Ejemplo n.º 2
0
        protected override void SelectObjectsFromDb()
        {
            // this method is a little awkward because of loop problem wen after the insert there is an error or someting.
            try
            {
                bool chickenMove = true;

            Chicken:
                _cfg = (from f in _db.FrontOffice select f).FirstOrDefault();

                if (_cfg == null && _db.DatabaseExists() && chickenMove)
                {
                    InsertDefault();
                    chickenMove = false;
                    goto Chicken;

                    //SelectObjectsFromDb(); // risky move, can cause loop needs more tests, dont want to take the risk
                }
            }
            catch (Exception ex)
            {
                throw new Exception("error: select object from db - " + ex.Message + " ...");
            }
        }