コード例 #1
0
        private void ConnectToDatabase()
        {
            cs.LoadConnectionConfig();

            if (con != null && con.State == System.Data.ConnectionState.Open)
            {
                foreach (Form form in this.MdiChildren)
                {
                    form.Close();
                    form.Dispose();
                }

                con.Close();
            }

            if (!cs.IsEmpty())
            {
                con = new NpgsqlConnection(cs.GetConnectionString());

                try
                {
                    con.Open();
                    ownersService = new OwnersService(con);

                    SetCurrentOwner(ownersService.GetDefaultOwner());
                } catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }

            SetMenuChoices();
        }
コード例 #2
0
        public void A090_GetDefaultOwner()
        {
            Owner owner = ownersService.GetDefaultOwner();

            Assert.AreEqual(Owner2.PrimaryKey, owner.PrimaryKey);
        }