示例#1
0
        public Formulario getForm(int id)
        {
            Formulario form = new Formulario();
            using (SqlConnection cn = new SqlConnection(helper.ConnectionString))
            {
                string sql = "select * from PC_Formulario_FRM where FRM_ID = @FRM_ID";
                SqlParameter[] param = {
                                       new SqlParameter("@FRM_ID", id)
                                   };
                cn.Open();
                try
                {
                    SqlDataReader reader = helper.ExecuteReader(CommandType.Text, sql, param);
                    if (reader.Read())
                    {
                        form.Id = Convert.ToInt32(reader["FRM_ID"]);
                        form.Nome = reader["FRM_NOME"].ToString();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    cn.Close();
                }
            }

            return form;
        }
示例#2
0
        public List<Formulario> getFormulariosFluxo(int idFluxo)
        {
            List<Formulario> lista = new List<Formulario>();
            Formulario item;
            using (SqlConnection cn = new SqlConnection(helper.ConnectionString))
            {
                string sql = "select * from PC_Fluxo_Formulario_FLF INNER JOIN PC_Formulario_FRM ON FLF_FRM_ID = FRM_ID WHERE FLF_FLX_ID = @FLX_ID";
                SqlParameter[] param = {
                                       new SqlParameter("@FLX_ID", idFluxo)
                                   };
                cn.Open();
                try
                {
                    SqlDataReader reader = helper.ExecuteReader(CommandType.Text, sql, param);
                    while (reader.Read())
                    {
                        item = new Formulario();
                        item.Id = Convert.ToInt32(reader["FRM_ID"]);
                        item.Nome = reader["FRM_NOME"].ToString();
                        item.Ordem = Convert.ToInt32(reader["FLF_Ordem"]);
                        lista.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    cn.Close();
                }
            }

            return lista;
        }