private void dgvostad_CellEndEdit(object sender, DataGridViewCellEventArgs e) { var entekhabvahed = new entekhabvahed(); entekhabvahed.idostad = idostad; entekhabvahed.iddaneshjo = (int)dgvostad.Rows[e.RowIndex].Cells["iddaneshjo"].Value; entekhabvahed.iddars = (int)dgvostad.Rows[e.RowIndex].Cells["iddars"].Value; entekhabvahed.nomrh = (float)dgvostad.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; entekhabvahed.update(); }
private void btn_sabt_Click(object sender, EventArgs e) { var entekhabvahed = new entekhabvahed(); entekhabvahed.iddaneshjo = iddanshjo; entekhabvahed.iddars = (int)cbx_course.SelectedValue; entekhabvahed.idostad = (int)cbx_ostad.SelectedValue; entekhabvahed.add(); DialogResult = DialogResult.OK; Close(); }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("آیا واحد انتخاب شده حذف شود؟", "عملیلات حذف", MessageBoxButtons.YesNo) == DialogResult.Yes) { var entekhabvahed = new entekhabvahed(); entekhabvahed.iddaneshjo = iddanshjo; entekhabvahed.iddars = (int)dgvvahed.SelectedRows[0].Cells["iddars"].Value; entekhabvahed.idostad = (int)dgvvahed.SelectedRows[0].Cells["idostad"].Value; entekhabvahed.delete(); dgvvahed.DataSource = new entekhabvahed().selectbydaneshjo(iddanshjo); } }