public void LoadQuestions(string question, int active, int pstateid) { Question s; StudioMQuestion.Clear(); client = new SQSAdminServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint); DataSet ds = client.SQSAdmin_StudioM_GetQuestionList(question, active, pstateid); client.Close(); foreach (DataRow dr in ds.Tables[0].Rows) { s = new Question(); s.QuestionID = int.Parse(dr["idtemplatequestion"].ToString()); s.QuestionText = dr["question"].ToString(); s.AnswerTypeID = int.Parse(dr["fkidanswertype"].ToString()); s.AnswertypeText = dr["answerType"].ToString(); s.Active = bool.Parse(dr["active"].ToString()); s.QuestionAndType = dr["questionandtype"].ToString(); s.QuestionStateID = int.Parse(dr["fkidstate"].ToString()); s.Mandatory = bool.Parse(dr["Mandatory"].ToString()); StudioMQuestion.Add(s); } }
public void LoadQuestion(int stateid, string searchtext) { StudioMQuestion.Clear(); client = new SQSAdminServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint); DataSet ds = client.SQSAdmin_StudioM_SearchActiveQuestions(stateid, searchtext); client.Close(); foreach (DataRow dr in ds.Tables[0].Rows) { StudioMResource.Question b = new StudioMResource.Question(); b.QuestionID = int.Parse(dr["idtemplatequestion"].ToString()); b.QuestionText = dr["question"].ToString(); b.AnswerTypeID = int.Parse(dr["fkidanswertype"].ToString()); b.AnswerType = dr["answertype"].ToString(); b.QuestionAndType = dr["questionandtype"].ToString(); b.Mandatory = bool.Parse(dr["mandatory"].ToString()); bool exists = false; foreach (StudioMResource.Question prod in SelectedQuestion) { if (b.QuestionID == prod.QuestionID) { exists = true; break; } } if (!exists) { StudioMQuestion.Add(b); } } }
public void LoadQuestions(int pstateid) { StudioMQuestion.Clear(); client = new SQSAdminServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint); DataSet ds = client.SQSAdmin_StudioM_GetActiveQuestions(pstateid); client.Close(); foreach (DataRow dr in ds.Tables[0].Rows) { StudioMResource.Question b = new StudioMResource.Question(); b.QuestionID = int.Parse(dr["idtemplatequestion"].ToString()); b.QuestionText = dr["question"].ToString(); b.AnswerTypeID = int.Parse(dr["fkidanswertype"].ToString()); b.AnswerType = dr["answertype"].ToString(); b.QuestionAndType = dr["questionandtype"].ToString(); b.Mandatory = bool.Parse(dr["mandatory"].ToString()); StudioMQuestion.Add(b); } }