private static object CreateExtraDataConnections(SQLite_Connector conn, object input) { try { Object[] data = input as Object[]; int alimId = (int)data[0]; ExtraData extra = (ExtraData)data[1]; Boolean flag = extra.Create(conn, null); if (flag) { extra.Id = (int)conn.SelectValue <long>("extras".SelectLastId(extra.PrimaryKey)); DestinationRow row = new DestinationRow() { AlimId = alimId, ConnId = extra.Id, TypeId = 2, }; return(row.Create(conn, null)); } return(false); } catch (Exception exc) { return(exc); } }
/// <summary> /// Creates the motors connections. /// </summary> /// <param name="conn">The connection.</param> /// <param name="input">The input.</param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> private static object CreateMotorsConnections(SQLite_Connector conn, object input) { try { Object[] data = input as Object[]; int alimId = (int)data[0]; IEnumerable <BigMotor> motors = (IEnumerable <BigMotor>)data[1]; Boolean flag; DestinationRow row; motors.ToList().ForEach(x => { flag = x.Create(conn, null); if (flag) { x.Id = (int)conn.SelectValue <long>("motores".SelectLastId(x.PrimaryKey)); row = new DestinationRow() { AlimId = alimId, ConnId = x.Id, TypeId = 0, }; row.Create(conn, null); } }); return(motors.Count(x => x.Id > 0) > 0); } catch (Exception exc) { return(exc); } }
/// <summary> /// Crea la inserción del alimentador /// </summary> /// <param name="conn">La conexión a SQLite.</param> /// <param name="input">La entrada para realizar la inserción.</param> /// <returns>Una bandera que indica si se realizó la conexión</returns> private static object CreateAlimentadorConnection(SQLite_Connector conn, object input) { try { Object[] data = input as Object[]; DestinationRow row = new DestinationRow() { AlimId = (int)data[0], ConnId = (int)data[1], TypeId = (int)data[2], }; return(row.Create(conn, null)); } catch (Exception exc) { return(exc); } }