Esempio n. 1
0
        public async Task AddScheduleJobDef(ScheduleJobDef def)
        {
            string cmdStr = @"INSERT INTO schedulejobdef(appuser_id, friend_id, facebookcredential_id, name, type, interval_type, time_from, time_to, timezone_id, active) 
            VALUES(@appuser_id, @friend_id, @facebookcredential_id, @name, @type, @interval_type, @time_from, @time_to, @timezone_id, @active)";

            await using MySqlCommand cmd = await db.CreateCommand(cmdStr);

            cmd.Parameters.Add(new MySqlParameter("appuser_id", def.AppUserId));
            cmd.Parameters.Add(new MySqlParameter("friend_id", def.FriendId));
            cmd.Parameters.Add(new MySqlParameter("facebookcredential_id", def.FacebookCredentialId));
            cmd.Parameters.Add(new MySqlParameter("name", def.Name));
            cmd.Parameters.Add(new MySqlParameter("type", def.Type.ToString()));
            cmd.Parameters.Add(new MySqlParameter("interval_type", def.IntervalType.ToString()));
            cmd.Parameters.Add(new MySqlParameter("time_from", def.TimeFrom));
            cmd.Parameters.Add(new MySqlParameter("time_to", def.TimeTo));
            cmd.Parameters.Add(new MySqlParameter("timezone_id", def.TimeZone));
            cmd.Parameters.Add(new MySqlParameter("active", def.Active ? 1 : 0));
            await cmd.ExecuteNonQueryAsync();

            await UpdateScheduleDefJobWeekDays(def);
        }
Esempio n. 2
0
        public async Task Create(AppUser user)
        {
            string cmdStr = "INSERT INTO appuser(email, title, firstname, lastname, active) VALUES(@email, @title, @firstname, @lastname, @active)";

            await using MySqlCommand cmd = await db.CreateCommand(cmdStr);

            cmd.Parameters.Add(new MySqlParameter("email", user.Email));
            cmd.Parameters.Add(new MySqlParameter("title", user.Title));
            cmd.Parameters.Add(new MySqlParameter("firstname", user.Firstname));
            cmd.Parameters.Add(new MySqlParameter("lastname", user.Lastname));
            cmd.Parameters.Add(new MySqlParameter("active", false));
            await cmd.ExecuteNonQueryAsync();
        }