private async void GuardarDados() { if (Validacao()) { var codigo = string.IsNullOrWhiteSpace(IDTextEdit.Text) || IDTextEdit.Text.Equals("0"); var models = new AlunoModels { ID = codigo ? 0 : (int)IDTextEdit.EditValue, InstituicaoID = (int)txtInstituicao.EditValue, TurmaID = (int)txtTurma.EditValue, Nome = (string)txtNome.EditValue, NumeroEstudante = (string)txtNumeroEstudante.EditValue, DataNascimento = (DateTime)txtdataNascimento.EditValue, DataRegisto = (DateTime)txtdataRegisto.EditValue, IsValido = (bool)IsValidoToggleSwitch.EditValue, Sexo = (SexoModels)txtSexo.EditValue, Email = (string)EmailTextEdit.EditValue, }; var result = await alunoModels.Guardar(models); if (result) { XtraMessageBox.Show("Inserido com Exito", "Inserção", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
static void Main(string[] args) { AlunoModels aluno = new AlunoModels("luana", "Engenharia", 23, "483191991", true); System.Console.WriteLine(aluno.Nome); AlunoModels aluno_sobrecarga = new AlunoModels(); }
public async Task <bool> Guardar(AlunoModels Models) { if (Models.ID == 0) { await this.biblioteContext.AlunoModels.AddAsync(Models); } else { this.biblioteContext.AlunoModels.Update(Models); } return(await Salvar()); }
public frmAlunosAdd(AlunoModels alunoModels, IAlunoModels alunoModelsRepostory, IInstituicaoModels instituicaoModels, ITurmaModels turmaModels) { InitializeComponent(); this.Load += delegate { LoaderFormsXML(); Loader(); }; btnClose.Click += delegate { SaveFormsXML(); }; IDTextEdit.EditValueChanged += IDTextEdit_TextChanged; windowsUIButtonPanel1.ButtonClick += WindowsUIButtonPanel1_ButtonClick;; this.alunoModels = alunoModelsRepostory; this.instituicaoModels = instituicaoModels; this.turmaModels = turmaModels; if (alunoModels != null) { IDTextEdit.EditValue = alunoModels.ID; txtInstituicao.EditValue = alunoModels.InstituicaoID; txtTurma.EditValue = alunoModels.TurmaID; txtNome.EditValue = alunoModels.Nome; txtNumeroEstudante.EditValue = alunoModels.NumeroEstudante; txtdataNascimento.EditValue = alunoModels.DataNascimento; txtdataRegisto.EditValue = alunoModels.DataRegisto; IsValidoToggleSwitch.EditValue = alunoModels.IsValido; txtSexo.EditValue = (SexoModels)alunoModels.Sexo; EmailTextEdit.EditValue = (string)alunoModels.Email; txtPratileiraPosicao.EditValue = (int)alunoModels.Idate; txtNumeroEstudante.Focus(); } else { txtdataRegisto.DateTime = DateTime.Now; txtNumeroEstudante.Focus(); } btnAddForenty1.Click += BtnAddForenty_Click; btnAddForenty2.Click += BtnAddForenty_Click2; txtSexo.Properties.DataSource = Enum.GetValues(typeof(SexoModels)); txtSexo.ItemIndex = 0; txtdataNascimento.Validating += TxtdataNascimento_Validating; EmailTextEdit.Validating += EmailTextEdit_Validating; }
static void Main(string[] args) { AlunoModels aluo1 = new AlunoModels(); }
public async Task <bool> Delete(AlunoModels Models) { biblioteContext.AlunoModels.Remove(Models); return(await Salvar()); }