public bool InserirSubDepartamento(SubDepartamento SQLServ) { try { using (var conexao = new SQLiteConnection(System.IO.Path.Combine(pasta, "StfrenteAndroid.db"))) { conexao.InsertOrReplace(SQLServ); return(true); } } catch (SQLiteException ex) { String exs = ex.ToString(); return(false); } }
public bool DeletarSubDepartamento(SubDepartamento sql) { try { using (var conexao = new SQLiteConnection(System.IO.Path.Combine(pasta, "StfrenteAndroid.db"))) { conexao.Delete(sql); return(true); } } catch (SQLiteException ex) { String exs = ex.ToString(); return(false); } }
private void SalvarSubDepart_Clicked(object sender, EventArgs e) { String CdSubDepart = InputCodSubDepart.Text; SubDepartamento Dpart = new SubDepartamento(); CommandSubDepartamento CmdSub = new CommandSubDepartamento(); CmdSub.CriarBancoSubDepartamento(); Dpart.Descricao = InputDescricao.Text; if (pickerDepartamento.SelectedItem != null) { var subDerp = (Departamento)pickerDepartamento.SelectedItem; Dpart.CodSubDepartamento = subDerp.IdDepart; } if (InputCodSubDepart.Text == "" || InputCodSubDepart.Text == null) { List <SubDepartamento> Dep = CmdSub.GetMax(); int cod = 1; if (Dep.Count != 0) { cod = Dep[0].CodSubDepartamento + 1; } Dpart.CodSubDepartamento = cod; if (pickerDepartamento.SelectedItem != null) { var PkDepartamento = (Departamento)pickerDepartamento.SelectedItem; Dpart.CdDepartamento = PkDepartamento.IdDepart; } } CmdSub.InserirSubDepartamento(Dpart); CarregaTab(); InputCodSubDepart.Text = ""; InputDescricao.Text = ""; pickerDepartamento.SelectedItem = null; }