Example #1
0
        private void rateButton_Click(object sender, EventArgs e)
        {
            RateWindow rateWindow = new RateWindow(this.product);

            rateWindow.ShowDialog();
            this.ratingLabel.Text = string.Format("{0:0.0} ", this.product.Rating) + this.ratingLabel.Text;
        }
Example #2
0
        public async Task Accept()
        {
            string     rating = "";
            RateWindow win    = new RateWindow();

            win.ShowDialog();
            rating = win.Rating;

            BuyOfferDto bOffer = new BuyOfferDto();

            bOffer.Id        = 0;
            bOffer.BuyerId   = _authenticationUser.UserId;
            bOffer.Price     = (decimal?)SelectedOffer.Price;
            bOffer.Amount    = SelectedOffer.Amount;
            bOffer.Name      = "a";
            bOffer.ProductId = SelectedOffer.ProductId;
            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                SellOfferDto   sellOffer   = createOffer(SelectedOffer);
                TransactionDto transaction = new TransactionDto();
                transaction.BuyOffer  = bOffer;
                transaction.SellOffer = sellOffer;
                if (rating == "")
                {
                    transaction.Rating = null;
                }
                else
                {
                    transaction.Rating = Convert.ToInt32(rating);
                }
                var json     = Newtonsoft.Json.JsonConvert.SerializeObject(transaction);
                var url      = new URLBuilder("/AcceptSellTransaction/");
                var request2 = new HttpRequestMessage()
                {
                    RequestUri = new Uri(url.URL),
                    Method     = HttpMethod.Post,
                    Content    = new StringContent(json,
                                                   Encoding.UTF8,
                                                   "application/json")
                };
                request2.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", _authenticationUser.UserId.ToString(), _authenticationUser.Password))));
                var response = await client.SendAsync(request2);

                if (!response.IsSuccessStatusCode)
                {
                    ErrorString = (string)Application.Current.FindResource("TransactionError");
                    return;
                }
                Offers.Remove(SelectedOffer);
            }
        }
Example #3
0
 public Rating Initialize()
 {
     _viewModel = new RateWindowViewModel
     {
         RateCommand   = new RelayCommand(ExecuteRateCommand),
         CancelCommand = new RelayCommand(ExecuteCancelCommand)
     };
     View = new RateWindow {
         DataContext = _viewModel
     };
     View.ShowDialog();
     return(_viewModel.Rating);
 }
Example #4
0
        /// <summary>
        /// Corresponde a la funcion que cumple el boton Rate.
        /// </summary>
        /// <param name="sender">parametro requerido para el correcto funcionamiento del evento.</param>
        /// <param name="e">parametro requerido para el correcto funcionamiento del evento.</param>
        private void RateButtonCallback(object sender, System.EventArgs e)
        {
            if (chatting == true)
            {
                richTextBox1.Text += "No puede evaluar si existe una conversacion en curso.\n";
                return;
            }
            rate = 0;

            RateWindow window       = new RateWindow();
            var        dialogResult = window.ShowDialog();

            InputOutput.SaveRatings(rate);
        }
Example #5
0
    public static RateWindow Init()
    {
        RateWindow window = EditorWindow.GetWindow <RateWindow>(true, "Thank you!", true);

        return(window);
    }