Ejemplo n.º 1
0
        private void panelMember_MouseClick(object sender, MouseEventArgs e)
        {
            int row = e.Y / memberRowHeight;

            if (row >= 0 && row < trip.members.Count)
            {
                Rectangle rect = new Rectangle(0, row * memberRowHeight, panelMember.Width, memberRowHeight);
                rect = new Rectangle(rect.Right - deleteIconSize, rect.Top, deleteIconSize, deleteIconSize);
                if (new Region(rect).IsVisible(e.Location)) // delete button pressed
                {
                    if (trip.events.SelectMany(x => x.bottles).SelectMany(x => x.orders).Where(x => x.member == trip.members[row]).Any())
                    {
                        MessageBox.Show("This member has placed orders and can not be removed");
                    }
                    else
                    {
                        trip.members.RemoveAt(row);
                        RefreshGrid();
                    }
                }
                else
                {
                    MemberDetailForm memberDetailForm = new MemberDetailForm(trip, trip.members[row], RefreshGrid, hostForm);
                    memberDetailForm.ShowDialog(this);
                }
            }
        }
Ejemplo n.º 2
0
        private void buttonAddMember_Click(object sender, EventArgs e)
        {
            Member member = new Member();

            trip.members.Add(member);
            MemberDetailForm memberDetailForm = new MemberDetailForm(trip, member, RefreshGrid, hostForm);

            memberDetailForm.ShowDialog(this);
        }