Exemplo n.º 1
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;
            }
        }