예제 #1
0
        private void accept_Click(object sender, EventArgs e)
        {
            if (filenamebox.Text != "" && id.Text != "")
            {
                string    times = "";
                SerialObj obj   = Serial.deserializeFile("C:\\sso\\dates\\" + filenamebox.Text);
                foreach (SignOutItems.SignOutObject item in obj.list)
                {
                    if (item.id == id.Text)
                    {
                        times += item.dateTime.ToString("hh:mm tt") + ", ";
                    }
                }

                if (times == "")
                {
                    MessageBox.Show("No records were found for that student.\n\nNOTE: If the student entered their name instead of scanning their ID, they may not show up in the search. If you allow students to enter their name, this result may be erroneous and you will need to view the Full Record.");
                }
                else
                {
                    MessageBox.Show("That student ID was scanned at the following time(s):\n\n" + times + "\n\nNOTE: If the student entered their name instead of scanning their ID, they may not show up in the search. If you allow students to enter their name, this result may be erroneous and you will need to view the Full Record.");
                }
            }
            else
            {
                MessageBox.Show("Please enter a value");
            }
        }
예제 #2
0
 public static void loadPreviousCheckouts()
 {
     if (File.Exists("C:\\sso\\dates\\" + DateTime.Now.ToString("MMMM dd, yyyy")))
     {
         SerialObj obj = Serial.deserializeFile("C:\\sso\\dates\\" + DateTime.Now.ToString("MMMM dd, yyyy"));
         Session.signOutObjectList = obj.list;
     }
 }
예제 #3
0
        public static SerialObj deserializeFile(string filename)
        {
            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None);
            SerialObj  obj       = (SerialObj)formatter.Deserialize(stream);

            stream.Close();
            return(obj);
        }
예제 #4
0
        public static void serializeFile()
        {
            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream("C:\\sso\\dates\\" + DateTime.Now.ToString("MMMM dd, yyyy"), FileMode.Create, FileAccess.Write, FileShare.None);
            SerialObj  obj       = new SerialObj();

            obj.list = Session.signOutObjectList;
            formatter.Serialize(stream, obj);
            stream.Close();
        }