/// <summary> /// Creates a new assignment with a starting time of today's date /// and a null ending date /// </summary> /// <param name="output"></param> /// <param name="user"></param> /// <param name="ship"></param> /// <param name="role"></param> /// <returns></returns> public static bool Create(ref Assignment output, int user, int ship, int role) { int result = DBI.DoPreparedAction( @"INSERT INTO Assignment (user, ship, role, start) VALUES (@user, @ship, @role, strftime('%s', 'now'));" , new Tuple <string, object>("@user", user), new Tuple <string, object>("@ship", ship), new Tuple <string, object>("@role", role)); if (result == 1) { return(Assignment.FetchById(ref output, DBI.LastInsertRowId)); } return(false); }
/// <summary> /// Creates a new assignment with the given start and end dates /// </summary> /// <param name="output"></param> /// <param name="user"></param> /// <param name="ship"></param> /// <param name="role"></param> /// <param name="from"></param> /// <param name="until"></param> /// <returns></returns> public static bool Create(ref Assignment output, int user, int ship, int role, long from, long until) { int result = DBI.DoPreparedAction( @"INSERT INTO Assignment (user, ship, role, start, until) VALUES (@user, @ship, @role, @from, @until);" , new Tuple <string, object>("@user", user), new Tuple <string, object>("@ship", ship), new Tuple <string, object>("@role", role), new Tuple <string, object>("@from", from), new Tuple <string, object>("@until", until)); if (result == 1) { return(Assignment.FetchById(ref output, DBI.LastInsertRowId)); } return(false); }