public DataSet GetSurrogateData(ListSurrogate listsurrogate) { DataSet dataSet = new DataSet(); try { string storedProcedure = "pSRGg_ListSurrogate"; string parameterName = "@aXMLString"; string parameterValue = ObjectHelper.GetXMLFromObject(listsurrogate); sqlCommand = new SqlCommand(storedProcedure, sqlConnection); sqlCommand.Parameters.AddWithValue(parameterName, parameterValue); sqlCommand.CommandType = CommandType.StoredProcedure; sqlConnection.Open(); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.Fill(dataSet); dataSet.Tables[0].TableName = "TEMP"; } catch (Exception) { throw; } finally { sqlConnection.Close(); } return(dataSet); }
public List <ListSurrogate> GetListSurrogate(ListSurrogate listsurrogate) { List <ListSurrogate> locallistsurrogate = new List <ListSurrogate>(); ListData finalsubmitdata = new ListData(); DataSet dataSet = new DataSet(); ListSurrogate locallist = new ListSurrogate(); locallist.UserID = ApplicationManager.LoggedInUser.UserID; try { dataSet = finalsubmitdata.GetSurrogateData(locallist); if (dataSet.Tables["TEMP"].Rows.Count > 0) { for (int i = 0; i < dataSet.Tables["TEMP"].Rows.Count; i++) { ListSurrogate loc = new ListSurrogate(); loc.UserID = dataSet.Tables["TEMP"].Rows[i]["USERID"].ToString(); loc.SurrogateUserID = dataSet.Tables["TEMP"].Rows[i]["SURROGATEUSERID"].ToString(); loc.FirstName = dataSet.Tables["TEMP"].Rows[i]["FIRSTNAME"].ToString(); loc.LastName = dataSet.Tables["TEMP"].Rows[i]["LASTNAME"].ToString(); loc.EmailID = dataSet.Tables["TEMP"].Rows[i]["EMAILID"].ToString(); loc.DOB = dataSet.Tables["TEMP"].Rows[i]["DOB"].ToString(); loc.Age = dataSet.Tables["TEMP"].Rows[i]["AGE"].ToString(); loc.Height = dataSet.Tables["TEMP"].Rows[i]["HEIGHT"].ToString(); loc.Weight = dataSet.Tables["TEMP"].Rows[i]["WEIGHT"].ToString(); loc.Citizenship = dataSet.Tables["TEMP"].Rows[i]["CITIZENSHIP"].ToString(); loc.ApprovalStatus = dataSet.Tables["TEMP"].Rows[i]["APPROVALSTATUS"].ToString(); locallistsurrogate.Add(loc); } } } catch (Exception ex) { LoggerHelper.WriteToLog(ex); } return(locallistsurrogate); }