using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace hukpiWinApp.Forms.Admin
{
    public partial class UserGroupListForm : BaseForm
    {
        public UserGroupListForm()
        {
            InitializeComponent();
        }

        private void UserGroupListForm_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'hukpiDatabaseDataSet.Groups' table. You can move, or remove it, as needed.
            this.groupsTableAdapter.FillByActives(this.hukpiDatabaseDataSet.Groups);

        }

        public override void refreshData()
        {
            radioButton_CheckedChanged(null, null);
        }

        private void radioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButtonJustActive.Checked)
            {
                this.groupsTableAdapter.FillByActives(this.hukpiDatabaseDataSet.Groups);
            }
            else
            {
                this.groupsTableAdapter.Fill(this.hukpiDatabaseDataSet.Groups);
            }
        }

        private void dataGridViewSearchResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Forms.Admin.AddEditUserGroupForm editGroupForm = new Forms.Admin.AddEditUserGroupForm(Convert.ToDecimal(dataGridViewSearchResult.SelectedRows[0].Cells[0].Value));
            ((MainForm)this.MdiParent).openNewMDIChildForm(editGroupForm);
        }
    }
}
