public void bindLVQuest() { QuestAnsBAL QuestBAL = new QuestAnsBAL(); QuestAnsBE Quest = new QuestAnsBE(); DataTable dt = new DataTable(); if (txtKeyword.Text == "") { Quest.Keyword = "%"; } else { Quest.Keyword = txtKeyword.Text; } if (QuestBAL.QuickSearchList(ref dt, Quest)) { lvQuestList.DataSource = dt; lvQuestList.DataBind(); recalcNoOfPages(); } else { lvQuestList.DataSource = null; lvQuestList.DataBind(); //LoggedIn master = (LoggedIn)this.Master; //master.ShowMessage("Sorry No Records Were found", false); } }
public bool AddQuestion(QuestAnsBE QuestBE) { SqlConnection con = commonDAL.Connection(); SqlCommand cmd = new SqlCommand("Sp_QA_QuestionAdd", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Subject1", SqlDbType.VarChar).Value = QuestBE.Subject; cmd.Parameters.Add("@ShortDesc", SqlDbType.VarChar).Value = QuestBE.ShortDesc; cmd.Parameters.Add("@DetlQuestn", SqlDbType.VarChar).Value = QuestBE.DetailQuestion; cmd.Parameters.Add("@PersClass", SqlDbType.VarChar).Value = QuestBE.PersClass; cmd.Parameters.Add("@StudyStream", SqlDbType.VarChar).Value = QuestBE.StudyStream; cmd.Parameters.Add("@YrOfStudyStream", SqlDbType.VarChar).Value = QuestBE.YrsOfStudyStream; cmd.Parameters.Add("@Tags", SqlDbType.VarChar).Value = QuestBE.Tag; cmd.Parameters.Add("@LastModifiedBy", SqlDbType.VarChar).Value = QuestBE.LastModifiedBy; cmd.Parameters.Add("@OtherSubject", SqlDbType.VarChar).Value = QuestBE.OtherSubject; //con.Open(); int count =cmd.ExecuteNonQuery(); con.Close(); if (count == 1) { return true; } else { return false; } }
protected void btnAdd_Click(object sender, EventArgs e) { LoggedIn master = (LoggedIn)this.Master; QuestAnsBE Ko = new QuestAnsBE(); QuestAnsBAL KoBAL = new QuestAnsBAL(); if (ValidData()) { return; } Ko.Subject = txtSubject.Text; Ko.Tag = txtTag.Text; Ko.ShortDesc = txtShortDesc.Text; Ko.DelDesc = txtDelDesc.Text.Replace(Environment.NewLine,"<br/>"); Ko.Note = txtNote.Text.Replace(Environment.NewLine, "<br/>"); Ko.KOText = txtKOText.Text; Ko.KOType = ddlKOType.SelectedItem.Text; Ko.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; if (KoBAL.AddKO(Ko)) { foreach (Control txt in divAddKO.Controls) { if (txt is TextBox) ((TextBox)(txt)).Text = string.Empty; else if (txt is DropDownList) ((DropDownList)(txt)).SelectedIndex = 0; } master.ShowMessage("Record Added Successfully", true); } else { master.ShowMessage("Unsuccessful", false); } }
public bool GetAnswers(ref DataTable dt,QuestAnsBE Ans) { QuestAnsDAL AnsDAL=new QuestAnsDAL(); if (AnsDAL.GetAnswers(ref dt, Ans)) { return true; } else { return false; } }
public bool AddQuestion(QuestAnsBE QuestBE) { QuestAnsDAL QuestDAL = new QuestAnsDAL(); if (QuestDAL.AddQuestion(QuestBE)) { return true; } else { return false; } }
public bool GetQuestion(ref DataTable dt , QuestAnsBE Quest) { QuestAnsDAL QuestDAL = new QuestAnsDAL(); if (QuestDAL.GetQuestion(ref dt , Quest)) { return true; } else { return false; } }
public void GetAnswers() { QuestAnsBAL AnsBAL = new QuestAnsBAL(); DataTable dt = new DataTable(); QuestAnsBE Ans = new QuestAnsBE(); Ans.QuestId = Convert.ToInt32(hdnQuestId.Value); if (AnsBAL.GetAnswers(ref dt, Ans)) { this.lvAnswerList.DataSource = dt; this.lvAnswerList.DataBind(); } else { } }
public void bindLVQuest() { QuestAnsBAL QuestBAL = new QuestAnsBAL(); QuestAnsBE Quest = new QuestAnsBE(); DataTable dt = new DataTable(); if (QuestBAL.UnResolved(ref dt)) { lvQuestList.DataSource = dt; lvQuestList.DataBind(); recalcNoOfPages(); } else { //General master = (General)this.Master; //master.ShowMessage("Sorry No Records Were found", false); } }
//protected void btnBack_Click(object sender, EventArgs e) //{ // //Session["ViewKOId"] = hdnKOID.Value; // // Server.Transfer("QA_MYKO.aspx"); // Response.Redirect("~/UserMaint/LoggedInHome.aspx"); //} //this func should be ShowKO ?CV public void ShowQuestion() { QuestAnsBAL QuestBAL = new QuestAnsBAL(); DataTable dt = new DataTable(); QuestAnsBE Quest = new QuestAnsBE(); Quest.QuestId = Convert.ToInt32(hdnQuestId.Value); if (QuestBAL.GetQuestion(ref dt, Quest)) { ViewState["QuestionTable"] = dt; lblQuest.Text = dt.Rows[0]["DetlQuestn"].ToString(); // lblShortdesc.Text = dt.Rows[0]["ShortDesc"].ToString(); lblQuestpostedby.Text = dt.Rows[0]["LastModifiedBy"].ToString(); lblPostedTime.Text = dt.Rows[0]["LastModifiedAt"].ToString(); } else { } }
//am?? public bool SaveAnswerOfKO(QuestAnsBE Ans) { SqlConnection con = commonDAL.Connection(); SqlCommand cmd = new SqlCommand("Sp_QA_AddAnswerOfKO", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@QId", SqlDbType.Int).Value = Ans.QuestId; cmd.Parameters.Add("@AnsText", SqlDbType.VarChar).Value = Ans.Answer; cmd.Parameters.Add("@KO1Text", SqlDbType.VarChar).Value = Ans.KO1Text; cmd.Parameters.Add("@KO2Text", SqlDbType.VarChar).Value = Ans.KO2Text; cmd.Parameters.Add("@KO3Text", SqlDbType.VarChar).Value = Ans.KO3Text; cmd.Parameters.Add("@KO4Text", SqlDbType.VarChar).Value = Ans.KO4Text; cmd.Parameters.Add("@KO1Type", SqlDbType.VarChar).Value = Ans.KO1Type; cmd.Parameters.Add("@KO2Type", SqlDbType.VarChar).Value = Ans.KO2Type; cmd.Parameters.Add("@KO3Type", SqlDbType.VarChar).Value = Ans.KO3Type; cmd.Parameters.Add("@KO4Type", SqlDbType.VarChar).Value = Ans.KO4Type; cmd.Parameters.Add("@TotalLikes", SqlDbType.BigInt).Value = 0; cmd.Parameters.Add("@TotalDisLikes", SqlDbType.BigInt).Value = 0; cmd.Parameters.Add("@LastModifiedBy", SqlDbType.Int).Value = Ans.LastModifiedBy; //con.Open(); int count = cmd.ExecuteNonQuery(); con.Close(); if (count > 0) { return true; } else { return false; } }
public bool AddDisLike(QuestAnsBE Ans) { SqlConnection con = commonDAL.Connection(); SqlCommand cmd = new SqlCommand("Sp_QA_AddLike", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@AId", SqlDbType.BigInt).Value = Ans.AnsId; cmd.Parameters.Add("@QId", SqlDbType.BigInt).Value = Ans.QuestId; cmd.Parameters.Add("@Like", SqlDbType.Int).Value = Ans.Like; cmd.Parameters.Add("@DisLike", SqlDbType.Int).Value = Ans.DisLike; cmd.Parameters.Add("@LastModifiedBy", SqlDbType.Int).Value = Ans.LastModifiedBy; //con.Open(); int count = cmd.ExecuteNonQuery(); con.Close(); if (count > 0) { return true; } else { return false; } }
public bool SearchKO(ref DataTable dt, QuestAnsBE Quest) { QuestAnsDAL QuestDAL = new QuestAnsDAL(); if (QuestDAL.SearchKO(ref dt, Quest)) { return true; } else { return false; } }
public bool AddKO(QuestAnsBE KO) { QuestAnsDAL KODAL = new QuestAnsDAL(); if (KODAL.AddKO(KO)) { return true; } else { return false; } }
public bool AddDisLike(QuestAnsBE Ans) { QuestAnsDAL AnsDAL = new QuestAnsDAL(); if (AnsDAL.AddDisLike(Ans)) { return true; } else { return false; } }
public bool SaveAnswerOfKO(QuestAnsBE Ans) //am?? { QuestAnsDAL AnsDAL = new QuestAnsDAL(); if (AnsDAL.SaveAnswerOfKO(Ans)) { return true; } else { return false; } }
public void GetAnswersofKO() //am?? { QuestAnsBAL AnsBAL = new QuestAnsBAL(); DataTable dt = new DataTable(); QuestAnsBE Ans = new QuestAnsBE(); Ans.QuestId = Convert.ToInt32(hdnKOID.Value); //AM?? if (AnsBAL.GetAnswersofKO(ref dt, Ans)) { this.lvAnswerList.DataSource = dt; this.lvAnswerList.DataBind(); } else { } }
public bool SaveAnswer(QuestAnsBE Ans) { QuestAnsDAL AnsDAL = new QuestAnsDAL(); if (AnsDAL.SaveAnswer(Ans)) { return true; } else { return false; } }
public void bindLVQuest() { QuestAnsBAL QuestBAL = new QuestAnsBAL(); QuestAnsBE Quest = new QuestAnsBE(); DataTable dt = new DataTable(); DateTime FromDate = Convert.ToDateTime("2013/01/01"); DateTime Todate = Convert.ToDateTime("9999/01/01"); if (txtFromDate.Text == "") { Quest.FromDate = FromDate; } else { IFormatProvider culture = new CultureInfo("es-Mx", true); // Quest.FromDate = DateTime.Parse(txtFromDate.Text, culture); Quest.FromDate = DateTime.ParseExact(txtFromDate.Text + " " + ddlFromHrs.Text + ':' + ddlFromMns.Text, "dd/MM/yyyy HH:mm", culture); } if (txtToDate.Text == "") { Quest.ToDate = Todate; } else { IFormatProvider culture = new CultureInfo("es-Mx", true); //Quest.ToDate = DateTime.Parse(txtToDate.Text, culture); Quest.ToDate = DateTime.ParseExact(txtToDate.Text + " " + ddlToHrs.Text + ':' + ddlToMns.Text, "dd/MM/yyyy HH:mm", culture); } if (txtSubject.Text == "") { Quest.Subject = "%"; } else { Quest.Subject = "%" + txtSubject.Text + "%"; } if (txtTags.Text == "") { Quest.Tag = "%"; } else { Quest.Tag = "%" + txtTags.Text + "%"; } if (txtShortDesc.Text == "") { Quest.ShortDesc = "%"; } else { Quest.ShortDesc = "%" + txtShortDesc.Text + "%"; } // if (txtKeyword.Text == "") //{ // Quest.Keyword = "%"; //} //else //{ // Quest.Keyword = "%" + txtKeyword.Text + "%"; //} if (QuestBAL.SearchKO(ref dt, Quest)) { KOList.DataSource = dt; KOList.DataBind(); recalcNoOfPages(); } else { KOList.Items.Clear(); KOList.DataSource = null; KOList.DataBind(); LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("There is no data to show.", false); } }
public bool AddKO(QuestAnsBE KO) { SqlConnection con = commonDAL.Connection(); SqlCommand cmd = new SqlCommand("Sp_QA_AddKO", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Subject", SqlDbType.VarChar).Value = KO.Subject; cmd.Parameters.Add("@ShortDesc", SqlDbType.VarChar).Value = KO.ShortDesc; cmd.Parameters.Add("@DetlDesc", SqlDbType.VarChar).Value = KO.DelDesc; cmd.Parameters.Add("@KOText", SqlDbType.VarChar).Value = KO.KOText; cmd.Parameters.Add("@KOType", SqlDbType.VarChar).Value = KO.KOType; cmd.Parameters.Add("@Tag", SqlDbType.VarChar).Value = KO.Tag; cmd.Parameters.Add("@Note", SqlDbType.VarChar).Value = KO.Note; cmd.Parameters.Add("@LastModifiedBy", SqlDbType.VarChar).Value = KO.LastModifiedBy; //con.Open(); int count = cmd.ExecuteNonQuery(); con.Close(); if (count > 0) { return true; } else { return false; } }
protected void lvAnswerList_OnItemCommand(object sender, ListViewCommandEventArgs e) { QuestAnsBAL AnsBAL = new QuestAnsBAL(); QuestAnsBE Ans = new QuestAnsBE(); if (Session["LoggedInUser"] != null) { Ans.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; } else { Response.Redirect("~/Login.aspx"); } LoggedIn master = (LoggedIn)this.Master; if (String.Equals(e.CommandName, "like")) { Ans.AnsId = Convert.ToInt32(e.CommandArgument); Ans.QuestId = Convert.ToInt32(hdnQuestId.Value); Ans.Like = 1; Ans.DisLike = 0; if (AnsBAL.AddLike(Ans)) { GetAnswers(); master.ShowMessage("Successfully liked.", true); } else { master.ShowMessage("you have already liked this answer.", false); } } else if (String.Equals(e.CommandName, "dislike")) { Ans.AnsId = Convert.ToInt32(e.CommandArgument); Ans.QuestId = Convert.ToInt32(hdnQuestId.Value); Ans.Like = 0; Ans.DisLike = 1; if (AnsBAL.AddDisLike(Ans)) { GetAnswers(); master.ShowMessage("Successfully dislike.", true); } else { master.ShowMessage("you have already disliked this answer.", false); } } }
protected void btnSubmit_Onclick(object sender, EventArgs e) { LoggedIn master = (LoggedIn)this.Master; QuestAnsBAL QuestBAL = new QuestAnsBAL(); QuestAnsBE QuestBE = new QuestAnsBE(); //if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add")) //{ //am // master.ShowMessage("You are not authorised to Perform any operation on this page. Please contact system administrator.", false); // // Server.Transfer("UM_BlankPage.aspx"); //?? send Message through Query String to the BlankPage // // string cat = Request.QueryString["Message"]; // // Response.Redirect("UM_BlankPage.aspx?Message=You are not authorised to Perform any operation on this page. Please contact system administrator."); // return; //} if (ValidData()) { return; } //QuestAnsBAL QuestBAL = new QuestAnsBAL(); //am //QuestAnsBE QuestBE = new QuestAnsBE(); //am QuestBE.Subject = ddlSubject.SelectedItem.Text; if (ddlSubject.SelectedItem.Text.Equals("Other")) QuestBE.OtherSubject = txtOtherSub.Text.Trim(); else QuestBE.OtherSubject = ""; QuestBE.ShortDesc = txtShortDesc.Text; QuestBE.DetailQuestion = txtDetailQuestion.Text.Replace(Environment.NewLine, "<br />"); //am QuestBE.PersClass = txtClass.Text; QuestBE.StudyStream = "-Select-"; QuestBE.YrsOfStudyStream = "0"; QuestBE.Tag = txtTag.Text; QuestBE.LastModifiedBy = ((UserBE)(Session["LoggedInUser"])).UserId; if (QuestBAL.AddQuestion(QuestBE)) { if (ddlSubject.SelectedItem.Text.Equals("Other")) divotherSub.Visible = false; foreach (Control txt in divAddOuery.Controls) { if (txt is TextBox) ((TextBox)(txt)).Text = string.Empty; else if (txt is DropDownList) ((DropDownList)(txt)).SelectedIndex = 0; } master.ShowMessage("Your Question has been Submitted Successfully", true); } else { master.ShowMessage("Unsuccessful", false); } }
public bool GetAnswersofKO(ref DataTable dt, QuestAnsBE Ans) { SqlConnection con = commonDAL.Connection(); SqlDataAdapter da = new SqlDataAdapter("Sp_QA_GetKOAnswersById", con); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@QId", SqlDbType.Int).Value = Ans.QuestId; da.Fill(dt); if (dt.Rows.Count > 0) { return true; } else { return false; } }
public bool QuickSearchList(ref DataTable dt, QuestAnsBE Quest) { SqlConnection con = commonDAL.Connection(); SqlDataAdapter da = new SqlDataAdapter("SP_QA_GETQUICKSEARCHDATA", con); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@Keywords", SqlDbType.VarChar).Value = Quest.Keyword; da.Fill(dt); if (dt.Rows.Count > 0) { return true; } else { return false; } }
protected void btnPost_Click(object sender, EventArgs e) { QuestAnsBE Ans = new QuestAnsBE(); QuestAnsBAL AnsBAL = new QuestAnsBAL(); Ans.QuestId = Convert.ToInt32(hdnQuestId.Value); Ans.Answer = txtAns.Text.Replace(Environment.NewLine, "<br/>"); if (ddlKO1.SelectedIndex > 0) { Ans.KO1Text = KO1.Text; Ans.KO1Type = ddlKO1.SelectedItem.Text; } else { Ans.KO1Text = ""; Ans.KO1Type = ""; } if (ddlKO2.SelectedIndex > 0) { Ans.KO2Text = KO2.Text; Ans.KO2Type = ddlKO2.SelectedItem.Text; } else { Ans.KO2Text = ""; Ans.KO2Type = ""; } if (ddlKO3.SelectedIndex > 0) { Ans.KO3Text = KO3.Text; Ans.KO3Type = ddlKO3.SelectedItem.Text; } else { Ans.KO3Text = ""; Ans.KO3Type = ""; } if (ddlKO4.SelectedIndex > 0) { Ans.KO4Text = KO4.Text; Ans.KO4Type = ddlKO4.SelectedItem.Text; } else { Ans.KO4Text = ""; Ans.KO4Type = ""; } Ans.LastModifiedBy = ((UserBE)(Session["LoggedInUser"])).UserId; if (AnsBAL.SaveAnswer(Ans)) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Answer has been posted Successfully", true); GetAnswers(); } else { } }
public bool SearchKO(ref DataTable dt, QuestAnsBE Quest) { SqlConnection con = commonDAL.Connection(); SqlDataAdapter da = new SqlDataAdapter("Sp_QA_GetSearchKO", con); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@FromDate", SqlDbType.DateTime).Value = Quest.FromDate; da.SelectCommand.Parameters.Add("@ToDate", SqlDbType.DateTime).Value = Quest.ToDate; da.SelectCommand.Parameters.Add("@Subject", SqlDbType.VarChar).Value = Quest.Subject; da.SelectCommand.Parameters.Add("@Tag", SqlDbType.VarChar).Value = Quest.Tag; da.SelectCommand.Parameters.Add("@ShortDesc", SqlDbType.VarChar).Value = Quest.ShortDesc; // da.SelectCommand.Parameters.Add("@Keywords", SqlDbType.VarChar).Value = Quest.Keyword; da.SelectCommand.Parameters.Add("@Keywords", SqlDbType.VarChar).Value = ""; //AM???? da.Fill(dt); if (dt.Rows.Count > 0) { return true; } else { return false; } }
public void bindLVQuest() { QuestAnsBAL QuestBAL = new QuestAnsBAL(); QuestAnsBE Quest = new QuestAnsBE(); DataTable dt = new DataTable(); DateTime FromDate = Convert.ToDateTime("2010/01/01"); DateTime Todate = DateTime.Now; if (txtFromDate.Text == "") { Quest.FromDate = FromDate; } else { IFormatProvider culture = new CultureInfo("es-Mx", true); // Quest.FromDate = DateTime.Parse(txtFromDate.Text, culture); Quest.FromDate = DateTime.ParseExact(txtFromDate.Text + " " + ddlFromHrs.Text + ':' + ddlFromMns.Text, "dd/MM/yyyy HH:mm", culture); } if (txtToDate.Text == "") { Quest.ToDate = Todate; } else { IFormatProvider culture = new CultureInfo("es-Mx", true); //Quest.ToDate = DateTime.Parse(txtToDate.Text, culture); Quest.ToDate = DateTime.ParseExact(txtToDate.Text + " " + ddlToHrs.Text + ':' + ddlToMns.Text, "dd/MM/yyyy HH:mm", culture); } if (txtSubject.Text == "") { Quest.Subject = "%"; } else { Quest.Subject = "%" + txtSubject.Text + "%"; } if (txtTags.Text == "") { Quest.Tag = "%"; } else { Quest.Tag = "%" + txtTags.Text + "%"; } if (txtYrOfStudyExp.Text == "") { Quest.YrsOfStudyStream = "%"; } else { Quest.YrsOfStudyStream = "%" + txtYrOfStudyExp.Text + "%"; } if (txtStudyStream.Text == "") //AM?? { Quest.StudyStream = "%"; //AM?? } else { Quest.StudyStream = "%" + txtStudyStream.Text + "%"; //AM?? } // if (txtKeyword.Text == "") //AM???? // { // Quest.Keyword = "%"; // } // else // { // Quest.Keyword = txtKeyword.Text; //} if (QuestBAL.SearchList(ref dt, Quest)) { lvQuestList.DataSource = dt; lvQuestList.DataBind(); recalcNoOfPages(); } else { lvQuestList.Items.Clear(); lvQuestList.DataSource = null; lvQuestList.DataBind(); LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Sorry No Records Were found", false); } }
protected void lvAnswerList_OnItemCommand(object sender, ListViewCommandEventArgs e) { QuestAnsBAL AnsBAL = new QuestAnsBAL(); QuestAnsBE Ans = new QuestAnsBE(); Ans.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; LoggedIn master = (LoggedIn)this.Master; if (String.Equals(e.CommandName, "like")) { Ans.AnsId = Convert.ToInt32(e.CommandArgument); Ans.QuestId = Convert.ToInt32(hdnQuestId.Value); Ans.Like = 1; Ans.DisLike = 0; if (AnsBAL.AddLike(Ans)) { GetAnswers(); master.ShowMessage("Successfully liked.", true); } else { master.ShowMessage("You are the author of this answer so can not Like or Dislike it", false); } } else if (String.Equals(e.CommandName, "dislike")) { Ans.AnsId = Convert.ToInt32(e.CommandArgument); Ans.QuestId = Convert.ToInt32(hdnQuestId.Value); Ans.Like = 0; Ans.DisLike = 1; if (AnsBAL.AddDisLike(Ans)) { GetAnswers(); master.ShowMessage("Successfully dislike.", true); } else { master.ShowMessage("You are the author of this answer so can not Like or Dislike it.", false); } } }