Beispiel #1
0
        private void CopyDb()
        {
            string fileName  = "bord_leden.db";
            string dstFolder = GenFunction.SelectFolder();
            string srcFolder = AppDomain.CurrentDomain.BaseDirectory;

#if DEBUG
            srcFolder += @"\" + fileName;
#else
            srcFolder += fileName;
#endif
            dstFolder += @"\" + fileName;

            System.IO.File.Copy(srcFolder, dstFolder, true);

            if (System.IO.File.Exists(dstFolder) == true)
            {
                MessageBox.Show("Database gekopieerd", "Vereniging - Leden",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Database niet gekopieerd", "Vereniging - Leden",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void btnDeleteMember_Click(object sender, EventArgs e)
        {
            ListView lst   = lstMember;
            int      index = GenFunction.GetLvIndex(lst);

            if (lst.SelectedItems.Count == 0)
            {
                return;
            }

            //#if DEBUG == false
            var result = MessageBox.Show("Verenigingslid verwijderen?\nDit kan niet ongedaan gemaakt worden!", "Vereniging - Leden",
                                         MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Question);

            if (result == DialogResult.No)
            {
                return;
            }
            //#endif


            ListViewItem item = lst.SelectedItems[0];

            LedenModel ledenModel = new LedenModel();

            ledenModel.Id   = Int32.Parse(item.Tag.ToString());
            ledenModel.Name = item.Text;

            SqliteDataAccess.DeleteMember(ledenModel);

            lst.Items[GenFunction.GetLvIndex(lst)].Remove();
            GenFunction.GetLvPervIndexAfterDelete(lst, index);
        }
Beispiel #3
0
        private void LstMember_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            ListView lst   = sender as ListView;
            int      index = GenFunction.GetLvIndex(lst);

            Console.WriteLine(index);
            if (lst.SelectedItems.Count == 0)
            {
                return;
            }

            if (e.Label == null)
            {
                return;
            }

            ListViewItem item = lst.SelectedItems[0];

            LedenModel ledenModel = new LedenModel
            {
                Id   = Int32.Parse(item.Tag.ToString()),
                Name = e.Label.ToString()
            };

            SqliteDataAccess.UpdateLeden(ledenModel);
            SetLedenList();
            GenFunction.SelectLvCurrentItem(lst, index);
        }
Beispiel #4
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     //  AllowTransparency = true;
     SetMbm();
     SetClubList();
     GenFunction.SetLvFirstRow(lstClub);
     this.Text += GenFunction.GetVersionNumber();
     lstClub.Columns[0].Width   = lstClub.Width - 2;
     lstMember.Columns[0].Width = lstMember.Width - 20;
 }
Beispiel #5
0
        private void CreateNewMember()
        {
            LedenModel lm = new LedenModel
            {
                IdClub = clubId,
                Name   = "Naam"
            };

            SqliteDataAccess.SaveLeden(lm);
            SetLedenList();
            GenFunction.SetLvEditAfterNew(lstMember);
        }
Beispiel #6
0
        private void CreateNewClub()
        {
            ClubModel clubModel = new ClubModel();

            clubModel.Naam = "Naam vereniging";

            SqliteDataAccess.SaveClub(clubModel);

            SetClubList();
            lstClub.Refresh();

            GenFunction.SetLvEditAfterNew(lstClub);
        }
Beispiel #7
0
        private void GenerateVerJson()
        {
            string  clubName;
            int     clubId;
            Boolean err;

            string path = GenFunction.SelectFolder();

            if (path == "" || path == null)
            {
                return;
            }

            path += @"\";
            try
            {
                for (int i = 0; i < lstClub.Items.Count; i++)
                {
                    ListViewItem item = lstClub.Items[i];
                    clubName = item.Text;
                    clubId   = Int32.Parse(item.Tag.ToString());;

                    err = GenJsonFile(clubId, clubName, path);
                    if (err)
                    {
                        Console.WriteLine("Err");
                        return;
                    }
                }
            }
            catch (IOException e)
            {
                MessageBox.Show(e.Message, "Vereniging - Leden",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }

            _ = MessageBox.Show("Bestanden gegenereerd", "Vereniging - Leden",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
        }
Beispiel #8
0
 private void BondsLeden_Load(object sender, EventArgs e)
 {
     this.Text += GenFunction.GetVersionNumber();
 }
Beispiel #9
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            ListView lst   = lstClub;
            int      index = GenFunction.GetLvIndex(lst);

            if (index == -1)
            {
                return;
            }

            ListView lstMem = lstMember;

            if (lstMember.Items.Count > 0)
            {
                MessageBox.Show("Kan vereniging niet verwijderen\nVerwijder eerste de leden", "Vereniging - Leden",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            var result = MessageBox.Show("Vereniging verwijderen?\nDit kan niet ongedaan gemaakt worden!", "Vereniging - Leden",
                                         MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Question);

            if (result == DialogResult.No)
            {
                return;
            }
            //  ListView lst = lstClub;
            //  int index = GenFunction.GetLvIndex(lst);
            if (lst.SelectedItems.Count == 0)
            {
                return;
            }


//#if DEBUG == false

//            var result = MessageBox.Show("Vereniging verwijderen?\nDit kan niet ongedaan gemaakt worden!", "Vereniging - Leden",
//                                   MessageBoxButtons.YesNo,
//                                    MessageBoxIcon.Question);
//            if(result == DialogResult.No)
//            {
//                return;
//            }
//#endif
            ListViewItem item      = lst.SelectedItems[0];
            ClubModel    clubModel = new ClubModel();

            clubModel.Id   = Int32.Parse(item.Tag.ToString());
            clubModel.Naam = item.Text;

            SqliteDataAccess.DeleteClub(clubModel);
            lst.Items[GenFunction.GetLvIndex(lst)].Remove();
            GenFunction.GetLvPervIndexAfterDelete(lst, index);
            // SetClubList();
            // GenFunction.SetLvLastItem(lstClub);
            // int lastItem = lstClub.Items.Count - 1;
            // lstClub.Items[lastItem].Selected = true;
            // lstClub.Select();
            // lstClub.EnsureVisible(lastItem);
        }