Example #1
0
        /// <summary>
        /// Create new <see cref="TimeEvent"/> and calculate hash by inserted Datas and other value.
        /// </summary>
        /// <param name="hash">Hash of <see cref="TimeEvent"/></param>
        /// <param name="name">Name of <see cref="TimeEvent"/></param>
        /// <param name="description">Description of <see cref="TimeEvent"/></param>
        /// <param name="startDate">StartDate of <see cref="TimeEvent"/></param>
        /// <param name="endDate">EndDate of <see cref="TimeEvent"/></param>
        /// <param name="notification">Notification of <see cref="TimeEvent"/></param>
        /// <param name="notificationDate">NotificationDate of <see cref="TimeEvent"/></param>
        /// <returns><see cref="TimeEvent"/> with given parameters.</returns>
        public static TimeEvent CreateTimeEvent(string name, string description, DateTime startDate, DateTime endDate, bool notification, DateTime notificationDate)
        {
            Random rand = new Random();
            string hash = SupportMethods.GetMd5Hash(DateTime.Now + rand.NextDouble().ToString() + name + description + startDate + endDate + notification + notificationDate);

            return(new TimeEvent(hash, name, description, startDate, endDate, notification, notificationDate));
        }
Example #2
0
        /// <summary>
        /// Calculate new hash and return new <see cref="TimeEvent"/> with same data but newly generated hash.
        /// </summary>
        /// <param name="te">Already existing TimeEvent with good datas, but wrong hash.</param>
        /// <returns></returns>
        public static TimeEvent CreateTimeEventWithDuplicitHash(TimeEvent te)
        {
            Random rand = new Random();
            string hash = SupportMethods.GetMd5Hash(DateTime.Now + rand.NextDouble().ToString() + te.Name + te.Description + te.StartDate + te.EndDate + te.Notification + te.NotificationDate);

            return(new TimeEvent(hash, te.Name, te.Description, te.StartDate, te.EndDate, te.Notification, te.NotificationDate));
        }
Example #3
0
        /// <summary>
        /// Create database with local databaseName.
        /// </summary>
        void createNewDatabase()
        {
#if Mono
            SqliteConnection.CreateFile(databaseName + ".sqlite");
#else
            SQLiteConnection.CreateFile(databaseName + ".sqlite");
#endif
            connectToDatabase();
            createTimeEventTable();
            createChangeTable();
            createSynchronizationDeviceTable();
            createApplicationInfoTable();
            InsertApplicationInfo(
                new ApplicationInfo("",
                                    SupportMethods.GetMd5Hash(DateTime.Now.Ticks.ToString()).Substring(24),
                                    "",
                                    false,
                                    true));
        }