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); } }