private void ShowName()
        {
            SqlConnection conn = new SqlConnection(dbconn.Configuration());
            SqlCommand    cmd  = null;
            SqlDataReader rdr  = null;

            string sqlsel = "select name from company";

            try
            {
                conn.Open();
                cmd = new SqlCommand(sqlsel, conn);

                rdr = cmd.ExecuteReader();
                RepeaterName.DataSource = rdr;
                RepeaterName.DataBind();
            }
            catch (Exception ex)
            {
                //LabelMessage.Text = ex.Message;
            }
            finally
            {
                conn.Close();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Show or hide recipe comment
        /// </summary>
        public override void fillup()
        {
            //Find control
            Panel     Panel1      = (Panel)(placeholder.FindControl("Panel1"));
            Image     CommentImg  = (Image)(placeholder.FindControl("CommentImg"));
            HyperLink CommentLink = (HyperLink)(placeholder.FindControl("CommentLink"));

            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            try
            {
                IDataReader dr = FetchData.GetConfiguration;

                dr.Read();

                //Show hide comment
                if (dr["HideShowComment"] != DBNull.Value)
                {
                    this._ShowHideComment = (int)dr["HideShowComment"];
                }

                dr.Close();
                dr = null;

                if (IsShowHideComment)
                {
                    //If true, display recipe comments, else hide.
                    //Get datasourse
                    RepeaterName.DataSource = RecipeCommentProvider.GetComments(ID);
                    RepeaterName.DataBind();
                    Panel1.Visible = true;
                }
                else
                {
                    Panel1.Visible      = false;
                    CommentImg.Visible  = false;
                    CommentLink.Visible = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            FetchData = null;
        }