Exemplo n.º 1
0
        private void TsView_Click(object sender, EventArgs e)
        {
            if (dgvMain.Rows.Count == 0)
            {
                MessageBox.Show(@"There are no records to view.", @"Info", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (_currentModule == ModGlobal.ModUserManagement)
            {
                var user = new FrmUser(Convert.ToInt64(dgvMain.SelectedRows[0].Cells[0].Value), ModGlobal.FormStatus.IsView);
                user.ShowDialog();
            }
            else if (_currentModule == ModGlobal.ModUserPrivileges)
            {
                var user = new FrmUserPrivileges(Convert.ToInt32(dgvMain.SelectedRows[0].Cells[0].Value), ModGlobal.FormStatus.IsView);
                user.ShowDialog();
            }
            else if (_currentModule == ModGlobal.ModAreaProfile)
            {
                var area = new FrmAreaProfile(Convert.ToInt64(dgvMain.SelectedRows[0].Cells[0].Value), ModGlobal.FormStatus.IsView);
                area.ShowDialog();
            }
            else if (_currentModule == ModGlobal.ModLots)
            {
                var lot = new FrmLots(Convert.ToInt64(dgvMain.SelectedRows[0].Cells[0].Value), ModGlobal.FormStatus.IsView);
                lot.ShowDialog();
            }
            else if (_currentModule == ModGlobal.ModAgents)
            {
                var agent = new FrmAgents(Convert.ToInt64(dgvMain.SelectedRows[0].Cells[0].Value), ModGlobal.FormStatus.IsView);
                agent.ShowDialog();
            }
            else if (_currentModule == ModGlobal.ModClients)
            {
                var client = new FrmClients(Convert.ToInt64(dgvMain.SelectedRows[0].Cells[0].Value), ModGlobal.FormStatus.IsView);
                client.ShowDialog();
            }
            else if (_currentModule == ModGlobal.ModAcquisition)
            {
                var acquisition = new FrmAcquisition(Convert.ToInt64(dgvMain.SelectedRows[0].Cells[0].Value), ModGlobal.FormStatus.IsView);
                acquisition.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void TsAdd_Click(object sender, EventArgs e)
        {
            if (_currentModule == ModGlobal.ModUserManagement)
            {
                var user = new FrmUser(0, ModGlobal.FormStatus.IsNew);
                user.ShowDialog();

                if (user.IsSaved)
                {
                    LoadData();
                }
            }
            else if (_currentModule == ModGlobal.ModUserPrivileges)
            {
                var user = new FrmUserPrivileges(0, ModGlobal.FormStatus.IsNew);
                user.ShowDialog();

                if (user.IsSaved)
                {
                    LoadData();
                }
            }
            else if (_currentModule == ModGlobal.ModAreaProfile)
            {
                var area = new FrmAreaProfile(0, ModGlobal.FormStatus.IsNew);
                area.ShowDialog();

                if (area.IsSaved)
                {
                    LoadData();
                }
            }
            else if (_currentModule == ModGlobal.ModLots)
            {
                const int isOpen = 1;

                var area = _db.AreaProfiles.FirstOrDefault(a => a.Status == isOpen);

                if (area == null)
                {
                    MessageBox.Show(@"There are no active Area Profile for Lot to assign to. Please contact the administrator for more info.", @"Info", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                var lot = new FrmLots(0, ModGlobal.FormStatus.IsNew);
                lot.ShowDialog();

                if (lot.IsSaved)
                {
                    LoadData();
                }
            }
            else if (_currentModule == ModGlobal.ModAgents)
            {
                var agent = new FrmAgents(0, ModGlobal.FormStatus.IsNew);
                agent.ShowDialog();

                if (agent.IsSaved)
                {
                    LoadData();
                }
            }
            else if (_currentModule == ModGlobal.ModClients)
            {
                var client = new FrmClients(0, ModGlobal.FormStatus.IsNew);
                client.ShowDialog();

                if (client.IsSaved)
                {
                    LoadData();
                }
            }
            else if (_currentModule == ModGlobal.ModAcquisition)
            {
                var acquisition = new FrmAcquisition(0, ModGlobal.FormStatus.IsNew);
                acquisition.ShowDialog();

                if (acquisition.IsSaved)
                {
                    LoadData();
                }
            }
        }