public string getCategoryTitle(int category_id) { SqlConnection conn = new SqlConnection(ConnectionString); SurveyDB db = new SurveyDB(); Survey survey = db.getCurrentSurvey(); string sql = "SELECT ctext FROM user_survey_category WHERE id = @id"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 4)); cmd.Parameters["@id"].Value = category_id; try { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); string name = ""; while (reader.Read()) name = (string)reader["ctext"]; reader.Close(); return name; } catch { throw new Exception(); } finally { conn.Close(); } }
/// <summary> /// Handles the Click event of the AddQuestionBtn control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void AddQuestionBtn_Click(object sender, EventArgs e) { // Determine the TypeOption string TypeOption; if (RdBtnRadio.Checked) { TypeOption = "RD"; } else { TypeOption = "CH"; } // new question go to the end of the list QuestionItem t = new QuestionItem(); t.QuestionName = txtNewQuestion.Text; t.QuestionID = -1; t.QuestionOrder = 999; portalQuestion.Add(t); // write tab to database SurveyDB NewQuestion = new SurveyDB(); t.QuestionID = NewQuestion.AddQuestion(ModuleID, t.QuestionName, t.QuestionOrder, TypeOption); // Reset the order numbers for the tabs within the list OrderQuestions(); // Redirect to edit page Response.Redirect(Request.RawUrl); }
//private void AddOptionBtn_Click( System.object sender, System.EventArgs e) AddOptionBtn.Click { /// <summary> /// Handles the Click event of the AddOptionBtn control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void AddOptionBtn_Click(object sender, EventArgs e) { // Determine QuestioID int QuestionID = 0; // get { QuestionID from querystring if (!(Request.Params["QuestionID"] == null)) { QuestionID = int.Parse(Request.Params["QuestionID"]); } // new option go to the end of the list OptionItem o = new OptionItem(); o.OptionName = TxtNewOption.Text; o.OptionID = -1; o.OptionOrder = 999; portalOption.Add(o); // write tab to database SurveyDB NewOption = new SurveyDB(); o.OptionID = NewOption.AddOption(QuestionID, o.OptionName, o.OptionOrder); // Reset the order numbers for the tabs within the list OrderOptions(); // Redirect to edit page Response.Redirect(Request.RawUrl); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // Set the ImageUrl for controls from current Theme upBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl; downBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl; deleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl; } //TBD: Create a sproc that gets these fields: //CreatedBy.Text = (string) dr["CreatedByUser"]; //CreatedDate.Text = ((DateTime) dr["CreatedDate"]).ToShortDateString(); // get { QuestionID from querystring if (!(Request.Params["QuestionID"] == null)) { int QuestionID = 0; QuestionID = int.Parse(Request.Params["QuestionID"]); SurveyDB OptList = new SurveyDB(); SqlDataReader OList = OptList.GetOptionList(QuestionID); try { while (OList.Read()) { OptionItem o = new OptionItem(); o.OptionName = OList["OptionDesc"].ToString(); o.OptionID = (int)OList["OptionID"]; o.OptionOrder = (int)OList["ViewOrder"]; portalOption.Add(o); } } finally { OList.Close(); //by Manu, fixed bug 807858 } if (!Page.IsPostBack) { OptionList.DataTextField = "OptionName"; OptionList.DataValueField = "OptionID"; OptionList.DataSource = portalOption; OptionList.DataBind(); lblQuestion.Text = Request.Params["Question"]; if (Request.Params["TypeOption"] == "RD") { lblTypeOption.Text = General.GetString("SURVEY_RADIOBUTTONS", "Radio buttons", this); } else { lblTypeOption.Text = General.GetString("SURVEY_CHECKBOXES", "Checkboxes", this); } } } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // Set the ImageUrl for controls from current Theme upBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl; downBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl; editBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl; deleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl; } //********************************************************* // Checks whether the survey exist, if not it creates one //********************************************************* SurveyDB SurveyCheck = new SurveyDB(); // puts the desc of Survey in the title lblDescSurvey.Text = SurveyCheck.ExistAddSurvey(ModuleID, PortalSettings.CurrentUser.Identity.Email); //TBD: Create a sproc that gets these fields: //CreatedBy.Text = (string) dr["CreatedByUser"]; //CreatedDate.Text = ((DateTime) dr["CreatedDate"]).ToShortDateString(); // Fill the Question Listbox SurveyDB QuestionList = new SurveyDB(); SqlDataReader QList = QuestionList.GetQuestionList(ModuleID); try { while (QList.Read()) { QuestionItem t = new QuestionItem(); t.QuestionName = QList["Question"].ToString(); t.QuestionID = (int)QList["QuestionID"]; t.QuestionOrder = (int)QList["ViewOrder"]; t.TypeOption = QList["TypeOption"].ToString(); portalQuestion.Add(t); } } finally { QList.Close(); //by Manu, fixed bug 807858 } // if ( this is the first visit to the page, bind the tab data to the page listbox if (Page.IsPostBack == false) { this.QuestionList.DataTextField = "QuestionName"; this.QuestionList.DataValueField = "QuestionID"; this.QuestionList.DataSource = portalQuestion; this.QuestionList.DataBind(); } }
/// <summary> /// Handles the Click event of the SubmitButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> public void SubmitButton_Click(object sender, EventArgs e) { Array ArrRadioButton = (Array)ViewState["arrRadioButton"]; Array ArrCheckButton = (Array)ViewState["arrCheckButton"]; int MaxRdIndex = (int)ViewState["MaxRdIndex"]; Array arrRadioQuestionID = (Array)ViewState["arrRadioQuestionID"]; Array arrRadioOptionID = (Array)ViewState["arrRadioOptionID"]; int MaxChIndex = (int)ViewState["MaxChIndex"]; Array arrCheckQuestionID = (Array)ViewState["arrCheckQuestionID"]; Array arrCheckOptionID = (Array)ViewState["arrCheckOptionID"]; for (int i = 1; i <= MaxRdIndex; i++) { RadioButton RadioButtonID = new RadioButton(); RadioButtonID = (RadioButton)SurveyHolder.Controls[((int)(ArrRadioButton.GetValue(i))) - 1]; if (RadioButtonID.Checked) { // get { The QuestionID and OptionID int QuestionID = (int)arrRadioQuestionID.GetValue(i); int OptionID = (int)arrRadioOptionID.GetValue(i); int SurveyID = (int)ViewState["SurveyID"]; SurveyDB AddAnswer = new SurveyDB(); AddAnswer.AddAnswer(SurveyID, QuestionID, OptionID); } } for (int j = 1; j <= MaxChIndex; j++) { CheckBox CheckButtonID = new CheckBox(); CheckButtonID = (CheckBox)SurveyHolder.Controls[((int)(ArrCheckButton.GetValue(j))) - 1]; if (CheckButtonID.Checked) { int QuestionID = (int)arrCheckQuestionID.GetValue(j); int OptionID = (int)arrCheckOptionID.GetValue(j); int SurveyID = (int)ViewState["SurveyID"]; SurveyDB AddAnswer = new SurveyDB(); AddAnswer.AddAnswer(SurveyID, QuestionID, OptionID); } } // Store a cookie to show the chart after the submit string CookieName = "Survey" + ModuleID.ToString(); Response.Cookies[CookieName].Value = ViewState["SurveyID"].ToString(); Response.Cookies[CookieName].Expires = DateTime.Now.AddDays(VoteDayPeriod); Response.Redirect(ViewState["URL"].ToString()); }
//******************************************************* // // The DeleteBtn_Click server event handler is used to delete // the selected question // //******************************************************* /// <summary> /// Handles the Click event of the DeleteBtn control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param> protected void DeleteBtn_Click(object sender, ImageClickEventArgs e) { if (QuestionList.SelectedIndex != -1) { // must delete from database too QuestionItem t = (QuestionItem)portalQuestion[QuestionList.SelectedIndex]; SurveyDB DelQuestion = new SurveyDB(); DelQuestion.DelQuestion(t.QuestionID); // remove item from list portalQuestion.RemoveAt(QuestionList.SelectedIndex); // reorder list OrderQuestions(); // Redirect to this site to refresh Response.Redirect(Request.RawUrl); } }
/// <summary> /// Handles the Click event of the deleteBtn control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param> protected void deleteBtn_Click(object sender, ImageClickEventArgs e) { OptionItem o; o = (OptionItem)portalOption[OptionList.SelectedIndex]; SurveyDB DelOpt = new SurveyDB(); DelOpt.DelOption(o.OptionID); // remove item from list portalOption.RemoveAt(OptionList.SelectedIndex); // reorder list OrderOptions(); // Redirect to this site to refresh Response.Redirect(Request.RawUrl, false); }
//******************************************************* // // The OrderQuestions helper method is used to reset the display // order for the questions // //*******************************************************// /// <summary> /// Orders the questions. /// </summary> private void OrderQuestions() { int i = 1; // sort the arraylist portalQuestion.Sort(); // renumber the order and save to database foreach (QuestionItem t in portalQuestion) { // number the items 1, 3, 5, etc. to provide an empty order // number when moving items up and down in the list. t.QuestionOrder = i; i += 2; // rewrite tab to database SurveyDB Order = new SurveyDB(); Order.UpdateQuestionOrder(t.QuestionID, t.QuestionOrder); } // t }
public List<Category> getListOfCategories() { SqlConnection conn = new SqlConnection(ConnectionString); SurveyDB db = new SurveyDB(); Survey survey = db.getCurrentSurvey(); string sql = "SELECT * FROM user_survey_category WHERE (survey_id = @surveyid) ORDER BY cnum ASC"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add(new SqlParameter("@surveyid", SqlDbType.Int, 4)); cmd.Parameters["@surveyid"].Value = survey.SurveyID; List<Category> categories = new List<Category>(); try { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Category cat = new Category((int)reader["id"], (int)reader["cnum"], (string)reader["ctext"], (int)reader["survey_id"], (int)reader["is_order"]); categories.Add(cat); } reader.Close(); return categories; } catch(Exception e) { throw new Exception(e.Message); } finally { conn.Close(); } }
public static UserAuthorizationResponse AuthenticateUser(UserAuthorizationDomain oUserAuthorizationDomain) { MySqlCommand command = null; UserAuthorizationResponse oUserAuthorizationResponse = new UserAuthorizationResponse(); try { #region "Validate User" using (command = SurveyDB.GetStoredProcCommand("PRC_Authenticate_User")) { //command.CommandType = CommandType.StoredProcedure; MySqlParameter userNameParameter = new MySqlParameter(); userNameParameter.ParameterName = "pi_username"; userNameParameter.Value = oUserAuthorizationDomain.userName; userNameParameter.MySqlDbType = MySqlDbType.VarChar; userNameParameter.Size = 100; userNameParameter.Direction = System.Data.ParameterDirection.Input; command.Parameters.Add(userNameParameter); MySqlParameter passwordParameter = new MySqlParameter(); passwordParameter.ParameterName = "pi_password"; passwordParameter.Value = oUserAuthorizationDomain.userPassword; passwordParameter.MySqlDbType = MySqlDbType.VarChar; passwordParameter.Size = 100; passwordParameter.Direction = System.Data.ParameterDirection.Input; command.Parameters.Add(passwordParameter); MySqlParameter tokenParameter = new MySqlParameter(); tokenParameter.ParameterName = "pi_token"; tokenParameter.Value = oUserAuthorizationDomain.token; tokenParameter.MySqlDbType = MySqlDbType.VarChar; tokenParameter.Size = 100; tokenParameter.Direction = System.Data.ParameterDirection.Input; command.Parameters.Add(tokenParameter); MySqlParameter imeiParameter = new MySqlParameter(); imeiParameter.ParameterName = "pi_imei"; imeiParameter.Value = oUserAuthorizationDomain.imei; imeiParameter.MySqlDbType = MySqlDbType.VarChar; imeiParameter.Size = 30; imeiParameter.Direction = System.Data.ParameterDirection.Input; command.Parameters.Add(imeiParameter); MySqlParameter iccidParameter = new MySqlParameter(); iccidParameter.ParameterName = "pi_iccid"; iccidParameter.Value = oUserAuthorizationDomain.iccid; iccidParameter.MySqlDbType = MySqlDbType.VarChar; iccidParameter.Size = 30; iccidParameter.Direction = System.Data.ParameterDirection.Input; command.Parameters.Add(iccidParameter); MySqlParameter poMsgParameter = new MySqlParameter(); poMsgParameter.ParameterName = "po_msg"; poMsgParameter.MySqlDbType = MySqlDbType.VarChar; iccidParameter.Size = 10; poMsgParameter.Direction = System.Data.ParameterDirection.Output; command.Parameters.Add(poMsgParameter); SurveyDB.ExecuteNonQuery(command); if (command.Parameters["po_msg"].Value.ToString().ToLower() == "true") { oUserAuthorizationResponse.isUserAuthenticated = true; oUserAuthorizationResponse.token = Guid.NewGuid().ToString(); } else if (command.Parameters["po_result"].Value.ToString().ToLower() == "false") { oUserAuthorizationResponse.isUserAuthenticated = false; oUserAuthorizationResponse.token = ""; } else { oUserAuthorizationResponse.isUserAuthenticated = false; oUserAuthorizationResponse.token = ""; } } #endregion } catch (Exception ex) { oUserAuthorizationResponse.isUserAuthenticated = false; //entity.Message = ex.Message; } finally { DisposeCommand(command); } return(oUserAuthorizationResponse); }
public bool isOrderedCategory(int category_num) { SqlConnection conn = new SqlConnection(ConnectionString); SurveyDB db = new SurveyDB(); Survey survey = db.getCurrentSurvey(); string sql = "SELECT cnum FROM user_survey_category WHERE (is_order = 1) and (survey_id = @surveyid) and (cnum = @cnum)"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add(new SqlParameter("@surveyid", SqlDbType.Int, 4)); cmd.Parameters["@surveyid"].Value = survey.SurveyID; cmd.Parameters.Add(new SqlParameter("@cnum", SqlDbType.Int, 4)); cmd.Parameters["@cnum"].Value = category_num; try { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); bool is_order = false; if (reader.Read()) is_order = true; reader.Close(); return is_order; } catch { throw new Exception(); } finally { conn.Close(); } }
public int getValidID(int category_num) { SqlConnection conn = new SqlConnection(ConnectionString); SurveyDB db = new SurveyDB(); Survey survey = db.getCurrentSurvey(); string sql = "SELECT id FROM user_survey_category WHERE (survey_id = @surveyid) and (cnum = @cnum)"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add(new SqlParameter("@surveyid", SqlDbType.Int, 4)); cmd.Parameters["@surveyid"].Value = survey.SurveyID; cmd.Parameters.Add(new SqlParameter("@cnum", SqlDbType.Int, 4)); cmd.Parameters["@cnum"].Value = category_num; try { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); int valid_id = -1; while (reader.Read()) valid_id = (int)reader["id"]; reader.Close(); return valid_id; } catch { throw new Exception(); } finally { conn.Close(); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { test = int.Parse(Settings["Test"].ToString()); VoteDayPeriod = int.Parse(Settings["VoteDayPeriod"].ToString()); // Creation of the Survey - Begin // It uses cookies to find out whether the user has already done it string CookieName = "Survey" + ModuleID.ToString(); if (test == 1) { CookieName += "Test"; } if (Request.Cookies[CookieName] == null) { // Finds the dimension of the arrays SurveyDB DimArray = new SurveyDB(); int DimArrRadio = DimArray.GetDimArray(ModuleID, "RD"); DimArrRadio = DimArrRadio + 1; int DimArrCheck = DimArray.GetDimArray(ModuleID, "CH"); DimArrCheck = DimArrCheck + 1; // Declaration of the ARRAYS Array ArrRadioButton = Array.CreateInstance(typeof(Int32), DimArrRadio); Array ArrCheckButton = Array.CreateInstance(typeof(Int32), DimArrCheck); Array arrRadioQuestionID = Array.CreateInstance(typeof(Int32), DimArrRadio); Array arrRadioOptionID = Array.CreateInstance(typeof(Int32), DimArrRadio); Array arrCheckQuestionID = Array.CreateInstance(typeof(Int32), DimArrCheck); Array arrCheckOptionID = Array.CreateInstance(typeof(Int32), DimArrCheck); // Indexes of the Arrays int i = 0; int j = 0; int ControlIndex = 0; if (SurveyHolder.Controls.Count > 0) { ControlIndex = SurveyHolder.Controls.Count; } SurveyDB Questions = new SurveyDB(); SqlDataReader result = Questions.GetQuestions(ModuleID); bool FirstTime = true; int GroupQuestionPrev = 0; bool GetSurveyID = true; try { while (result.Read()) // Reads the list one-by-one { if (GetSurveyID) { ViewState["SurveyID"] = (int)result["SurveyID"]; GetSurveyID = false; } if (!FirstTime) { if (GroupQuestionPrev != (int)result["QuestionID"]) { Label lbl = new Label(); lbl.Visible = true; lbl.Text = "<br />" + result["Question"].ToString(); lbl.CssClass = "SurveyQuestion"; SurveyHolder.Controls.Add(lbl); ControlIndex = ControlIndex + 1; SurveyHolder.Controls.Add(new LiteralControl("<br /><br />")); ControlIndex = ControlIndex + 1; GroupQuestionPrev = (int)result["QuestionID"]; } } else { Label lbl = new Label(); lbl.Visible = true; lbl.Text = "<br />" + result["Question"].ToString(); lbl.CssClass = "SurveyQuestion"; SurveyHolder.Controls.Add(lbl); ControlIndex = ControlIndex + 1; SurveyHolder.Controls.Add(new LiteralControl("<br /><br />")); ControlIndex = ControlIndex + 1; GroupQuestionPrev = (int)result["QuestionID"]; FirstTime = false; } // Finds the Type of Option if (result["TypeOption"].ToString() == "RD") { i++; RadioButton RdButton = new RadioButton(); RdButton.ID = "RdButton_" + i.ToString(); RdButton.GroupName = "Option_" + GroupQuestionPrev.ToString(); RdButton.Text = result["OptionDesc"].ToString(); RdButton.CssClass = "SurveyOption"; SurveyHolder.Controls.Add(RdButton); ControlIndex = ControlIndex + 1; // Save RadioButton position ArrRadioButton.SetValue(ControlIndex, i); arrRadioQuestionID.SetValue((int)result["QuestionID"], i); arrRadioOptionID.SetValue((int)result["OptionID"], i); // Adds a Literal SurveyHolder.Controls.Add(new LiteralControl("<br>")); ControlIndex = ControlIndex + 1; } else { j++; ; CheckBox ChButton = new CheckBox(); ChButton.ID = "ChButton_" + j.ToString(); ChButton.Text = result["OptionDesc"].ToString(); ChButton.CssClass = "SurveyOption"; SurveyHolder.Controls.Add(ChButton); ControlIndex++; // Saves Checkbox position ArrCheckButton.SetValue(ControlIndex, j); arrCheckQuestionID.SetValue((int)result["QuestionID"], j); arrCheckOptionID.SetValue((int)result["OptionID"], j); // Adds a literal SurveyHolder.Controls.Add(new LiteralControl("<br>")); ControlIndex++; } } } finally { result.Close(); //by Manu, fixed bug 807858 } // Checks whether the Survey exist SurveyDB SurveyCheck = new SurveyDB(); int RowCount = 0; RowCount = SurveyCheck.ExistSurvey(ModuleID); if (RowCount > 0) { SurveyHolder.Controls.Add(new LiteralControl("<br />")); ControlIndex = ControlIndex + 1; SubmitButton = new LinkButton(); SubmitButton.ID = "Submit"; SubmitButton.Text = General.GetString("SURVEY_SUBMIT", "Submit", this); SubmitButton.CssClass = "SurveyButton"; SurveyHolder.Controls.Add(SubmitButton); SubmitButton.Click += new EventHandler(SubmitButton_Click); } ViewState["arrRadioButton"] = ArrRadioButton; ViewState["arrRadioQuestionID"] = arrRadioQuestionID; ViewState["arrRadioOptionID"] = arrRadioOptionID; ViewState["MaxRdIndex"] = i; ViewState["arrCheckButton"] = ArrCheckButton; ViewState["arrCheckQuestionID"] = arrCheckQuestionID; ViewState["arrCheckOptionID"] = arrCheckOptionID; ViewState["MaxChIndex"] = j; ViewState["URL"] = Request.Url.AbsoluteUri; } else { // Creation of Chart Survey - Begin int SurveyID = int.Parse(Request.Cookies[CookieName].Value); SurveyDB Answers = new SurveyDB(); SqlDataReader result = Answers.GetAnswers(SurveyID); bool FirstTime = true; int GroupQuestionPrev = 0; int tot = 0; float perc; try { while (result.Read()) // Reads the list one-by-one { if (!FirstTime) // Shows the Question { if (GroupQuestionPrev != (int)result["QuestionID"]) { Label lbl = new Label(); lbl.Visible = true; lbl.Text = result["Question"].ToString(); lbl.CssClass = "SurveyQuestion"; SurveyHolder.Controls.Add(lbl); SurveyHolder.Controls.Add(new LiteralControl("<br /><br />")); GroupQuestionPrev = (int)result["QuestionID"]; tot = GetTotAnswer(SurveyID, GroupQuestionPrev); // get the tot } } else { Label lbl = new Label(); lbl.Visible = true; lbl.Text = result["Question"].ToString(); lbl.CssClass = "SurveyQuestion"; SurveyHolder.Controls.Add(lbl); SurveyHolder.Controls.Add(new LiteralControl("<br /><br />")); GroupQuestionPrev = (int)result["QuestionID"]; FirstTime = false; tot = GetTotAnswer(SurveyID, GroupQuestionPrev); } if (tot == 0) { perc = 0; } else { perc = (float.Parse(result["Num"].ToString()) / (float)tot) * 100; } // Shows the AnswerOptions Panel Pan = new Panel(); Pan.CssClass = "SurveyPanel"; Pan.Visible = true; Pan.Width = Unit.Percentage(perc); SurveyHolder.Controls.Add(Pan); Label lblOptDesc = new Label(); lblOptDesc.Visible = true; lblOptDesc.Text = result["OptionDesc"].ToString() + " " + perc.ToString("0") + "% " + result["Num"].ToString() + " " + General.GetString("SURVEY_VOTES", "votes", this) + "<br />"; lblOptDesc.CssClass = "SurveyOption"; SurveyHolder.Controls.Add(lblOptDesc); SurveyHolder.Controls.Add(new LiteralControl("<br />")); } } finally { result.Close(); //by Manu, fixed bug 807858 } } }