Beispiel #1
0
    //protected void Rating1_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)
    //{
    //   // Response.Write("<script>alert(\"you have rated this property as "+e.Value.ToString()+"\")</script>");
    //    Response.Write("you have rated this property as " + e.Value.ToString() + "");
    //    lblmsg.Text = "you have rated this property as " + e.Value.ToString() + "";
    //}
    protected void Rating1_Changed1(object sender, RatingEventArgs e)
    {
        user_id = Convert.ToInt32(Session["id"]);
        try
        {
            con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\webdata.mdf;Integrated Security=True;MultipleActiveResultSets=true");
            //i have used MultipleActiveResultSets=true in connectionstring for allowing multiple resultset.
            con.Open();

            if (cnt1 == 1)
            {
                SqlCommand sq = new SqlCommand("update tblrating set rating=" + e.Value + " where property_id=" + id + " and userid=" + user_id + "", con);
                Response.Write(sq.CommandText);
                sq.ExecuteNonQuery();
                con.Close();
            }
            else
            {
                SqlCommand sq = new SqlCommand("insert into tblrating (rating,property_id,userip,userid) values(" + e.Value + "," + id + ",'" + myip + "'," + user_id + ")", con);
                Response.Write(sq.CommandText);
                sq.ExecuteNonQuery();
                con.Close();
            }
        }
        catch
        {
            msg.InnerHtml = "Sorry, something went wrong";
        }
    }
 protected void Rating5_Changed(object sender, RatingEventArgs e)
 {
     if (e.Value == "2")
     {
         Rating5.CurrentRating = 10;
     }
 }
 protected void RatingChanged(object sender, RatingEventArgs e)
 {
     //Rating r =(Rating) sender ;
     //r.ReadOnly = true;
     //string str= r.GetCallbackResult();
     //int a = 10;
 }
Beispiel #4
0
 protected void elemRating_Changed(object sender, RatingEventArgs e)
 {
     // Actualize CurrentRating properties
     elemRating.CurrentRating = ValidationHelper.GetInteger(e.Value, 0);
     GetCurrentRating();
     // Throw the rating event
     OnRating();
 }
Beispiel #5
0
 protected void Rating1_Click1(object sender, RatingEventArgs e)
 {
     if (lastVal != Int32.Parse(e.Value))
     {
         lastVal = Int32.Parse(e.Value);
         System.Diagnostics.Debug.WriteLine("entrei na merda do botao" + e.Value);
         Auxiliar.Played(HttpContext.Current.User.Identity.Name.ToString(), Int32.Parse(Request.QueryString["id"]), Int32.Parse(e.Value));
         Label2.Text = Auxiliar.GetAvgScore(Int32.Parse(Request.QueryString["id"])).ToString();
     }
 }
Beispiel #6
0
 protected void productRating_Changed(object sender, RatingEventArgs e)
 {
     if (NopContext.Current.User == null || NopContext.Current.User.IsGuest)
     {
         lblProductRatingResult.Text = GetLocaleResourceString("Products.OnlyRegisteredUsersCanRating");
         e.CallbackResult            = GetLocaleResourceString("Products.OnlyRegisteredUsersCanRating");
     }
     else
     {
         ProductManager.SetProductRating(this.ProductId, int.Parse(e.Value));
         lblProductRatingResult.Text = GetLocaleResourceString("Products.RatingWillBeUpdatedVerySoon");
         e.CallbackResult            = "Update done. Value = " + e.Value;
     }
 }
    protected void Rating1_Changed(object sender, RatingEventArgs e)
    {
        string    s  = "select * from tbl_rating where user_id=" + Session["usid"] + " and product_id='" + e.Tag + "'";
        DataTable dt = obj.GetDataTable(s);

        if (dt.Rows.Count > 0)
        {
        }
        else
        {
            string insqry = "insert into tbl_rating(user_id,product_id,rate_value)values(" + Session["usid"] + "," + e.Tag + "," + e.Value + ")";
            obj.ExceuteCommand(insqry);

            filldetails();
        }
    }
Beispiel #8
0
        protected void Rating_Changed(object sender, RatingEventArgs args)
        {
            int rating;

            if (!int.TryParse(args.Value, out rating))
            {
                return;
            }

            UserRating = rating;

            UpdateDisplay();

            if (RatingChanged != null)
            {
                RatingChanged(this, EventArgs.Empty);
            }
        }
Beispiel #9
0
        protected void productRating_Changed(object sender, RatingEventArgs e)
        {
            if (NopContext.Current.User == null && this.CustomerService.AllowAnonymousUsersToSetProductRatings)
            {
                this.CustomerService.CreateAnonymousUser();
            }

            if (NopContext.Current.User == null || (NopContext.Current.User.IsGuest && !this.CustomerService.AllowAnonymousUsersToSetProductRatings))
            {
                lblProductRatingResult.Text = GetLocaleResourceString("Products.OnlyRegisteredUsersCanRating");
                e.CallbackResult            = GetLocaleResourceString("Products.OnlyRegisteredUsersCanRating");
            }
            else
            {
                this.ProductService.SetProductRating(this.ProductId, int.Parse(e.Value));
                lblProductRatingResult.Text = GetLocaleResourceString("Products.RatingWillBeUpdatedVerySoon");
                e.CallbackResult            = "Update done. Value = " + e.Value;
            }
        }
Beispiel #10
0
        protected void OnRatingChanged(object sender, RatingEventArgs e)
        {
            int    rowIndex = ((sender as Rating).NamingContainer as GridViewRow).RowIndex;
            int    fruitId  = Convert.ToInt32(gvFruits.DataKeys[rowIndex].Value);
            string constr   = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))
            {
                using (SqlCommand cmd = new SqlCommand("INSERT INTO EventRating VALUES(@id, @Rating)"))
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.Parameters.AddWithValue("@id", fruitId);
                    cmd.Parameters.AddWithValue("@Rating", e.Value);
                    cmd.Connection = con;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
            Response.Redirect(Request.Url.AbsoluteUri);
        }
    protected void productRating_Changed(object sender, RatingEventArgs e)
    {
        //Thread.Sleep(400);
        //e.CallbackResult = "Update done. Value = " + e.Value + " Tag = " + e.Tag;

        string howSpicy = "";

        switch (productRating.CurrentRating)
        {
        case 1:
            howSpicy = "Không tốt";
            lblResponse.ForeColor = System.Drawing.Color.Red;
            break;

        case 2:
            howSpicy = "Bình thường";
            lblResponse.ForeColor = System.Drawing.Color.BlueViolet;
            break;

        case 3:
            howSpicy = "Tốt";
            lblResponse.ForeColor = System.Drawing.Color.Blue;
            break;

        case 4:
            howSpicy = "Rất tốt";
            lblResponse.ForeColor = System.Drawing.Color.Green;
            break;

        case 5:
            howSpicy = "Hoàn hảo";
            lblResponse.ForeColor = System.Drawing.Color.OrangeRed;

            break;
        }
        Page.Title       = title;
        lblResponse.Text = "<b>" + howSpicy + "</b>";
    }
Beispiel #12
0
        protected void OnRatingChanged(object sender, RatingEventArgs e)
        {
            string constr = ConfigurationManager.ConnectionStrings["Data Source=192.168.1.2;Initial Catalog=AjaxSamples;Persist Security Info=True;User ID=sa;Password=oIIoAdmin"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))
            {
                using (SqlCommand cmd = new SqlCommand("INSERT INTO UserRatings VALUES(@Rating)"))
                {
                    using (SqlDataAdapter sda = new SqlDataAdapter())
                    {
                        cmd.CommandType = CommandType.Text;
                        cmd.Parameters.AddWithValue("@Rating", e.Value);
                        cmd.Connection = con;
                        con.Open();
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
            }
            Response.Redirect(Request.Url.AbsoluteUri);
            DataTable dt = this.GetData("SELECT ISNULL(AVG(Rating), 0) AverageRating, COUNT(Rating) RatingCount FROM UserRatings");
            // Rating1.CurrentRating = Convert.ToInt32(dt.Rows[0]["AverageRating"]);
            // lblRatingStatus.Text = string.Format("{0} Users have rated. Average Rating {1}", dt.Rows[0]["RatingCount"], dt.Rows[0]["AverageRating"]);
        }
Beispiel #13
0
        protected void RatingControlPlaylist_OnRate(object sender, RatingEventArgs e)
        {
            string id = Request.QueryString["id"];

            try
            {
                if (id != null)
                {
                    int intId     = int.Parse(id);
                    var newRating = new Rating()
                    {
                        Value      = e.RatingValue,
                        UserId     = Page.User.Identity.GetUserId(),
                        PlaylistId = intId
                    };

                    ratings.Add(newRating);
                    ratings.SaveChanges();
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #14
0
 protected void RatingAccuracy_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
Beispiel #15
0
 protected void RatingHabbit_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
Beispiel #16
0
 /// <summary>
 /// Run custom code when the user rates something and then return a custom string
 /// to the JavaScript client
 /// </summary>
 /// <param name="sender">Rating control</param>
 /// <param name="e">RatingEventArgs</param>
 protected void ThaiRating_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
     e.CallbackResult = "Update done. Value = " + e.Value + " Tag = " + e.Tag;
 }
Beispiel #17
0
 protected void RatingInitiative_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
Beispiel #18
0
 protected void RatingInnovation_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
Beispiel #19
0
 protected void Rating1_Changed(object sender, RatingEventArgs e)
 {
 }
Beispiel #20
0
    protected void ThaiRating_Changed(object sender, RatingEventArgs e)
    {
        try
        {
            if (_productId == -1)
            {
                return;
            }

            if (!CustomerSession.CurrentCustomer.RegistredUser)
            {
                lblRatingInfo.Visible = true;
                lblRatingInfo.Text    = Resources.Resource.Client_Details_VotesCanRegUsers;
                return;
            }

            var userId = CustomerSession.CurrentCustomer.Id;

            using (var db = new SQLDataAccess())
            {
                //--------------------------------------------------
                db.cmd.CommandText = "[Catalog].[sp_GetCOUNT_Ratio]";
                db.cmd.CommandType = CommandType.StoredProcedure;
                db.cmd.Parameters.Clear();
                db.cmd.Parameters.AddWithValue("@CustomerId", userId);
                db.cmd.Parameters.AddWithValue("@ProductID", ProductId);

                db.cnOpen();
                if (SQLDataHelper.GetInt(db.cmd.ExecuteScalar()) >= 1)
                {
                    db.cnClose();
                    ThaiRating.ReadOnly   = true;
                    lblRatingInfo.Visible = true;
                    return;
                }

                //--------------------------------------------------
                db.cmd.CommandText = "[Catalog].[sp_AddRatio]";
                db.cmd.CommandType = CommandType.StoredProcedure;
                db.cmd.Parameters.Clear();
                db.cmd.Parameters.AddWithValue("@ProductID", ProductId);
                db.cmd.Parameters.AddWithValue("@ProductRatio", Convert.ToInt32(e.Value));
                db.cmd.Parameters.AddWithValue("@CustomerId", userId);

                db.cmd.ExecuteNonQuery();
                //--------------------------------------------------

                db.cmd.CommandText = "[Catalog].[sp_GetCOUNTRatioByProductID]";
                db.cmd.CommandType = CommandType.StoredProcedure;
                db.cmd.Parameters.Clear();
                db.cmd.Parameters.AddWithValue("@ProductID", ProductId);

                lblSummRating.Text = @"(" + SQLDataHelper.GetString(db.cmd.ExecuteScalar()) + @" " + Resources.Resource.Client_Details_Votes + @")";

                //--------------------------------------------------

                db.cmd.CommandText = "[Catalog].[sp_GetAVGRatioByProductID]";
                db.cmd.CommandType = CommandType.StoredProcedure;
                db.cmd.Parameters.Clear();
                db.cmd.Parameters.AddWithValue("@ProductID", ProductId);

                int intNewRatioValue = SQLDataHelper.GetInt(db.cmd.ExecuteScalar());
                ThaiRating.CurrentRating = intNewRatioValue;


                //--------------------------------------------------

                db.cmd.CommandText = "[Catalog].[sp_UpdateProductRatio]";
                db.cmd.CommandType = CommandType.StoredProcedure;
                db.cmd.Parameters.Clear();
                db.cmd.Parameters.AddWithValue("@ProductID", ProductId);
                db.cmd.Parameters.AddWithValue("@Ratio", intNewRatioValue);

                db.cmd.ExecuteNonQuery();

                db.cnClose();
            }

            ThaiRating.ReadOnly   = true;
            lblRatingInfo.Visible = true;
            lblRatingInfo.Text    = Resources.Resource.Client_Details_YourVoiceTaken;
        }
        catch (Exception ex)
        {
            //Debug.LogError(ex, sender, e);
            Debug.LogError(ex);
        }
    }
Beispiel #21
0
 protected void RatingKnowledge_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
Beispiel #22
0
 protected void RatingOrderliness_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
 protected void RatingChanged(object sender, RatingEventArgs e)
 {
     int    ProductID = int.Parse(e.Tag);
     string Rate      = e.Value;
 }
 protected void Rating4_Changed(object sender, RatingEventArgs e)
 {
     e.CallbackResult = ((Rating)sender).ID + ";" + e.Value + ";" + e.Tag;
 }
Beispiel #25
0
 protected void Rating_AbsErro_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
Beispiel #26
0
 protected void RatingReliability_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
Beispiel #27
0
 protected void RatingAttendance_Changed(object sender, RatingEventArgs e)
 {
     Thread.Sleep(400);
 }
Beispiel #28
0
 protected void Rating_Set(object sender, RatingEventArgs args)
 {
     ViewState[RATINGKEY] = args.Value;
 }
Beispiel #29
0
 protected void Rating1_Click(object sender, RatingEventArgs e)
 {
 }
 protected void OnRatingChanged(object sender, RatingEventArgs e)
 {
     hfRating.Value = e.Value;
     Response.Write("<script>alert('Thank You...For giving us Rating')</script>");
 }