예제 #1
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            ObjectCompare objCompare = new ObjectCompare();

            objCompare.MdiParent   = this;
            objCompare.WindowState = FormWindowState.Maximized;
            objCompare.Show();
        }
예제 #2
0
 private void saveToolStripButton_Click(object sender, EventArgs e)
 {
     if (this.ActiveMdiChild != null)
     {
         ObjectCompare objCompare = (ObjectCompare)this.ActiveMdiChild;
         objCompare.Save();
         //MessageBox.Show(objCompare.Text);
     }
 }
예제 #3
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            /*
             * Login login = new Login();
             * login.MdiParent = this;
             * login.Show();*/
            ObjectCompare objCompare = new ObjectCompare();

            objCompare.MdiParent   = this;
            objCompare.WindowState = FormWindowState.Maximized;
            objCompare.Show();
        }
예제 #4
0
        private void LoadProject()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter           = "Text Files (*.xml)|*.xml|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;

                DataTable dt1 = new DataTable();
                dt1.Columns.Add("ResultSet");
                dt1.Columns.Add("Name");
                dt1.Columns.Add("Type");
                dt1.Columns.Add("Schema");
                dt1.Columns.Add("ObjectDefinition1");
                dt1.Columns.Add("ObjectDefinition2");

                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.Load(FileName);

                string db1 = "";
                string db2 = "";



                foreach (XmlNode xmlNode in xmlDocument.ChildNodes)
                {
                    string aa = xmlNode.Name + " " + xmlNode.Value;
                }

                string srv1   = "";
                string login1 = "";
                string pwd1   = "";

                foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("Server1"))
                {
                    foreach (XmlNode xmlServerNode in xmlNode.ChildNodes)
                    {
                        switch (xmlServerNode.Name)
                        {
                        case "Server":
                            srv1 = xmlServerNode.InnerText;
                            break;

                        case "Database":
                            db1 = xmlServerNode.InnerText;
                            break;

                        case "Login":
                            login1 = xmlServerNode.InnerText;
                            break;

                        case "Password":
                            pwd1 = xmlServerNode.InnerText;
                            break;
                        }
                    }
                }

                ServerConnection conn = new ServerConnection();
                conn.ServerInstance = srv1;
                if (login1 != "")
                {
                    conn.LoginSecure = false;
                    conn.Login       = login1;
                    conn.Password    = pwd1;
                }
                Server server1 = new Server(conn);

                string srv2   = "";
                string login2 = "";
                string pwd2   = "";

                foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("Server2"))
                {
                    foreach (XmlNode xmlServerNode in xmlNode.ChildNodes)
                    {
                        switch (xmlServerNode.Name)
                        {
                        case "Server":
                            srv2 = xmlServerNode.InnerText;
                            break;

                        case "Database":
                            db2 = xmlServerNode.InnerText;
                            break;

                        case "Login":
                            login2 = xmlServerNode.InnerText;
                            break;

                        case "Password":
                            pwd2 = xmlServerNode.InnerText;
                            break;
                        }
                    }
                }

                conn = new ServerConnection();
                conn.ServerInstance = srv2;
                if (login1 != "")
                {
                    conn.LoginSecure = false;
                    conn.Login       = login2;
                    conn.Password    = pwd2;
                }
                Server server2 = new Server(conn);

                foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("Object"))
                {
                    DataRow dr = dt1.NewRow();
                    dr["ResultSet"]         = xmlNode.Attributes["ResultSet"].Value;
                    dr["Name"]              = xmlNode.Attributes["Name"].Value;
                    dr["Type"]              = xmlNode.Attributes["Type"].Value;
                    dr["Schema"]            = xmlNode.Attributes["Schema"].Value;
                    dr["ObjectDefinition1"] = xmlNode.Attributes["ObjectDefinition1"].Value;
                    dr["ObjectDefinition2"] = xmlNode.Attributes["ObjectDefinition2"].Value;
                    dt1.Rows.Add(dr);
                }

                ObjectCompare objCompare = new ObjectCompare(false);
                objCompare.SetDatabase1(db1);
                objCompare.SetDatabase2(db2);

                objCompare.SetServer1(server1);
                objCompare.SetServer2(server2);

                objCompare.LoadObjects(dt1);
                objCompare.MdiParent = this;
                objCompare.Show();
            }
        }