예제 #1
0
        public SerialData(bool load)
        {
            if (!load)
            {
                return;
            }

            FestiSpecContext data = new FestiSpecContext(false);

            Attachments = data.Attachments.ToList();

            foreach (Attachment attachment in Attachments)
            {
                attachment.FilePath = " ";
            }

            ContactPeople        = data.ContactPeople.ToList();
            CustomerCompanies    = data.CustomerCompanies.ToList();
            Employees            = data.Employees.ToList();
            EmployeeAccounts     = data.EmployeeAccounts.ToList();
            Festivals            = data.Festivals.ToList();
            Inspections          = data.Inspections.ToList();
            PermissionNodes      = data.PermissionNodes.ToList();
            Questions            = data.Questions.ToList();
            Answers              = data.Answers.ToList();
            QuestionTypes        = data.QuestionTypes.ToList();
            Roles                = data.Roles.ToList();
            QuestionLists        = data.QuestionLists.ToList();
            EmployeeAbsenceDates = data.EmployeeAbsenceDates.ToList();
        }
예제 #2
0
        public FestiSpecContext Deserialize()
        {
            IFormatter       formatter  = new BinaryFormatter();
            Stream           stream     = new FileStream("sync.dat", FileMode.Open, FileAccess.Read);
            FestiSpecContext newcontext = (FestiSpecContext)formatter.Deserialize(stream);

            return(newcontext);
        }
예제 #3
0
        public static void Serialize(FestiSpecContext context)
        {
            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream("sync.dat", FileMode.Create, FileAccess.Write);

            formatter.Serialize(stream, context);
            stream.Close();
        }