Exemplo n.º 1
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();
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
 public ReadForm(Table table) : base(table)
 {
     InitializeComponent();
     role = MyContainer.Create <Role>();
     dataGridView.DataSource = table.dataTable;
     this.table.RegisterObserver(this.dataGridView);
     addBtn.Enabled     = role.isAllowedAdd;
     dataGridView.Size  = new Size(this.Width - 70, this.Height - 200);
     addBtn.Location    = new Point(40, dataGridView.Location.Y + dataGridView.Size.Height + 20);
     updateBtn.Location = new Point(addBtn.Location.X + addBtn.Size.Width + 10, dataGridView.Location.Y + dataGridView.Size.Height + 20);
     deleteBtn.Location = new Point(updateBtn.Location.X + updateBtn.Size.Width + 10, dataGridView.Location.Y + dataGridView.Size.Height + 20);
     if (table.Rows.Count > 0)
     {
         SetFocusRow(0);
     }
 }
Exemplo n.º 4
0
        public MainForm()
        {
            InitializeComponent();
            this.database = MyContainer.Create <Database>();
            this.database.Connection.Connect();
            this.database.LoadData();
            List <string> list = this.database.GetTableNames();

            this.tableList.Items.Clear();
            for (int i = 0; i < list.Count; i++)
            {
                this.tableList.Items.Add(list[i]);
            }
            tableList.SelectedIndex = 0;
            Role role = MyContainer.Create <Role>();

            button2.Enabled = role.isAllowedRead;
        }
Exemplo n.º 5
0
 public static void RegisterRole(Role role)
 {
     MyContainer.RegisterInstance <Role>(role);
 }
Exemplo n.º 6
0
 public static void RegisterConnection(CommonConnection conn)
 {
     MyContainer.RegisterInstance <CommonConnection>(conn);
 }
Exemplo n.º 7
0
 public static void RegisterForm <TInterface, TImplementation>() where TImplementation : BaseForm, TInterface
 {
     MyContainer.RegisterType <TInterface, TImplementation>();
 }