Beispiel #1
0
        protected void Handle_Click(object sender, EventArgs e)
        {
            mSurveyData = (Review_Data)Session["survey"];
            RadioButtonList rbl = (RadioButtonList)sender;
            String          RadioButtonListID = rbl.ID;        // Comfort, Noise, etc...
            int             a         = 0;
            String          selection = rbl.SelectedItem.Text; // Poor, Fair, etc..
            Survey_Criteria criteria  = StringToEnum(RadioButtonListID);
            Qualifier       q         = StringToQualifier(selection);

            try
            {
                mSurveyData.Add(criteria, q);
            } catch (Exception ex) {; }

            ListItem li  = FlightSelection.SelectedItem;
            String   msg = "";

            if (li != null)
            {
                msg        = li.Text;
                mLastError = msg;
            }
            Session["survey"] = mSurveyData;
            if (mSurveyData.Count == 5) // we are ready to submit our data
            {
                Session[SURVEY_READY_FOR_SUBMISSION] = true;
            }
            else
            {
                Session[SURVEY_READY_FOR_SUBMISSION] = false;
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)   // if the page is loading for the first time
                                    // do the GUI initialization there

            {
                mSurveyData          = new Review_Data();
                Session[SURVEY_DATA] = mSurveyData;

                String connection_params = "Data Source=localhost;Database=flights;User Id=root;Password=\"\";SSL Mode=None";
                mConnection = new MySqlConnection(connection_params);
                mConnection.Open();
                String       query = "SELECT * FROM details";
                MySqlCommand cmd   = new MySqlCommand(query, mConnection);
                using (MySqlDataReader rdr = cmd.ExecuteReader())
                {
                    int count = 1;
                    if (rdr.Read())
                    {
                        do
                        {
                            int      a1 = (int)rdr["flight_number"];
                            String   s2 = (String)rdr["airline_code"];
                            DateTime s3 = (DateTime)rdr["departure_time"];
                            DateTime s4 = (DateTime)rdr["arrival_time"];
                            String   s5 = (String)rdr["departure"];
                            String   s6 = (String)rdr["arrival"];

                            String entry = Convert.ToString(a1);
                            entry += " - " + s2;
                            entry += " - " + s3;
                            entry += " - " + s4;
                            entry += " - " + s5;
                            entry += " - " + s6;

                            ListItem li = new ListItem();
                            li.Text = entry;
                            String background_color = "grey";
                            if (count % 2 == 0)
                            {
                                background_color = "coral";
                            }
                            li.Attributes.CssStyle.Add("background-color", background_color);
                            count++;
                            FlightSelection.Items.Add(li);
                        } while (rdr.Read());
                    }
                }
                List <RadioButtonList> lst = new List <RadioButtonList>();
                lst.Add(R_Cleanliness);
                lst.Add(R_Comfort);
                lst.Add(R_Friendliness);
                lst.Add(R_Noise);
                lst.Add(R_Space);

                for (int i = 0; i < NUMBER_OF_RADIOBUTTON_LISTS; i++)
                {
                    lst[i].Items.Add("No Opinion");
                    lst[i].Items.Add("Poor");
                    lst[i].Items.Add("Fair");
                    lst[i].Items.Add("Good");
                    lst[i].Items.Add("Excellent");
                    //lst[i].SelectedIndexChanged += new EventHandler(Handle_Click);
                }
            }
        }