Beispiel #1
0
 public void addOrEdit(int id, Museum m)
 {
     if (id >= 0)
     {
         list[id] = m;
     }
     else
     {
         list.Add(m);
     }
 }
Beispiel #2
0
 public void addOrEdit(int id, Museum m)
 {
     if(id >= 0)
     {
         list[id] = m;
     }
     else
     {
         list.Add(m);
     }
 }
Beispiel #3
0
        private void readFromFile(string filename)
        {
            list.Clear();
            Stream     stream    = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None);
            IFormatter formatter = new BinaryFormatter();

            Console.WriteLine(stream.Length);
            while (stream.Position != stream.Length)
            {
                Museum m = (Museum)formatter.Deserialize(stream);
                list.Add(m);
            }
            stream.Close();
        }
Beispiel #4
0
        public DataForm(MainForm parent, int elID, Museum m)
        {
            InitializeComponent();
            Parent = parent;
            IsEdit = elID >= 0 && m != null;
            ElementID = elID;
            CurMuseum = m;

            if(IsEdit)
            {
                actBtn.Text = "Save";
                nameField.Text = m.Name;
                addressField.Text = m.Address;
                ownerField.Text = m.Owner;
                visitsField.Text = Convert.ToString(m.Visits);
            } else
            {
                actBtn.Text = "Add";
            }
        }
Beispiel #5
0
        public DataForm(MainForm parent, int elID, Museum m)
        {
            InitializeComponent();
            Parent    = parent;
            IsEdit    = elID >= 0 && m != null;
            ElementID = elID;
            CurMuseum = m;

            if (IsEdit)
            {
                actBtn.Text       = "Save";
                nameField.Text    = m.Name;
                addressField.Text = m.Address;
                ownerField.Text   = m.Owner;
                visitsField.Text  = Convert.ToString(m.Visits);
            }
            else
            {
                actBtn.Text = "Add";
            }
        }