Esempio n. 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            CommonConnection connection = ConnectionFactory.createConnection("mysql", "remotemysql.com", "WEJMD9dLmJ", "WEJMD9dLmJ", "CqlKK8zDL3", 3306);

            MyContainer.RegisterInstance <CommonConnection>(connection);
            Login login = new Login
            {
                SuccessAction = roles =>
                {
                    Role role = new Role
                    {
                        isAllowedAdd    = roles.Contains("C"),
                        isAllowedRead   = roles.Contains("R"),
                        isAllowedUpdate = roles.Contains("U"),
                        isAllowedDelete = roles.Contains("D")
                    };
                    MyContainer.RegisterInstance <Role>(role);
                    new MainForm().Show();
                }
            };

            Application.Run(login);
        }
Esempio n. 2
0
        private void ReadBtn_Click(object sender, EventArgs e)
        {
            Table t = this.database.GetTableByName(this.tableList.SelectedItem.ToString());

            MyContainer.RegisterInstance <Table>(t);
            BaseForm r = (BaseForm)MyContainer.Create <IReadForm>();

            this.Hide();
            r.FormClosed += (s, args) => this.Show();
            r.Show();
        }
Esempio n. 3
0
        private void DataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= table.Rows.Count)
            {
                return;
            }
            MyContainer.RegisterInstance <int>(e.RowIndex);
            BaseForm r = (BaseForm)MyContainer.Create <IUpdateForm>();

            r.done = this.Done;
            r.ShowDialog();
        }
Esempio n. 4
0
        private void UpdateBtn_Click(object sender, System.EventArgs e)
        {
            if (currentRow < 0)
            {
                return;
            }
            MyContainer.RegisterInstance <int>(currentRow);
            BaseForm r = (BaseForm)MyContainer.Create <IUpdateForm>();

            r.done = this.Done;
            r.ShowDialog();
        }
Esempio n. 5
0
 public static void RegisterRole(Role role)
 {
     MyContainer.RegisterInstance <Role>(role);
 }
Esempio n. 6
0
 public static void RegisterConnection(CommonConnection conn)
 {
     MyContainer.RegisterInstance <CommonConnection>(conn);
 }