Beispiel #1
0
        private void loading()
        {
            ownerModel = new OwnerModel();
            dogModel   = new DogModel();
            dogs       = new List <Dog>();
            var dogsD   = dogModel.getList();
            int counter = 0;

            if (role == "Worker")
            {
                counter = 0;
                label_Adoption.Visible  = false;
                button_Adoption.Visible = false;
                label_Update.Visible    = true;
                button_Update.Visible   = true;
                label_Add.Visible       = true;
                button_Add.Visible      = true;
                foreach (var dog in dogsD.Values)
                {
                    if (dog.OwnerID == null || dog.OwnerID == "")
                    {
                        counter++;
                        dogs.Add(dog);
                    }
                }
            }
            else if (role == "Owner")
            {
                counter = 0;
                label_Adoption.Visible  = true;
                button_Adoption.Visible = true;
                label_Update.Visible    = false;
                button_Update.Visible   = false;
                label_Add.Visible       = false;
                button_Add.Visible      = false;
                foreach (var dog in dogsD.Values)
                {
                    if (dog.OwnerID == ownerID)
                    {
                        counter++;
                        dogs.Add(dog);
                    }
                }
            }
            if (counter > 0)
            {
                UpdateDataGridViewListDog();
                button_Delete.Enabled = true;
            }
            else
            {
                button_Delete.Enabled = false;
            }
        }
Beispiel #2
0
        private void loading()
        {
            dogModel     = new DogModel();
            meetingModel = new MeetingModel();
            ownerModel   = new OwnerModel();
            workerModel  = new WorkerModel();
            meetings.Clear();
            var meetingD = meetingModel.getList();
            int counter  = 0;

            if (role == "Worker")
            {
                bunifuImageButton_Add.Visible = bunifuImageButton_Update.Visible = !false;
                label_Add.Visible             = label_Update.Visible = !false;
                counter++;
                if (workerModel.get(personID).Role == "Emplyee")
                {
                    Meeting_Worker_Name.Visible = false;
                    Meeting_Owner_Name.Visible  = true;
                }
                else
                {
                    Meeting_Worker_Name.Visible = true;
                    Meeting_Owner_Name.Visible  = true;
                }
                foreach (var meeting in meetingD.Values)
                {
                    if (meeting.WorkerID == personID && meeting.Adopter == "Yet")
                    {
                        counter++;
                        meetings.Add(meeting);
                    }
                }
            }
            else if (role == "Owner")
            {
                Meeting_Adopter.Visible       = false;
                button_Save.Visible           = false;
                bunifuImageButton_Add.Visible = bunifuImageButton_Update.Visible = false;
                label_Add.Visible             = label_Update.Visible = false;
                counter = 0;
                Meeting_Worker_Name.Visible = true;
                Meeting_Owner_Name.Visible  = false;
                foreach (var meeting in meetingD.Values)
                {
                    if (meeting.OwnerID == personID && meeting.Adopter == "Yet")
                    {
                        counter++;
                        meetings.Add(meeting);
                    }
                }
            }
            if (counter > 0)
            {
                UpdateDataGridViewListMeeting();
                bunifuImageButton_Delete.Enabled = true;
            }
            else
            {
                dataGridView_ListMeeting.Rows.Clear();
                bunifuImageButton_Delete.Enabled = false;
            }
        }