public int Update(Batch entity) { Dictionary<String, string> _parameters = new Dictionary<string, string>(); _parameters.Add("Id",Convert.ToString(entity.Id)); _parameters.Add("Name", entity.Name); _parameters.Add("Courses_Id", entity.Courses_Id.ToString()); _parameters.Add("Users_Id", entity.Users_Id.ToString()); _parameters.Add("Timings", entity.Timings); return _database.Update("sp_UpdateBatch", _parameters); }
private void btnCreate_Click(object sender, EventArgs e) { // data reading from user in textboxes Batch batch = new Batch(); batch.Name = txtName.Text; batch.Timings = cmbTimings.Text; batch.Courses_Id = userId; batch.Users_Id = courseId; //calling functio to create batch _batchService.CreateBatch(batch); }
public int Create(Batch entity) { //data binding Dictionary<String, string> _parameters = new Dictionary<string, string>(); _parameters.Add("Name", entity.Name); _parameters.Add("Courses_Id", entity.Courses_Id.ToString()); _parameters.Add("Users_Id", entity.Users_Id.ToString()); _parameters.Add("Timings", entity.Timings); return _database.Create("sp_CreateBatch", _parameters); }
public int UpdateBatch(Batch batch) { return _batchRepository.Update(batch); }
public int CreateBatch(Batch batch) { return _batchRepository.Create(batch); }
private void dgvList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { // Int32.TryParse(Convert.ToString(dgvList.Rows[e.RowIndex].Cells[0].Value), out batchId); _batch = dgvList.Rows[e.RowIndex].DataBoundItem as Batch; //txtName.Text = batch.Name; txtNameud.Text = _batch.Name; cmbTime.Text = _batch.Timings; cmbCourse.Text = _batch.CourseName; cmbTeacher.Text = _batch.UserName; tabBatches.SelectedTab = tabBatches.TabPages[2]; }
//reflection rule private Dictionary<String, String> Mapper(Batch entity) { Dictionary<String, String> _parameters = new Dictionary<string, string>(); PropertyInfo[] properties = typeof(Batch).GetProperties(); foreach (PropertyInfo property in properties) { _parameters.Add(property.Name, Convert.ToString(property.GetValue(entity))); } return _parameters; }