public void BindQuestion(int questionID) { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); DataSet ds = vClient.GetResult(questionID); if (ds.Tables[0].Rows.Count > 0) { questionContent.InnerText = ds.Tables[0].Rows[0]["QUESTION"].ToString(); userContent.InnerText = ds.Tables[0].Rows[0]["EMAIL"].ToString(); categoryContent.InnerText = ds.Tables[0].Rows[0]["CATEGORY"].ToString(); stronglyAgree.InnerText = ds.Tables[0].Select("ANSWER_ID = 5").Length > 0 ? ds.Tables[0].Select("ANSWER_ID = 5").Length.ToString() : "0"; agree.InnerText = ds.Tables[0].Select("ANSWER_ID = 4").Length > 0 ? ds.Tables[0].Select("ANSWER_ID = 4").Length.ToString() : "0"; nietherAgreeNorDisagree.InnerText = ds.Tables[0].Select("ANSWER_ID = 3").Length > 0 ? ds.Tables[0].Select("ANSWER_ID = 3").Length.ToString() : "0"; disagree.InnerText = ds.Tables[0].Select("ANSWER_ID = 2").Length > 0 ? ds.Tables[0].Select("ANSWER_ID = 2").Length.ToString() : "0"; stronglyDisagree.InnerText = ds.Tables[0].Select("ANSWER_ID = 1").Length > 0 ? ds.Tables[0].Select("ANSWER_ID = 1").Length.ToString() : "0"; } else { questionContent.InnerText = ""; userContent.InnerText = ""; categoryContent.InnerText = ""; stronglyAgree.InnerText = "0"; agree.InnerText = "0"; nietherAgreeNorDisagree.InnerText = "0"; disagree.InnerText = "0"; stronglyAgree.InnerText = "0"; } }
public void BindCateogry() { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); DataSet ds = vClient.GetCategory(); if (ds.Tables[0].Rows.Count > 0) { ddlCategory.Items.Clear(); ddlCategory.DataSource = ds.Tables[0]; ddlCategory.DataTextField = "NAME"; ddlCategory.DataValueField = "CATEGORY_ID"; ddlCategory.DataBind(); } }
public void BindAnswer() { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); DataSet ds = vClient.GetAnswers(); if (ds.Tables[0].Rows.Count > 0) { rbAnswerList.DataSource = ds.Tables[0]; rbAnswerList.DataTextField = "NAME"; rbAnswerList.DataValueField = "ANSWER_ID"; rbAnswerList.DataBind(); } rbAnswerList.SelectedIndex = 2; }
public void BindGridView() { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); DataSet ds = vClient.GetQuestionByUser(Convert.ToInt32(Session["SKEY"])); if (ds.Tables[0].Rows.Count > 0) { gvQuestions.DataSource = ds.Tables[0]; gvQuestions.DataBind(); } else { gvQuestions.DataBind(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); VoteServiceReference.Result votingResult = new VoteServiceReference.Result(); votingResult.CategoryID = categoryId; votingResult.QuestionID = qid; votingResult.AnswerID = Convert.ToInt32(rbAnswerList.SelectedValue); votingResult.DateCreated = DateTime.Now; votingResult.CreatedBy = Convert.ToInt32(Session["SKEY"]); votingResult.VotedFlag = "Y"; int i = vClient.InsertResponse(votingResult); if (i > 0) { Response.Redirect("dashboard.aspx"); } }
public void BindQuestion(int questionID) { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); DataSet ds = vClient.GetQuestionDetails(questionID); if (ds.Tables[0].Rows.Count > 0) { questionContent.InnerText = ds.Tables[0].Rows[0]["NAME"].ToString(); userContent.InnerText = ds.Tables[0].Rows[0]["EMAIL"].ToString(); categoryContent.InnerText = ds.Tables[0].Rows[0]["CATEGORY"].ToString(); categoryId = Convert.ToInt32(ds.Tables[0].Rows[0]["CATEGORY_ID"]); } else { questionContent.InnerText = ""; userContent.InnerText = ""; categoryContent.InnerText = ""; categoryId = 0; } }
protected void btnLogin_Click(object sender, EventArgs e) { if (ValidateData(out strValidationFailedItem, VT_Util.CRUDOperation.Select)) { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); VoteServiceReference.Login login = new VoteServiceReference.Login(); login.Email = txtEmail.Text; login.Password = txtPassword.Text; int skey = vClient.Login(login); if (skey > 0) { Session["SKEY"] = skey; Response.Redirect("dashboard.aspx"); } else { showMessage("Error", "Please provide correct username & password", VT_Util.ReturnCode.Failure); Clear(); txtEmail.Focus(); } } }
public void Voted() { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); bool response = vClient.Voted(Convert.ToInt32(Request.QueryString["qid"]), Convert.ToInt32(Session["SKEY"])); if (response == false) { infoPanel.Visible = false; panelHeadAlert.InnerText = ""; panelContentAlert.InnerText = ""; votePanel.Visible = true; } else { infoPanel.Visible = true; panelHeadAlert.InnerText = "Information..!!"; panelContentAlert.InnerText = "Your response has been submitted..!! Thank you.!!"; votePanel.Visible = false; } }
protected void btnSave_Click(object sender, EventArgs e) { if (ValidateData(out strValidationFailedItem, VT_Util.CRUDOperation.Insert)) { VoteServiceReference.VoteClient vClient = new VoteServiceReference.VoteClient("BasicHttpBinding_IVote"); VoteServiceReference.Question question = new VoteServiceReference.Question(); question.CategoryId = Convert.ToInt16(ddlCategory.Value); question.Name = txtQuestion.InnerText; question.DateCreated = DateTime.Now; question.CreatedBy = Convert.ToInt16(Session["SKEY"]); question.ExpiredFlag = "N"; int i = vClient.InsertQuestion(question); if (i > 0) { Response.Redirect("dashboard.aspx"); } else { showMessage("Error", "Please provide correct input.", VT_Util.ReturnCode.Failure); Clear(); ddlCategory.Focus(); } } }