private void btnSubmit_Click(object sender, EventArgs e)
        {
            RatingModel r = new RatingModel();

            r.Name  = txtBoxCustomerName.Text;
            r.Email = txtBoxEmail.Text;
            r.Phone = txtBoxContactNumber.Text;
            var time = DateTime.Now;

            r.RatedTime = time;
            r.criterias = new Dictionary <string, string>();
            foreach (Control c in this.pnlReview.Controls)
            {
                if (c is ComboBox)
                {
                    ComboBox cb  = c as ComboBox;
                    ComboBox cdv = (ComboBox)this.pnlReview.Controls.Find(cb.Name, true)[0];

                    r.criterias.Add(cdv.Name, cdv.Text);
                }
            }

            /*
             * if (txtBoxCustomerName.Text == "Optional")
             * {
             *  txtBoxCustomerName.Text = "";
             * }
             * if (txtBoxEmail.Text == "Optional")
             * {
             *  txtBoxEmail.Text = "";
             * }
             * if (txtBoxContactNumber.Text == "Optional")
             * {
             *  txtBoxContactNumber.Text = "";
             * }
             */
            string flag = r.SaveReview(r);

            if (flag == "success")
            {
                MessageBox.Show("Thank you!!! For your feedbacks");
            }
        }
Ejemplo n.º 2
0
        private void BindReviewGrid()
        {
            RatingModel        obj        = new RatingModel();
            List <RatingModel> listRating = obj.List();
            DataTable          dt         = Utility.ConvertToDynamicDataTable(listRating);
            //dataGridView2.DataSource = dt;

            var chartData = from x in dt.AsEnumerable()
                            group x by x.Field <String>("Cleanliness") into y
                            select new
            {
                Food  = y.Key,
                Count = y.Count()
            };
            var lstChart = chartData.ToList();
            var d        = Utility.ConvertToDataTable(lstChart);

            BindChart(d);
        }