protected void ButtonAddPollQuestion_Click(object sender, EventArgs e) { PollQuestionDb pq = new PollQuestionDb() { PollQuestion = this.add_TextBoxPollQuestion.Text }; this.GridViewPolls.DataSource = OperationManager.Singleton.izvrsiOperaciju(new OpPollInsertOnlyQuestion() { PollQuestion = pq }).DbItems.Cast <PollQuestionDb>().ToArray(); this.GridViewPolls.DataBind(); }
protected void ButtonUpdatePollQuestion_Click(object sender, EventArgs e) { PollQuestionDb pq = new PollQuestionDb() { IdPollQuestion = Convert.ToInt32(this.LabelPollQuestionId.Text), PollQuestion = this.tbPollQuestion.Text }; this.GridViewPolls.DataSource = OperationManager.Singleton.izvrsiOperaciju(new OpPollUpdateOnlyQuestion() { PollQuestion = pq }).DbItems.Cast <PollQuestionDb>().ToArray(); this.GridViewPolls.DataBind(); }
protected void btnDeletePoll_Click(object sender, EventArgs e) { Button btn = (Button)sender; PollQuestionDb pq = new PollQuestionDb() { IdPollQuestion = Convert.ToInt32(btn.CommandArgument) }; this.GridViewPolls.DataSource = OperationManager.Singleton.izvrsiOperaciju(new OpPollDeleteQuestion() { PollQuestion = pq }).DbItems.Cast <PollQuestionDb>().ToArray(); this.GridViewPolls.DataBind(); this.PanelShowData.Visible = false; }
protected void Add_Click(object sender, EventArgs e) { PollAnswersDb ans = new PollAnswersDb() { PollAnswer = this.tbAddPollAnswer.Text }; PollQuestionDb pq = new PollQuestionDb() { IdPollQuestion = Convert.ToInt32(this.LabelPollQuestionId.Text) }; this.DropDownListPollAnswers.DataSource = OperationManager.Singleton.izvrsiOperaciju(new OpPollInsertOnlyAnswer() { Answer = ans, PollQuestion = pq }).DbItems.Cast <PollAnswersDb>().ToArray(); this.DropDownListPollAnswers.DataTextField = "PollAnswer"; this.DropDownListPollAnswers.DataValueField = "IdPollAnswer"; this.DropDownListPollAnswers.DataBind(); }
protected void tbDeletePollAnswer_Click(object sender, EventArgs e) { PollAnswersDb ans = new PollAnswersDb() { IdPollAnswer = Convert.ToInt32(this.DropDownListPollAnswers.SelectedValue) }; PollQuestionDb pq = new PollQuestionDb() { IdPollQuestion = Convert.ToInt32(this.LabelPollQuestionId.Text) }; this.DropDownListPollAnswers.DataSource = OperationManager.Singleton.izvrsiOperaciju(new OpPollDeleteOnlyAnswer() { Answer = ans, PollQuestion = pq }).DbItems.Cast <PollAnswersDb>().ToArray(); this.DropDownListPollAnswers.DataTextField = "PollAnswer"; this.DropDownListPollAnswers.DataValueField = "IdPollAnswer"; this.DropDownListPollAnswers.DataBind(); if (this.DropDownListPollAnswers.Items.Count > 0) { this.tbPollAnswerUpdate.Text = this.DropDownListPollAnswers.Items[0].Text; } }