Esempio n. 1
0
        private void OK_Click(object sender, EventArgs e)
        {
            SqlTransactionContext context = new SqlTransactionContext();

            context.Connection = CreateSQLConnection();
            bool isNewIstallation = radioButton1.Checked;

            if (isNewIstallation)
            {
                //TODO:remove
                //connection.ConnectionString = "Data Source=TORAX;Initial Catalog=ASH;User ID=sa;Password=1";


                ProgressForm progressForm = new ProgressForm();
                progressForm.Show();
                SaveConnectionInfo();
                try
                {
                    KernelPlugInstaller kernelInstaller = new KernelPlugInstaller();
                    kernelInstaller.InitialDir = @"c:\temp";
                    kernelInstaller.RegisterPlug(context);


                    AbstractUIPlugInstaller abstractUIInstaller = new AbstractUIPlugInstaller();
                    abstractUIInstaller.RegisterPlug(context);

                    AbstractUIContextInstaller abstrContextInstaller = new AbstractUIContextInstaller();
                    abstrContextInstaller.RegisterPlug(context);

                    AbstractUIPanelInstaller abstrPanelInstaller = new AbstractUIPanelInstaller();
                    abstrPanelInstaller.RegisterPlug(context);

                    AbstractUITreeViewInstaller abstrTreeViewInstaller = new AbstractUITreeViewInstaller();
                    abstrTreeViewInstaller.RegisterPlug(context);

                    //Add ProgressForm here to see
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                progressForm.TopMost = true;
                progressForm.Hide();
                progressForm.ShowDialog();
            }
            //context.Connection = connection;
            try
            {
                PlugListForm plugListForm = new PlugListForm();
                plugListForm.ShowPlugins(context);

                this.Hide();
                plugListForm.ShowDialog();
                this.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            SqlTransactionContext context = new SqlTransactionContext();

            //context.Connection = new SqlConnection("server=stranger;database=ASH_Trainings_RemoteAdmin;uid=sa;pwd=1");
            context.Connection = new SqlConnection("server=localhost;database=ASH_Trainings_RemoteAdmin;uid=sa;pwd=1");
            PlugInController controller = new PlugInController(context);

            controller.Delete(this.propertyGrid1.SelectedObject as PlugIn);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            SqlTransactionContext context = new SqlTransactionContext();

            //context.Connection = new SqlConnection("server=stranger;database=ASH_Trainings_RemoteAdmin;uid=sa;pwd=1");
            context.Connection = new SqlConnection("server=localhost;database=ASH_Trainings_RemoteAdmin;uid=sa;pwd=1");
            PlugInController manager = new PlugInController(context);

            try
            {
                System.Console.WriteLine("Possible commands:\n\tadd\n\tdelete\n\tupdate\n\tloadall\n\tloadbyid\n\tloadbyname\n\tquit\n");
                bool done = false;
                while (!done)
                {
                    System.Console.Write("#");
                    string cmd  = System.Console.ReadLine();
                    PlugIn plug = new PlugIn();
                    switch (cmd)
                    {
                    case "add":
                        System.Console.WriteLine("Input <PlugName> <PlugFriendlyName> <PlugDescription> <PlugVersion> <Active(0|1)>");
                        string tmp = System.Console.ReadLine();
                        plug = ParsePlug(tmp);
                        manager.Insert(plug);
                        break;

                    case "quit":
                        done = true;
                        break;

                    case "delete":
                        System.Console.Write("Input PlugId: ");
                        plug.PlugId = int.Parse(System.Console.ReadLine());
                        //manager.Delete(plug);
                        break;

                    case "update":
                        System.Console.WriteLine("Not implemented yet");
                        break;

                    case "loadall":
                        List <PlugIn> lst = manager.LoadAll();
                        foreach (PlugIn pl in lst)
                        {
                            PrintPlug(pl);
                            System.Console.WriteLine();
                        }
                        break;

                    case "loadbyid":
                        System.Console.Write("Input PlugId: ");
                        //plug = manager.LoadByPrimaryKey(int.Parse(System.Console.ReadLine()));
                        PrintPlug(plug);
                        break;

                    case "loadbyname":
                        System.Console.Write("Input PlugName: ");
                        //plug = manager.LoadByName(System.Console.ReadLine());
                        PrintPlug(plug);
                        break;

                    default:
                        System.Console.WriteLine("Possible commands:\n\tadd\tdelete\tupdate\tloadall\tloadbyid\tloadbyname\n");
                        break;
                    }
                    System.Console.WriteLine("<OK>");
                }
            }
            finally
            {
                //this is very very important
                context.Connection.Close();
            }
        }