Пример #1
0
 public MemberRow(Member m, Controller c, Form parent, bool canEdit)
 {
     InitializeComponent();
     this.member.Text = m.getName();
     this.instrument.Text = m.getInstrument();
     this.join.Text = m.getJoinDate();
     this._controller = c;
     this._model = m;
     this._parent = parent;
     if(canEdit)
         this.Cursor = System.Windows.Forms.Cursors.Hand;
 }
Пример #2
0
 public bool addMember(Member m)
 {
     try
     {
         members.Add(m);
     }
     catch
     {
         return false;
     }
     return true;
 }
Пример #3
0
        internal void saveMemeber(string name, string instrument, string joinDate, Form addMember, Form parent, bool isEdit)
        {
            //checks
            if (name.Length == 0)
            {
                showMessage(true, "Enter a name");
                return;
            }
            else if (instrument.Length == 0)
            {
                showMessage(true, "Enter an instrument");
                return;
            }
            else if (joinDate.Length == 0)
            {
                showMessage(true, "Enter a join date");
                return;
            }

            if (isEdit)
            {
                memberHighlight.setJoinDate(joinDate);
                memberHighlight.setName(name);
                memberHighlight.setInstrument(instrument);
                close(addMember);
                close(parent);
                editBand();
            }
            else
            {
                //Make new member
                Member m = new Member(name, instrument);
                m.setJoinDate(joinDate);
                //Add to parent view
                addMemeberToAddBandView(m, (AddBand)parent);
                //Close current view
                close(addMember);
            }
        }
Пример #4
0
        internal void saveBand(string name, Member[] members, AddBand view, bool isEdit)
        {
            if (name.Length == 0)
                {
                    showMessage(true, "Must enter a band name");
                    return;
                }
            else if (members.Length == 0)
                {
                    showMessage(true, "Must add at least one member");
                    return;
                }

            if (isEdit)
            {
                //get index and remove
                //int index = bands.IndexOf(bandHighlight);
                //bands.RemoveAt(index);

                //Change the band info
                bandHighlight.setName(name);

                //remove and re-add members
                bandHighlight.removeMembers();
                foreach (Member m in members)
                    bandHighlight.addMember(m);

                //remove all rows
                ((MainView)_current_view).removeAllRows();

                //Reintialize the window
                ((MainView)_current_view).initialize(bands.ToArray(), reviewers.ToArray());
                //Close the add band view
                close(view);

                //disable edit / delete buttons
                ((MainView)_current_view).disableDelete(MainView.BANDS_TAB);
                ((MainView)_current_view).disableEdit(MainView.BANDS_TAB);
            }
            else
            {
                //Create a temp band
                Band b = new Band(name, members.Length.ToString());
                //Add the member
                foreach (Member m in members)
                    b.addMember(m);
                //Add Band
                bands.Add(b);
                //Reintialize the window
                ((MainView)_current_view).initialize(bands.ToArray(), reviewers.ToArray());
                //Close the add band view
                close(view);
            }
            saveXML();
        }
Пример #5
0
        internal void highlightMember(MemberRow memberRow, Member m, Form parent)
        {
            if ( _views.Contains(parent) || _current_view.Equals(parent) )
            {
                //We don't want this to do anything on the mainview
            }
            else
            {
                //Set our highlighted one
                memberHighlight = m;

                // Make it green
                memberRow.setGreen();
                //Make the others not green
                foreach (MemberRow row in ((AddBand)parent).getRows())
                    if (!row.Equals(memberRow))
                        row.setNormal();

                //enable edit button
                ((AddBand)parent).enableEdit();
            }
        }
Пример #6
0
 internal void addMemeberToAddBandView(Member m, AddBand view)
 {
     MemberRow row = new MemberRow(m, this, view, true);
     addingMembers.Add(m);
     //Place row
     row.Top = view.getInsertHeight() + view.getNumberOfMembers() * row.Height;
     //Adjust height of window
     view.Height += row.Height;
     //Add row
     view.incrementMembers(row);
 }
Пример #7
0
        private Member memberParser(XmlNodeReader reader)
        {
            string name = reader.GetAttribute("name");
            string instrument = reader.GetAttribute("instrument");

            Member m = new Member(name, instrument);
            reader.Read();
            reader.Read();
            m.setJoinDate(reader.Value);

            return m;
        }