Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String s = (String)Session["Game Review ID"];
            int gameReviewID = Int32.Parse(s);
            string connStr = ConfigurationManager.ConnectionStrings["DB1"].ToString();
            SqlConnection conn = new SqlConnection(connStr);
            SqlCommand cmd = new SqlCommand("view_game_info", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@game_id", gameID));

            conn.Open();
            SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            while (rdr.Read())
            {
                String game_name = rdr.GetString(rdr.GetOrdinal("name"));
                Label9.Text = game_name;

            }

            string connStr1 = ConfigurationManager.ConnectionStrings["DB1"].ToString();
            SqlConnection conn1 = new SqlConnection(connStr1);
            SqlCommand cmd1 = new SqlCommand("get_game_review_info", conn1);
            cmd1.CommandType = CommandType.StoredProcedure;
            cmd1.Parameters.Add(new SqlParameter("@game_review_id", gameReviewID));

            conn1.Open();
            SqlDataReader rdr1 = cmd1.ExecuteReader(CommandBehavior.CloseConnection);

            while (rdr1.Read())
            {
                String rev_content = rdr1.GetString(rdr1.GetOrdinal("content"));
                String rev_date = "" + rdr1.GetDateTime(rdr1.GetOrdinal("review_date"));
                String reviewer_email = rdr1.GetString(rdr1.GetOrdinal("email"));
                Label12.Text = rev_date;
                Label13.Text = reviewer_email;
                Label11.Text = rev_content;
            }


            string connStr2 = ConfigurationManager.ConnectionStrings["DB1"].ToString();
            SqlConnection conn2 = new SqlConnection(connStr2);
            SqlCommand cmd2 = new SqlCommand("list_comments_Game", conn2);
            cmd2.CommandType = CommandType.StoredProcedure;
            cmd2.Parameters.Add(new SqlParameter("@game_review_id", gameReviewID));


            conn2.Open();
            SqlDataReader rdr2 = cmd2.ExecuteReader(CommandBehavior.CloseConnection);
            while (rdr2.Read())
            {
                String cmnt_txt = rdr2.GetString(rdr2.GetOrdinal("comment_text"));
                String cmnt_email = rdr2.GetString(rdr2.GetOrdinal("email"));
                int comment_id = rdr2.GetInt32(rdr2.GetOrdinal("game_review_comment_id"));

                LinkButton link_email = new LinkButton();
                link_email.Text = cmnt_email + ":";
                link_email.ID = cmnt_email;
                link_email.Click += this.link_email_click;
                form1.Controls.Add(link_email);

                Label lbl_text = new Label();
                lbl_text.Text = cmnt_txt ;
                form1.Controls.Add(lbl_text);

                Button delete_comment = new Button();
                lbl_text.Text = " DELETE"+ " <br /> <br />";
                lbl_text.ID = "A" + comment_id;
                form1.Controls.Add(lbl_text);
                delete_comment.Click += this.deleteAComment;


            }



        }
Ejemplo n.º 2
0
        /// <summary>  
        /// Load Controls on OnInit event  
        /// </summary>  
        /// <param name="e"></param>  
        override protected void OnInit(EventArgs e)
        {
            BuyerValidations buyerValidationObj = new BuyerValidations();

            List<Property> propertyList = new List<Property>();
            if (ck == false)
                propertyList = buyerValidationObj.showProperties(state, city);
            else if(ck==true)
                propertyList = buyerValidationObj.GetPropertiesByPrice(min, max);
            else if (first == false)
            {
                HttpCookie reqCookies = Request.Cookies["sortInfo"];
                if (reqCookies != null)
                {
                    state = reqCookies["State"].ToString();
                    city = reqCookies["City"].ToString();
                }
                propertyList = buyerValidationObj.showProperties(state, city);
                first = true;
            }
            if (propertyList == null && ck != null)
                Response.Write("<script>alert('There are no properties to be displayed');</script>");
            int f = 0;
            foreach (var k in propertyList)
            {
                f++;
                string imgpath = @"Images\"+f+".jpeg";


                // Intializing the UI Controls...

                Label lblPropname = new Label { CssClass = "space", ForeColor = System.Drawing.Color.DarkBlue };



                Label lblType = new Label { CssClass = "space" };
                Label lblPropOption = new Label { CssClass = "space" };
                Label lblPropDescription = new Label();
                Label lblAddress = new Label();
                Label lblPrice = new Label();
                Label lblIntialdeposit = new Label();
                Label lblLandMArk = new Label();


                //Create Group Container Div  
                HtmlGenericControl div = new HtmlGenericControl("div");
                div.Attributes.Add("class", "form-group");

                // dynamic image

                System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                img.ImageUrl = imgpath;

                // styles 

                lblPropname.Style.Add("font-size", "25px");
                lblPropname.Style.Add("font-family", "Century Gothic");
                lblPropname.Style.Add("font-weight", "bold");

                lblType.Style.Add("font-family", "Century Gothic");
                lblType.Style.Add("font-weight", "bold");

                lblPropOption.Style.Add("font-family", "Century Gothic");
                lblPropOption.Style.Add("font-weight", "bold");



                lblPropDescription.Style.Add("font-family", "Century Gothic");
                lblPropDescription.Style.Add("font-weight", "bold");

                lblAddress.Style.Add("font-family", "Century Gothic");
                lblAddress.Style.Add("font-weight", "bold");

                lblPrice.Style.Add("font-family", "Century Gothic");
                lblPrice.Style.Add("font-weight", "bold");

                lblIntialdeposit.Style.Add("font-family", "Century Gothic");
                lblIntialdeposit.Style.Add("font-weight", "bold");

                lblLandMArk.Style.Add("font-family", "Century Gothic");
                lblLandMArk.Style.Add("font-weight", "bold");




                // Mapping the Property data with UI controls...

                lblPropname.Text = k.PropertyName;

                lblType.Text = "Type :  " + k.PropertyType + "    ||    ";
                lblPropOption.Text = "Option :  " + k.PropertyOption + "    ||    ";
                // lblPropDescription.Text = "Description : \t" + k.Description;
                lblAddress.Text = "Address :  " + k.Address + "        ";
                lblPrice.Text = "Price :  " + (int)k.PriceRange + "    ||    ";
                lblIntialdeposit.Text = "Intial Deposit :  " + (int)k.InitialDeposit + "    ||    ";

                lblLandMArk.Text = "LandMark :  " + k.Landmark + "  ||  ";


                // Appending All the UI Controls to stackpanel
                div.Controls.Add(new LiteralControl("<br/>"));
                div.Controls.Add(lblPropname);
                div.Controls.Add(new LiteralControl("<br/><br/>"));
                div.Controls.Add(img);
                div.Controls.Add(lblType);

                div.Controls.Add(lblPropOption);
                div.Controls.Add(lblPrice);
                div.Controls.Add(lblIntialdeposit);
                div.Controls.Add(lblLandMArk);

                div.Controls.Add(lblAddress);

                div.Controls.Add(lblPropDescription);

                //// label for type
                //div.Controls.Add(new Label()
                //{
                //    Text = "Type :" + k.PropertyType,
                //    CssClass = "col-md-2 control-label"

                //});






                //button..
                string propertyId = k.PropertyId.ToString();
                var btnAddcart = new Button
                {
                    ID = "btnClick" + propertyId,
                    Text = "Add To Cart",
                    CssClass = "btn btn-info"
                };

                btnAddcart.Click += (s, RoutedEventArgs) => { ConfirmCart(s, e, propertyId); };



                // GetDataItem owner details..

                var btnOwnerDetails = new LinkButton
                {
                    Text = "Get Owner Details",
                    CssClass = "btn btn-info"
                };

                // button styles
                btnAddcart.Style.Add("font-family", "Century Gothic");
                btnOwnerDetails.Style.Add("font-family", "Century Gothic");


                btnOwnerDetails.Click += (s, RoutedEventArgs) => { GetContactDetails(s, e, propertyId); };
                // Adding all the childs to div
                bodydiv.Controls.Add(div);
                bodydiv.Controls.Add(btnAddcart);
                bodydiv.Controls.Add(new LiteralControl("&nbsp;&nbsp;"));
                bodydiv.Controls.Add(btnOwnerDetails);



                // After adding all the childs..
                bodydiv.Controls.Add(new LiteralControl("<br/><br/>"));
            }
        
    }