Exemple #1
0
 public Beach(BeachOpinion bo)
 {
     name     = bo.name;
     location = bo.location;
     AddOpinion(bo);
     if (onBeachAdded != null)
     {
         onBeachAdded(name);
     }
 }
        /* Формат за мнение за плаж:
         * [Име]
         * [Място]
         * [Кола] [Градски транспорт] [Пеша]
         * Заведения: [код]
         * [гъстота] [замърсеност] [оценка]
         */

        private static void WriteBeachOpinion(BeachOpinion b, StreamWriter writer)
        {
            String data = String.Format("{0}\n{1}\n{2} {3} {4}\n{5}\n{6} {7} {8}\n",
                                        b.name,
                                        b.location,
                                        b.car, b.city, b.foot,
                                        b.facilities,
                                        b.density, b.polution, b.grade);

            writer.Write(data);
        }
Exemple #3
0
 public void AddOpinion(BeachOpinion bo)
 {
     if (bo.car)
     {
         nCar++;
     }
     if (bo.city)
     {
         nCity++;
     }
     if (bo.foot)
     {
         nFoot++;
     }
     facilties[bo.facilities]++;
     density.Add(bo.density);
     polution.Add(bo.polution);
     grade.Add(bo.grade);
 }
Exemple #4
0
        private void ReadBeachOpinion()
        {
            activeBO.name     = cbBeachName.Text;
            activeBO.location = tbLocation.Text;
            activeBO.car      = cbCar.Checked;
            activeBO.city     = cbBus.Checked;
            activeBO.foot     = cbFoot.Checked;

            if (rbLittle.Checked)
            {
                activeBO.facilities = 1;
            }
            else if (rbMed.Checked)
            {
                activeBO.facilities = 2;
            }
            else if (rbMany.Checked)
            {
                activeBO.facilities = 3;
            }

            try
            {
                activeBO.density  = int.Parse(cbDensity.Text);
                activeBO.polution = int.Parse(cbPolution.Text);
                activeBO.grade    = int.Parse(cbGrade.Text);

                activeBO.Register();
                activeOp.opinions.Add(activeBO);
                ClearBeach();
                activeBO = new BeachOpinion();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, e.GetType().ToString());
            }
        }