Ejemplo n.º 1
0
        //Reload list of BV's
        public void ReloadBusinessValues()
        {
            mValues = new List<BusinessValue>();

            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString))
            {
                using (SqlCommand cmd1 = new SqlCommand())
                {
                    cmd1.CommandText = "SELECT BusinessValueName FROM [dbo].[SP_BV_Crosswalk] WHERE RoadmapName = @Rname AND StrategyPointName =@Sname";
                    cmd1.Parameters.AddWithValue("@Rname", mRoadmapName);
                    cmd1.Parameters.AddWithValue("@Sname", mName);
                    cmd1.Connection = conn;

                    conn.Open();
                    using (SqlDataReader Reader = cmd1.ExecuteReader())
                    {
                        while (Reader.Read())
                        {
                            string temp = Reader.GetString(0);
                            BusinessValue bv = new BusinessValue(Reader.GetString(0), mRoadmapName);
                            mValues.Add(bv);
                        }
                    }
                }

                foreach (BusinessValue bv in mValues)
                {
                    using (SqlCommand cmd2 = new SqlCommand())
                    {
                        cmd2.CommandText = "SELECT Description FROM [dbo].[BusinessValue] WHERE Name=@BVName AND RoadmapName=@Rname";
                        cmd2.Parameters.AddWithValue("@Rname", mRoadmapName);
                        cmd2.Parameters.AddWithValue("@BVName", bv.GetName());
                        cmd2.Connection = conn;

                        using (SqlDataReader Reader = cmd2.ExecuteReader())
                        {
                            if (Reader.HasRows)
                            {
                                Reader.Read();
                                bv.SetDescription(Reader.GetString(0).ToString());
                                Reader.Close();
                            }
                        }
                    }
                }
                conn.Close();
            }
        }
Ejemplo n.º 2
0
        //CONSTRUCTOR
        public StrategyPoint(string id,string desc, string rname)
        {
            mName = id;
            mDescription = desc;
            mRoadmapName = rname;

            //Get the StrategyPoints
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.CommandText = "SELECT BusinessValueName FROM [dbo].[SP_BV_Crosswalk] WHERE RoadmapName =@Rname AND StrategyPointName =@Sname";
                    cmd.Parameters.AddWithValue("@Rname", mRoadmapName);
                    cmd.Parameters.AddWithValue("@Sname", mName);
                    cmd.Connection = conn;

                    conn.Open();
                    using (SqlDataReader Reader = cmd.ExecuteReader())
                    {
                        while (Reader.Read())
                        {
                            string temp = Reader.GetString(0);
                            BusinessValue bv = new BusinessValue(Reader.GetString(0), mRoadmapName);
                            mValues.Add(bv);
                        }
                    }

                }

                using (SqlCommand cmd3 = new SqlCommand())
                {
                    cmd3.CommandText = "SELECT color FROM [dbo].[StrategyPoint] WHERE RoadmapName =@Rname AND Name = @sName";
                    cmd3.Parameters.AddWithValue("@Rname", mRoadmapName);
                    cmd3.Parameters.AddWithValue("@Sname", mName);
                    cmd3.Connection = conn;

                    try
                    {
                        using (SqlDataReader Reader = cmd3.ExecuteReader())
                        {
                            Reader.Read();

                            mColor = Reader.GetString(0);
                        }
                    }
                    catch
                    {
                        mColor = "#000000";
                    }
                }

                foreach (BusinessValue bv in mValues)
               {
                   using (SqlCommand cmd2 = new SqlCommand())
                   {
                       cmd2.CommandText = "SELECT Description FROM [dbo].[BusinessValue] WHERE Name=@BVName AND RoadmapName=@Rname";
                       cmd2.Parameters.AddWithValue("@Rname", mRoadmapName);
                       cmd2.Parameters.AddWithValue("@BVName", bv.GetName());
                       cmd2.Connection = conn;

                       //conn.Open();
                        using (SqlDataReader Reader = cmd2.ExecuteReader())
                        {
                            if (Reader.HasRows)
                            {
                               Reader.Read();
                               bv.SetDescription(Reader.GetString(0).ToString());
                            }
                        }
                   }
               }
                conn.Close();

            }
        }