public FrmUserOldEdit(UsersOld entity) { InitializeComponent(); txtFullName.Text = entity.FullName; txtPassword.Text = entity.Password; txtCredit.Text = entity.Bakiye.ToString(); txtUsername.Text = entity.UserName; id = entity.Id; }
public FrmUserOldEdit(UsersOld entity) { id = entity.Id; InitializeComponent(); rep = new UserOldRepository(); txtCredit.Text = entity.Bakiye.ToString(); txtUsername.Text = entity.UserName; txtPassword.Text = entity.Password; txtFullname.Text = entity.FullName; }
protected override void btnDelete_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count <= 0) { MessageBox.Show("select row to delete"); return; } UsersOld entity = (UsersOld)dataGridView1.SelectedRows[0].DataBoundItem; rep.Delete(entity.Id); refresh(); }
protected override void btnEdit_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count <= 0) { MessageBox.Show("select row to delete"); return; } UsersOld entity = (UsersOld)dataGridView1.SelectedRows[0].DataBoundItem; FrmUserOldEdit frm = new FrmUserOldEdit(entity); frm.ShowDialog(); refresh(); }
private void btnSave_Click(object sender, EventArgs e) { UsersOld usr = new UsersOld(); usr.FullName = txtFullname.Text; usr.UserName = txtUsername.Text; usr.Password = txtPassword.Text; usr.Bakiye = Convert.ToDecimal(txtCredit.Text); if (id == -1) { rep.Add(usr); } else { usr.Id = id; rep.Edit(usr); } Close(); }
private void btnSave_Click(object sender, EventArgs e) { UsersOld users = new UsersOld(); users.FullName = txtFullName.Text; users.Password = txtPassword.Text; users.UserName = txtUsername.Text; users.Bakiye = Convert.ToDecimal(txtCredit.Text); UsersOldRepository rep = new UsersOldRepository(); if (id == -1) { rep.Insert(users); } else { users.Id = id; rep.Update(users); } Close(); }