Ejemplo n.º 1
0
        public SurveyQuestion(string var, string qnum)
        {
            VarName = new VariableName(var);
            //VarName = var;
            Qnum = qnum;

            PreP        = "";
            PreI        = "";
            PreA        = "";
            LitQ        = "";
            PstI        = "";
            PstP        = "";
            RespOptions = "";
            NRCodes     = "";

            Translations = new List <Translation>();
            Comments     = new List <QuestionComment>();

            PreviousNameList = new List <VariableName>();
            //PreP = new Wording();
            //PreP.PropertyChanged += WordingChanged;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a list containing every unique refVarName.
        /// </summary>
        /// <returns></returns>
        public static List <VariableName> GetAllVarNames()
        {
            List <VariableName> VarNames = new List <VariableName>();

            string query = "SELECT * FROM qryVariableInfo ORDER BY VarName";

            using (SqlDataAdapter sql = new SqlDataAdapter())
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ISISConnectionString"].ConnectionString))
                {
                    conn.Open();

                    sql.SelectCommand = new SqlCommand(query, conn);

                    try
                    {
                        using (SqlDataReader rdr = sql.SelectCommand.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                VariableName v = new VariableName()
                                {
                                    FullVarName = (string)rdr["VarName"],
                                    VarLabel    = (string)rdr["VarLabel"],
                                    Domain      = new DomainLabel((int)rdr["DomainNum"], (string)rdr["Domain"]),
                                    Topic       = new TopicLabel((int)rdr["TopicNum"], (string)rdr["Topic"]),
                                    Content     = new ContentLabel((int)rdr["ContentNum"], (string)rdr["Content"]),
                                    Product     = new ProductLabel((int)rdr["ProductNum"], (string)rdr["Product"])
                                };
                                VarNames.Add(v);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            return(VarNames);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns the list of all variables in use by a specific survey.
        /// </summary>
        /// <param name="surveyFilter"></param>
        /// <returns></returns>
        public static List <VariableName> GetVariableList(string surveyFilter)
        {
            List <VariableName> varnames = new List <VariableName>();
            string query = "SELECT * FROM VarNames.FN_GetSurveyVarNames(@survey)";

            using (SqlDataAdapter sql = new SqlDataAdapter())
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ISISConnectionString"].ConnectionString))
                {
                    conn.Open();

                    sql.SelectCommand = new SqlCommand(query, conn);
                    sql.SelectCommand.Parameters.AddWithValue("@survey", surveyFilter);
                    try
                    {
                        using (SqlDataReader rdr = sql.SelectCommand.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                VariableName v = new VariableName((string)rdr["VarName"])
                                {
                                    VarLabel = (string)rdr["VarLabel"],
                                    Domain   = new DomainLabel((int)rdr["DomainNum"], (string)rdr["Domain"]),
                                    Topic    = new TopicLabel((int)rdr["TopicNum"], (string)rdr["Topic"]),
                                    Content  = new ContentLabel((int)rdr["ContentNum"], (string)rdr["Content"]),
                                    Product  = new ProductLabel((int)rdr["ProductNum"], (string)rdr["Product"]),
                                };
                                varnames.Add(v);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }

            return(varnames);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns a VariabelName object with the provided VarName.
        /// </summary>
        /// <param name="varname">A valid VarName.</param>
        /// <returns> Null is returned if the VarName is not found in the database.</returns>
        public static VariableName GetVariable(string varname)
        {
            VariableName v;
            string       query = "SELECT * FROM VarNames.FN_GetVarName(@varname)";

            using (SqlDataAdapter sql = new SqlDataAdapter())
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ISISConnectionString"].ConnectionString))
                {
                    conn.Open();

                    sql.SelectCommand = new SqlCommand(query, conn);
                    sql.SelectCommand.Parameters.AddWithValue("@varname", varname);
                    try
                    {
                        using (SqlDataReader rdr = sql.SelectCommand.ExecuteReader())
                        {
                            rdr.Read();
                            v = new VariableName((string)rdr["VarName"])
                            {
                                RefVarName = (string)rdr["refVarName"],
                                VarLabel   = (string)rdr["VarLabel"],
                                Domain     = new DomainLabel((int)rdr["DomainNum"], ((string)rdr["Domain"])),
                                Topic      = new TopicLabel((int)rdr["TopicNum"], ((string)rdr["Topic"])),
                                Content    = new ContentLabel((int)rdr["ContentNum"], ((string)rdr["Content"])),
                                Product    = new ProductLabel((int)rdr["ProductNum"], ((string)rdr["Product"])),
                            };
                        }
                    }
                    catch (Exception)
                    {
                        return(null);
                    }
                }

            return(v);
        }