private void updateData() { Boolean Result = false; int Id = 0; try { Id = Convert.ToInt32(lblValueId.Text); this.objCntrlDepartamento = new cntrlDepartamento(); rowDepartamento = this.objCntrlDepartamento.Select(Id); rowDepartamento.Nome = txtNome.Text; Result = this.objCntrlDepartamento.Save(rowDepartamento); } catch (Exception ex) { throw ex; } finally { this.rowDepartamento = null; this.objCntrlDepartamento = null; } this.getData(); }
private void insertData() { Boolean Result = false; try { this.rowDepartamento = this.tblDepartamento.NewtblDepartamentosRow(); this.objCntrlDepartamento = new cntrlDepartamento(); rowDepartamento.Nome = txtNome.Text; Result = this.objCntrlDepartamento.Save(rowDepartamento); } catch (Exception ex) { throw ex; } finally { this.rowDepartamento = null; this.objCntrlDepartamento = null; } this.getData(); }
public DS_DTO.tblDepartamentosRow Select(int pId) { DS_DTO.tblDepartamentosDataTable tblDepartamento = new DS_DTO.tblDepartamentosDataTable(); DS_DTO.tblDepartamentosRow rowTblDepartamento = tblDepartamento.NewtblDepartamentosRow(); try { this._objDepartamento = Departamento.RetrieveObject(pId); rowTblDepartamento.Id = this._objDepartamento.Id; rowTblDepartamento.Nome = this._objDepartamento.Nome; rowTblDepartamento.FuncionariosCount = this._objDepartamento.Funcionarios.Count; } catch (Exception ex) { throw ex; } return(rowTblDepartamento); }
public Boolean Save(DS_DTO.tblDepartamentosRow pRowDepartamento) { Boolean result = false; if (pRowDepartamento.Id == 0 || Convert.ToString(pRowDepartamento.Id) == string.Empty) { this._objDepartamento = new Departamento(); this._objDepartamento.Nome = pRowDepartamento.Nome; try { result = this._objDepartamento.Persist(); } catch (Exception ex) { throw ex; } } else { this._objDepartamento = Departamento.RetrieveObject(pRowDepartamento.Id); this._objDepartamento.Nome = pRowDepartamento.Nome; try { result = this._objDepartamento.Update(); } catch (Exception ex) { throw ex; } } return(result); }