Example #1
0
        public void DeleteObject(CustomerMemmorry p)
        {
            CustomerMemmorry t = new CustomerMemmorry();

            t = Node;
            if ((t.CustomersCurrentAccess.CustomersName) != (p.CustomersCurrentAccess.CustomersName))
            {
                if (t != null)
                {
                    while ((t.CustomersNextAccess.CustomersCurrentAccess.CustomersName) != (p.CustomersCurrentAccess.CustomersName))
                    {
                        if (t.CustomersNextAccess != null)
                        {
                            t = t.CustomersNextAccess;
                        }
                        else
                        if ((t.CustomersCurrentAccess.CustomersName) != (p.CustomersCurrentAccess.CustomersName))
                        {
                            t = null;
                            break;
                        }
                    }
                }
                if (t != null)
                {
                    if (t.CustomersNextAccess != null)
                    {
                        t.CustomersNextAccess = t.CustomersNextAccess.CustomersNextAccess;
                    }

                    else
                    {
                        t.CustomersNextAccess = null;
                    }
                }
            }
            else
            {
                t    = t.CustomersNextAccess;
                Node = t;
            }
        }
Example #2
0
 public void Load()
 {
     if (Node == null)
     {
         Node = new CustomerMemmorry();
     }
     Node.CustomersNextAccess    = null;
     Node.CustomersCurrentAccess = null;
     try
     {
         FileStream                     DummyFileStream = new FileStream(S, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
         BinaryFormatter                Formatters      = new BinaryFormatter();
         GalleryStudio.Customers        Dummy           = new Customers();
         GalleryStudio.CustomerMemmorry Last            = null;
         Console.WriteLine("Loading...");
         DummyFileStream.Seek(0, SeekOrigin.Begin);
         while (DummyFileStream.Position < DummyFileStream.Length)
         {
             Dummy = (Customers)Formatters.Deserialize(DummyFileStream);
             if (Node.Current == null)
             {
                 Node.Current = Dummy;
             }
             else
             {
                 Last = Node;
                 while (Last.Next != null)
                 {
                     Last = Last.Next;
                 }
                 CustomerMemmorry New = new CustomerMemmorry();
                 New.Current = Dummy;
                 Last.CustomersNextAccess = New;
             }
         }
         DummyFileStream.Flush();
         DummyFileStream.Close();
     }
     catch (IOException t) { Console.WriteLine(t.Message.ToString()); }
 }