Example #1
0
        public List <Object> gerenciaReqComponentesTO(int acao, String ConnectionString)
        {
            try
            {
                //INSTANCIA LISTA DE OBJETOS PARA RETORNO
                lista_dados = new List <object>();

                //INSTANCIA DATATABLE QUE RECEBERÁ DADOS DA DAO
                dt = new System.Data.DataTable();

                //BUSCO DADOS NA DAO
                dt = _dao.GerenciaReqComponentes(this._codigoreqcomponentes, this._requisitomini.CodigoReq, this._componente.CodigoComp, acao, ConnectionString);

                //VERIFICO SE NÃO VOLTOU NULO
                if (!(dt == null))
                {
                    if (dt.Rows.Count > 0)
                    {
                        if (acao != 2)
                        {
                            lista_dados.Add(dt.Rows[0][0].ToString());
                        }
                        else
                        {
                            for (int x = 0; x < dt.Rows.Count; x++)
                            {
                                ReqComponentesTO item = new ReqComponentesTO(false);
                                item.CodigoReqComponentes = int.Parse(dt.Rows[x]["CODIGOREQ_COMPONENTES"].ToString());

                                // RequisitoMinimoTO
                                item._requisitomini.CodigoReq   = int.Parse(dt.Rows[x]["CODIGOREQ"].ToString());
                                item._requisitomini.Componentes = dt.Rows[x]["COMPONENTES"].ToString();

                                //ComponentesTO



                                lista_dados.Add(item);
                            }
                        }
                    }
                }

                return(lista_dados);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public List<Object> gerenciaReqComponentesTO(int acao, String ConnectionString)
        {
            try
            {
                //INSTANCIA LISTA DE OBJETOS PARA RETORNO
                lista_dados = new List<object>();

                //INSTANCIA DATATABLE QUE RECEBERÁ DADOS DA DAO
                dt = new System.Data.DataTable();

                //BUSCO DADOS NA DAO
                dt = _dao.GerenciaReqComponentes(this.CodigoReqComponentes, this.Requisito, this.Componente, acao, ConnectionString);

                //VERIFICO SE NÃO VOLTOU NULO
                if (!(dt == null))
                {
                    if (dt.Rows.Count > 0)
                    {
                        if (acao != 2)
                        {

                            lista_dados.Add(dt.Rows[0][0].ToString());
                        }
                        else
                        {

                            for (int x = 0; x < dt.Rows.Count; x++)
                            {

                                ReqComponentesTO item = new ReqComponentesTO(false);
                                item.CodigoReqComponentes = int.Parse(dt.Rows[x]["CODIGOREQ_COMPONENTES"].ToString());
                                item.Requisito = int.Parse(dt.Rows[x]["REQUISITO"].ToString());
                                item.Componente = int.Parse(dt.Rows[x]["COMPONENTE"].ToString());
                                lista_dados.Add(item);

                            }

                        }
                    }
                }

                return lista_dados;
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }