public override int Delete(Int32 id) { string sql = "DELETE FROM " + tableName + " where ID = " + id.ToString(); this.Execute(sql); // Borro las canciones de esta clase ListaItemsMng lim = new ListaItemsMng(); lim.Delete(id); // Si existen carpetalistas que tengan como id_carpetalista (padre) a mi id, las borro SQLiteCommand cmd = new SQLiteCommand(Program.m_dbConnection); cmd.CommandText = "select count(id) from " + this.tableName + " where id_carpetalista=" + id.ToString(); Int32 count = Convert.ToInt32(cmd.ExecuteScalar()); if (count > 0) { CarpetaListaMng clm = new CarpetaListaMng(); clm.Delete(id.ToString()); } return(0); }
public void SetData() { ListaItemsMng lim = new ListaItemsMng(); lim.Filter("ID_CARPETALISTA=" + clase.id.ToString()); lim.Sort("ORDEN ASC"); lim.Attach(gridItemsClase); }
public void LoadCarpetaLista(Int32 id_clase, int iSelect) { id_carpetalista = id_clase; ids = new Dictionary<string,int>(); ListaItemsMng lim = new ListaItemsMng(); lim.Filter("ID_CARPETALISTA=" + id_clase.ToString()); lim.Sort("ORDEN ASC"); foreach (DataRowView row in lim.dv) { lbxCanciones.Items.Add(row["titulo"].ToString()); ids.Add(row["titulo"].ToString(), Convert.ToInt32(row["id"])); } lbxCanciones.Focus(); lbxCanciones.SelectedIndex = iSelect; }
private void FromEditClassSong_Load(object sender, EventArgs e) { lim = new ListaItemsMng(); lim.Filter("id=" + id.ToString()); txtNombre.Text = lim.dv[0]["Titulo"].ToString(); txtDuracion.Text = lim.dv[0]["duracion"].ToString(); txtArtista.Text = lim.dv[0]["Autor"].ToString(); chkRepetir.Checked = Convert.ToBoolean(lim.dv[0]["repetir"]); txtAlbum.Text = lim.dv[0]["Album"].ToString(); txtEmpieza.Text = lim.dv[0]["desde"].ToString().PadLeft(5, '0'); txtTermina.Text = lim.dv[0]["hasta"].ToString().PadLeft(5, '0'); txtEsperar.Text = lim.dv[0]["esperar"].ToString(); }
private void btnDown_Click(object sender, EventArgs e) { curRow = gridItemsClase.CurrentRow.Index; if (curRow == gridItemsClase.Rows.Count || gridItemsClase.Rows.Count < 2) { return; } Int32 curOrder = Convert.ToInt32(gridItemsClase.Rows[curRow].Cells["orden"].Value); gridItemsClase.Rows[curOrder].Selected = false; Int32 curId = Convert.ToInt32(gridItemsClase.Rows[curRow].Cells["id"].Value); Int32 upOrder = Convert.ToInt32(gridItemsClase.Rows[curRow + 1].Cells["orden"].Value); Int32 upId = Convert.ToInt32(gridItemsClase.Rows[curRow + 1].Cells["id"].Value); ListaItemsMng lim = new ListaItemsMng(); lim.UpdateOrden(curId, upOrder); lim.UpdateOrden(upId, curOrder); SetData(); gridItemsClase.Rows[curOrder].Selected = true; }