예제 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            ObjectFactory factory    = ObjectFactory.getInstance();
            FileOperator  f_operator = factory.getFileOperator();

            ProjectVariables.setDBType(f_operator.readConfig());
            factory.loadDLL();
            Application.Run(new Form1());
        }
        private void setup()
        {
            ObjectFactory factory = ObjectFactory.getInstance();

            mainform = factory.getMainForm();
            catalog  = factory.getCatalog();
            query    = (QueryBase)factory.create("query");
            conn     = (ConnectionBase)factory.create("connection");
            conn.setConnString(ProjectVariables.getConnectionString());
            query.setConnection(conn);

            if (setting == add_arg)//adding operation
            {
                button1.Text = "Add";
            }
            else
            {                 //updating opertaion
                button1.Text = "Update";
                setTextBoxes();
            }
        }
예제 #3
0
        private void setup()
        {
            ObjectFactory factory = ObjectFactory.getInstance();

            factory.setMainForm(this);
            catalog = factory.getCatalog();
            query   = (QueryBase)factory.create("query");
            conn    = (ConnectionBase)factory.create("connection");
            conn.setConnString(ProjectVariables.getConnectionString());
            query.setConnection(conn);

            try
            {
                conn.Connect();
                string selectQ = "SELECT * FROM students";
                query.setSQL(selectQ);
                query.executeQuery();
                int i = 0;
                query.first();
                while (!query.eof())
                {
                    Student student = new Student();
                    student.Id        = query.getFiedValueINT("ID");
                    student.Name      = query.getFiedValueSTRING("NAME");
                    student.Surname   = query.getFiedValueSTRING("SURNAME");
                    student.BirthDate = query.getFiedValueSTRING("BIRTH_DATE");
                    catalog.add(student);
                    Console.WriteLine(i); i++;
                    query.next();
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Setup error:" + ex.ToString());
            }
            finally
            {
                conn.Disconnect();
            }
        }
예제 #4
0
        public void loadDLL()
        {
            Assembly dll = Assembly.LoadFile(ProjectVariables.getDllPath());

            list = (Dictionary <string, DBBaseClass>)dll.GetType("BaseDBLibrary.DllMain").GetMethod("getRegisterList").Invoke(null, null);
        }