Esempio n. 1
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            Boolean Result = false;

            int Func_Id = int.Parse(ddlFuncionario.SelectedValue.ToString());

            int Id = int.Parse(lblValueId.Text);

            try
            {
                this.objCntrlTarefa = new cntrlTarefa();

                this.rowTarefa               = this.objCntrlTarefa.Select(Id);
                this.rowTarefa.Descricao     = txtDescricao.Text.Trim();
                this.rowTarefa.IdFuncionario = Func_Id;

                Result = this.objCntrlTarefa.Save(rowTarefa);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                this.objCntrlTarefa = null;
                this.rowTarefa      = null;
            }

            this.getData(Func_Id);
        }
Esempio n. 2
0
        private void insertData()
        {
            Boolean Result = false;

            int Func_Id = int.Parse(ddlFuncionario.SelectedValue.ToString());

            try
            {
                this.objCntrlTarefa = new cntrlTarefa();

                this.rowTarefa               = this.tblTarefa.NewtblTarefasRow();
                this.rowTarefa.Descricao     = txtDescricao.Text.Trim();
                this.rowTarefa.IdFuncionario = Func_Id;

                Result = this.objCntrlTarefa.Save(rowTarefa);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                this.objCntrlTarefa = null;
                this.rowTarefa      = null;
            }

            this.getData(Func_Id);
        }
Esempio n. 3
0
        public DS_DTO.tblTarefasRow Select(int pId)
        {
            DS_DTO.tblTarefasDataTable tblTarefa = new DS_DTO.tblTarefasDataTable();
            DS_DTO.tblTarefasRow       rowTarefa = tblTarefa.NewtblTarefasRow();

            try
            {
                this._objTarefa = Tarefa.RetrieveObject(pId);

                rowTarefa.Id            = this._objTarefa.Id;
                rowTarefa.Descricao     = this._objTarefa.Descricao;
                rowTarefa.IdFuncionario = this._objTarefa.Funcionario.Id;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(rowTarefa);
        }
Esempio n. 4
0
        public Boolean Save(DS_DTO.tblTarefasRow pRowTarefa)
        {
            Boolean Result = false;

            if (pRowTarefa.Id == 0 || Convert.ToString(pRowTarefa.Id) == string.Empty)
            {
                this._objTarefa             = new Tarefa();
                this._objTarefa.Descricao   = pRowTarefa.Descricao;
                this._objTarefa.Funcionario = Funcionario.RetrieveObject(pRowTarefa.IdFuncionario);

                try
                {
                    Result = this._objTarefa.Persist();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                this._objTarefa             = Tarefa.RetrieveObject(pRowTarefa.Id);
                this._objTarefa.Descricao   = pRowTarefa.Descricao;
                this._objTarefa.Funcionario = Funcionario.RetrieveObject(pRowTarefa.IdFuncionario);

                try
                {
                    Result = this._objTarefa.Update();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(Result);
        }