public SurveyInfoResponse GetFormChildInfo(SurveyInfoRequest pRequest) { try { SurveyInfoResponse result = new SurveyInfoResponse(pRequest.RequestId); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyInfo implementation = new Epi.Web.BLL.SurveyInfo(surveyInfoDao); Dictionary <string, int> ParentIdList = new Dictionary <string, int>(); foreach (var item in pRequest.SurveyInfoList) { ParentIdList.Add(item.SurveyId, item.ViewId); } result.SurveyInfoList = Mapper.ToDataTransferObject(implementation.GetChildInfoByParentId(ParentIdList)); return(result); } catch (Exception ex) { CustomFaultException customFaultException = new CustomFaultException(); customFaultException.CustomMessage = ex.Message; customFaultException.Source = ex.Source; customFaultException.StackTrace = ex.StackTrace; customFaultException.HelpLink = ex.HelpLink; throw new FaultException <CustomFaultException>(customFaultException); } }
public FormsHierarchyResponse GetFormsHierarchy(FormsHierarchyRequest FormsHierarchyRequest) { FormsHierarchyResponse FormsHierarchyResponse = new FormsHierarchyResponse(); List <SurveyResponseBO> AllResponsesIDsList = new List <SurveyResponseBO>(); //1- Get All form ID's Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyInfo Implementation = new Epi.Web.BLL.SurveyInfo(surveyInfoDao); List <FormsHierarchyBO> RelatedFormIDsList = Implementation.GetFormsHierarchyIdsByRootId(FormsHierarchyRequest.SurveyInfo.SurveyId); FormsHierarchyResponse.FormsHierarchy = Mapper.ToFormHierarchyDTO(RelatedFormIDsList); //2- Get all Responses ID's //Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao; //Epi.Web.BLL.SurveyResponse Implementation1 = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao); //if (!string.IsNullOrEmpty(FormsHierarchyRequest.SurveyResponseInfo.ResponseId)) //{ // AllResponsesIDsList = Implementation1.GetResponsesHierarchyIdsByRootId(FormsHierarchyRequest.SurveyResponseInfo.ResponseId); //} //else //{ // AllResponsesIDsList = null; //} ////3 Combining the lists. //FormsHierarchyResponse.FormsHierarchy = Mapper.ToFormHierarchyDTO(CombineLists(RelatedFormIDsList, AllResponsesIDsList)); return(FormsHierarchyResponse); }
public FormSettingResponse GetSettings(FormSettingRequest pRequest) { FormSettingResponse Response = new FormSettingResponse(); try { Epi.Web.Enter.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Enter.Interfaces.DataInterface.IFormSettingDao IFormSettingDao = entityDaoFactory.FormSettingDao; if (!string.IsNullOrEmpty(pRequest.FormInfo.FormId)) { Epi.Web.Enter.Interfaces.DataInterface.IFormInfoDao FormInfoDao = entityDaoFactory.FormInfoDao; Epi.Web.Enter.Interfaces.DataInterface.IUserDao IUserDao = entityDaoFactory.UserDao; Epi.Web.BLL.FormInfo FormInfoImplementation = new Epi.Web.BLL.FormInfo(FormInfoDao); Epi.Web.BLL.FormSetting SettingsImplementation = new Epi.Web.BLL.FormSetting(IFormSettingDao, IUserDao, FormInfoDao); FormInfoBO FormInfoBO = FormInfoImplementation.GetFormInfoByFormId(pRequest.FormInfo.FormId, pRequest.GetXml, pRequest.FormInfo.UserId); Response.FormInfo = Mapper.ToFormInfoDTO(FormInfoBO); Response.FormSetting = Mapper.ToDataTransferObject(SettingsImplementation.GetFormSettings(pRequest.FormInfo.FormId.ToString(), FormInfoBO.Xml)); } else { Epi.Web.BLL.FormSetting SettingsImplementation = new Epi.Web.BLL.FormSetting(IFormSettingDao); Response.FormSetting = Mapper.ToDataTransferObject(SettingsImplementation.GetFormSettings()); } } catch (Exception ex) { throw ex; } return(Response); }
/// <summary> /// /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public CacheDependencyResponse GetCacheDependencyInfo(CacheDependencyRequest cacheDependencyRequest) { try { List <string> surveyKeys = cacheDependencyRequest.Criteria.SurveyIdList; CacheDependencyResponse response = new CacheDependencyResponse(surveyKeys); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ICacheDependencyInfoDao cacheDependencyInfoDao = entityDaoFactory.CacheDependencyInfoDao; Epi.Web.BLL.CacheDependencyInfo cacheDependencyInfo = new Epi.Web.BLL.CacheDependencyInfo(cacheDependencyInfoDao); List <CacheDependencyBO> bo = cacheDependencyInfo.GetCacheDependencyInfo(surveyKeys); List <CacheDependencyDTO> dto = Mapper.ToDataTransferObject(bo); Dictionary <string, DateTime> dictionary = new Dictionary <string, DateTime>(); foreach (CacheDependencyDTO item in dto) { dictionary.Add(item.SurveyId, item.LastUpdate); } response.SurveyDependency = dictionary; return(response); } catch (Exception ex) { CustomFaultException customFaultException = new CustomFaultException(); customFaultException.CustomMessage = ex.Message; customFaultException.Source = ex.Source; customFaultException.StackTrace = ex.StackTrace; customFaultException.HelpLink = ex.HelpLink; throw new FaultException <CustomFaultException>(customFaultException); } }
public UserAuthenticationResponse PassCodeLogin(UserAuthenticationRequest request) { var response = new UserAuthenticationResponse(); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao, ISurveyInfoDao); UserAuthenticationRequestBO PassCodeBO = Mapper.ToPassCodeBO(request); bool result = Implementation.ValidateUser(PassCodeBO); if (result) { response.Acknowledge = AcknowledgeType.Failure; response.Message = "Invalid Pass Code."; response.UserIsValid = true; } else { response.UserIsValid = false; } return(response); }
public UserAuthenticationResponse UserLogin(UserAuthenticationRequest request) { var response = new UserAuthenticationResponse(); Epi.Web.Enter.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Enter.Interfaces.DataInterface.IUserDao IUserDao = entityDaoFactory.UserDao; Epi.Web.BLL.User Implementation = new Epi.Web.BLL.User(IUserDao); UserBO UserBO = Mapper.ToUserBO(request.User); UserBO result = Implementation.GetUser(UserBO); if (result != null) { //response.Acknowledge = AcknowledgeType.Failure; TBD //response.Message = "Invalid Pass Code."; response.User = Mapper.ToUserDTO(result); response.UserIsValid = true; } else { response.UserIsValid = false; } return(response); }
public UserAuthenticationResponse GetUser(UserAuthenticationRequest request) { try { var response = new UserAuthenticationResponse(); Epi.Web.Enter.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Enter.Interfaces.DataInterface.IUserDao IUserDao = entityDaoFactory.UserDao; Epi.Web.BLL.User Implementation = new Epi.Web.BLL.User(IUserDao); UserBO UserBO = Mapper.ToUserBO(request.User); // UserBO result = Implementation.GetUserByUserId(UserBO); UserBO result = Implementation.GetUserByEmail(UserBO); if (result != null) { response.User = Mapper.ToUserDTO(result); } return(response); } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public SurveyAnswerResponse GetSurveyAnswer(SurveyAnswerRequest pRequest) { try { SurveyAnswerResponse result = new SurveyAnswerResponse(pRequest.RequestId); //Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao surveyInfoDao = new EF.EntitySurveyResponseDao(); //Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(surveyInfoDao); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao, ISurveyInfoDao); // Validate client tag, access token, and user credentials if (!ValidRequest(pRequest, result, Validate.All)) { return(result); } var criteria = pRequest.Criteria as SurveyAnswerCriteria; string sort = criteria.SortExpression; //if (request.LoadOptions.Contains("SurveyInfos")) //{ // IEnumerable<SurveyInfoDTO> SurveyInfos; // if (!criteria.IncludeOrderStatistics) // { // SurveyInfos = Implementation.GetSurveyInfos(sort); // } // else // { // SurveyInfos = Implementation.GetSurveyInfosWithOrderStatistics(sort); // } // response.SurveyInfos = SurveyInfos.Select(c => Mapper.ToDataTransferObject(c)).ToList(); //} //if (pRequest.LoadOptions.Contains("SurveyInfo")) //{ List <SurveyResponseBO> List = Implementation.GetSurveyResponseById(pRequest.Criteria.SurveyAnswerIdList, pRequest.Criteria.UserPublishKey); result.SurveyResponseList = Mapper.ToDataTransferObject(List); //} return(result); } catch (Exception ex) { CustomFaultException customFaultException = new CustomFaultException(); customFaultException.CustomMessage = ex.Message; customFaultException.Source = ex.Source; customFaultException.StackTrace = ex.StackTrace; customFaultException.HelpLink = ex.HelpLink; throw new FaultException <CustomFaultException>(customFaultException); } }
public bool UpdateUser(UserAuthenticationRequest request) { Epi.Web.Enter.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Enter.Interfaces.DataInterface.IUserDao IUserDao = entityDaoFactory.UserDao; Epi.Web.BLL.User Implementation = new Epi.Web.BLL.User(IUserDao); UserBO UserBO = Mapper.ToUserBO(request.User); OrganizationBO OrgBO = new OrganizationBO(); return(Implementation.UpdateUser(UserBO, OrgBO)); }
public SourceTablesResponse GetSourceTables(SourceTablesRequest Request) { SourceTablesResponse DropDownsResponse = new SourceTablesResponse(); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyInfo Implementation = new Epi.Web.BLL.SurveyInfo(surveyInfoDao); DropDownsResponse.List = Mapper.ToSourceTableDTO(Implementation.GetSourceTables(Request.SurveyId)); return(DropDownsResponse); }
public bool UpdateUserInfo(UserRequest UserInfo) { Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.IUserDao IUserDao = new EF.EntityUserDao(); Epi.Web.BLL.User Implementation = new Epi.Web.BLL.User(IUserDao); var UserBO = Mapper.ToUserBO(UserInfo.User); OrganizationBO OrgBO = new OrganizationBO(); OrgBO = Mapper.ToBusinessObject(UserInfo.Organization); return(Implementation.UpdateUser(UserBO, OrgBO)); }
public SurveyAnswerResponse GetAncestorResponseIdsByChildId(SurveyAnswerRequest pRequest) { Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse(); Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao SurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(SurveyResponseDao, ISurveyInfoDao); List <SurveyResponseBO> SurveyResponseBOList = Implementation.GetAncestorResponseIdsByChildId(pRequest.Criteria.SurveyAnswerIdList[0]); SurveyAnswerResponse.SurveyResponseList = Mapper.ToDataTransferObject(SurveyResponseBOList); return(SurveyAnswerResponse); }
public SurveyAnswerResponse GetSurveyAnswerHierarchy(SurveyAnswerRequest pRequest) { Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse(); Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao SurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(SurveyResponseDao, ISurveyInfoDao); List <SurveyResponseBO> SurveyResponseBOList = Implementation.GetResponsesHierarchyIdsByRootId(pRequest.SurveyAnswerList[0].ResponseId); SurveyAnswerResponse.SurveyResponseList = Mapper.ToDataTransferObject(SurveyResponseBOList); return(SurveyAnswerResponse); }
public UserAuthenticationResponse SetPassCode(UserAuthenticationRequest request) { var response = new UserAuthenticationResponse(); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao, ISurveyInfoDao); Epi.Web.Common.BusinessObject.UserAuthenticationRequestBO PassCodeBO = Mapper.ToPassCodeBO(request); Implementation.SavePassCode(PassCodeBO); return(response); }
private bool IsSurveyInfoValidByOrgKeyAndPublishKey(string SurveyId, string Orgkey, Guid publishKey) { IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; string EncryptedKey = Epi.Web.Common.Security.Cryptography.Encrypt(Orgkey.ToString()); List <SurveyInfoBO> result = surveyInfoDao.GetSurveyInfoByOrgKeyAndPublishKey(SurveyId.ToString(), EncryptedKey, publishKey); if (result != null && result.Count > 0) { return(true); } else { return(false); } }
public void SetSurveyAnswerStatus(SurveyAnswerRequest pRequest) { SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse(); Epi.Web.Enter.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao); List <SurveyResponseBO> SurveyAnswerList = new List <SurveyResponseBO>(); SurveyAnswerList = Implementation.GetResponsesHierarchyIdsByRootId(pRequest.Criteria.SurveyAnswerIdList[0].ToString()); foreach (var response in SurveyAnswerList) { var obj = Mapper.ToBusinessObject(Mapper.ToDataTransferObject(response), pRequest.Criteria.UserId); obj.Status = pRequest.Criteria.StatusId; Implementation.UpdateRecordStatus(obj); } }
public UserResponse GetUserListByOrganization(UserRequest UserInfo) { UserResponse UserResponse = new UserResponse(); UserRequest UserRequest = new UserRequest(); Epi.Web.Interfaces.DataInterfaces.IOrganizationDao IOrganizationDao = new EF.EntityOrganizationDao(); Epi.Web.BLL.Organization OrgImplementation = new Epi.Web.BLL.Organization(IOrganizationDao); OrganizationBO OrganizationBO = OrgImplementation.GetOrganizationByKey(UserInfo.Organization.OrganizationKey); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.IUserDao IUserDao = new EF.EntityUserDao(); Epi.Web.BLL.User Implementation = new Epi.Web.BLL.User(IUserDao); UserResponse.User = Mapper.ToUserDTO(Implementation.GetUsersByOrgId(OrganizationBO.OrganizationId)); return(UserResponse); }
/// <summary> /// /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public SurveyInfoResponse GetSurveyInfo(SurveyInfoRequest surveyInfoRequest) { try { SurveyInfoResponse response = new SurveyInfoResponse(surveyInfoRequest.RequestId); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyInfo surveyInfo = new Epi.Web.BLL.SurveyInfo(surveyInfoDao); if (!ValidRequest(surveyInfoRequest, response, Validate.All)) { return(response); } var criteria = surveyInfoRequest.Criteria as SurveyInfoCriteria; string sort = criteria.SortExpression; List <string> SurveyIdList = new List <string>(); foreach (string id in criteria.SurveyIdList) { SurveyIdList.Add(id.ToUpper()); } List <SurveyInfoBO> bo = surveyInfo.GetSurveyInfoById(SurveyIdList); response.SurveyInfoList = Mapper.ToDataTransferObject(bo); return(response); } catch (Exception ex) { CustomFaultException customFaultException = new CustomFaultException(); customFaultException.CustomMessage = ex.Message; customFaultException.Source = ex.Source; customFaultException.StackTrace = ex.StackTrace; customFaultException.HelpLink = ex.HelpLink; throw new FaultException <CustomFaultException>(customFaultException); } }
private List <SurveyInfoBO> GetSurveyInfo(PreFilledAnswerRequest request) { List <string> SurveyIdList = new List <string>(); string SurveyId = request.AnswerInfo.SurveyId.ToString(); string OrganizationId = request.AnswerInfo.OrganizationKey.ToString(); //Guid UserPublishKey = request.AnswerInfo.UserPublishKey; List <SurveyInfoBO> SurveyBOList = new List <SurveyInfoBO>(); SurveyIdList.Add(SurveyId); SurveyInfoRequest pRequest = new SurveyInfoRequest(); var criteria = pRequest.Criteria as Epi.Web.Enter.Common.Criteria.SurveyInfoCriteria; var entityDaoFactory = new EF.EntityDaoFactory(); var surveyInfoDao = entityDaoFactory.SurveyInfoDao; SurveyInfo implementation = new SurveyInfo(surveyInfoDao); SurveyBOList = implementation.GetSurveyInfo(SurveyIdList, criteria.ClosingDate, OrganizationId, criteria.SurveyType, criteria.PageNumber, criteria.PageSize);//Default return(SurveyBOList); }
public SurveyAnswerResponse GetResponsesByRelatedFormId(SurveyAnswerRequest pRequest) { Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); SurveyAnswerResponse SurveyAnswerResponse = new SurveyAnswerResponse(); Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao SurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(SurveyResponseDao, ISurveyInfoDao); //List<SurveyResponseBO> SurveyResponseBOList = Implementation.GetResponsesByRelatedFormId(pRequest.Criteria.SurveyAnswerIdList[0], pRequest.Criteria.SurveyId); List <SurveyResponseBO> SurveyResponseBOList = Implementation.GetResponsesByRelatedFormId(pRequest.Criteria.SurveyAnswerIdList[0], pRequest.Criteria); SurveyAnswerResponse.SurveyResponseList = Mapper.ToDataTransferObject(SurveyResponseBOList); //Query The number of records //SurveyAnswerResponse.NumberOfPages = Implementation.GetNumberOfPages(pRequest.Criteria.SurveyId, pRequest.Criteria.IsMobile); //SurveyAnswerResponse.NumberOfResponses = Implementation.GetNumberOfResponses(pRequest.Criteria); //SurveyAnswerResponse.NumberOfPages = Implementation.GetNumberOfPages(pRequest.Criteria); //SurveyAnswerResponse.NumberOfResponses = Implementation.GetNumberOfResponses(pRequest.Criteria); return(SurveyAnswerResponse); }
/// <summary> /// /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public SurveyAnswerResponse GetSurveyAnswer(SurveyAnswerRequest pRequest) { try { SurveyAnswerResponse result = new SurveyAnswerResponse(pRequest.RequestId); //Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyResponseDao surveyInfoDao = new EF.EntitySurveyResponseDao(); //Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(surveyInfoDao); Epi.Web.Enter.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao); //Get Organization Info Epi.Web.Enter.Interfaces.DataInterfaces.IOrganizationDao entityDaoFactory1 = new EF.EntityOrganizationDao(); //Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.Enter.Interfaces.DataInterfaces.IOrganizationDao surveyInfoDao1 = entityDaoFactory1; Epi.Web.BLL.Organization implementation1 = new Epi.Web.BLL.Organization(surveyInfoDao1); bool ISValidOrg = implementation1.ValidateOrganization(pRequest.Criteria.OrganizationKey.ToString()); if (ISValidOrg) { // Validate client tag, access token, and user credentials if (!ValidRequest(pRequest, result, Validate.All)) { return(result); } SurveyAnswerCriteria criteria = pRequest.Criteria; if (criteria.UserPublishKey == null) { return(result); } Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = new EF.EntitySurveyInfoDao(); Epi.Web.BLL.SurveyInfo SurveyInfo = new Epi.Web.BLL.SurveyInfo(surveyInfoDao); //List<string> SurveyIdList = new List<string>(); //SurveyIdList.Add(criteria.SurveyId); bool validSurvey = false; // if (string.IsNullOrEmpty(criteria.SurveyId.ToString())) // { validSurvey = SurveyInfo.IsSurveyInfoValidByOrgKeyAndPublishKey(criteria.SurveyId, criteria.OrganizationKey.ToString(), criteria.UserPublishKey, criteria.UserId); //} if (validSurvey == true) { //Guid UserPublishKey = SurveyInfo.GetSurveyInfoById(criteria.SurveyId).UserPublishKey; //if (criteria.UserPublishKey != UserPublishKey) //{ // return result; //} List <string> IdList = new List <string>(); foreach (string id in criteria.SurveyAnswerIdList) { IdList.Add(id.ToUpper()); } //string sort = criteria.SortExpression; //if (request.LoadOptions.Contains("SurveyInfos")) //{ // IEnumerable<SurveyInfoDTO> SurveyInfos; // if (!criteria.IncludeOrderStatistics) // { // SurveyInfos = Implementation.GetSurveyInfos(sort); // } // else // { // SurveyInfos = Implementation.GetSurveyInfosWithOrderStatistics(sort); // } // response.SurveyInfos = SurveyInfos.Select(c => Mapper.ToDataTransferObject(c)).ToList(); //} int ResponseMaxSize = Int32.Parse(ConfigurationManager.AppSettings["maxBytesPerRead"]); int BandwidthUsageFactor = Int32.Parse(ConfigurationManager.AppSettings["BandwidthUsageFactor"]); if (pRequest.Criteria.ReturnSizeInfoOnly == true) { // call BLL with a list of records PageInfoBO PageInfoBO = Implementation.GetResponseSurveySize(IdList, criteria.SurveyId, criteria.DateCompleted, BandwidthUsageFactor, criteria.IsDraftMode, criteria.StatusId, -1, -1, ResponseMaxSize); result.PageSize = PageInfoBO.PageSize; result.NumberOfPages = PageInfoBO.NumberOfPages; } else { List <SurveyResponseBO> SurveyResponseBOList = Implementation.GetSurveyResponse ( IdList, criteria.SurveyId, criteria.DateCompleted, criteria.StatusId, criteria.IsDraftMode ); foreach (SurveyResponseBO surveyResponseBo in SurveyResponseBOList) { // if (surveyResponseBo.UserPublishKey == criteria.UserPublishKey) //if (UserPublishKey == criteria.UserPublishKey) //{ result.SurveyResponseList.Add(Mapper.ToDataTransferObject(surveyResponseBo)); // } } } /* * if (string.IsNullOrEmpty(pRequest.Criteria.SurveyId)) * { * result.SurveyResponseList = Mapper.ToDataTransferObject(Implementation.GetSurveyResponseById(pRequest.Criteria.SurveyAnswerIdList)); * } * else * { * result.SurveyResponseList = Mapper.ToDataTransferObject(Implementation.GetSurveyResponseBySurveyId(pRequest.Criteria.SurveyAnswerIdList)); * }*/ } else { if (criteria.UserId != -1 && criteria.UserPublishKey == Guid.Empty) { result.Message = "InvalidUserId"; } if (criteria.UserId == -1 && criteria.UserPublishKey != Guid.Empty) { result.Message = "InvalidPublishKey"; } } } else { result.Message = "Organization Key not found"; } return(result); } catch (Exception ex) { CustomFaultException customFaultException = new CustomFaultException(); customFaultException.CustomMessage = ex.Message; customFaultException.Source = ex.Source; customFaultException.StackTrace = ex.StackTrace; customFaultException.HelpLink = ex.HelpLink; throw new FaultException <CustomFaultException>(customFaultException); } }
/// <summary> /// /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public SurveyInfoResponse GetSurveyInfo(SurveyInfoRequest pRequest) { try { SurveyInfoResponse result = new SurveyInfoResponse(pRequest.RequestId); //Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = new EF.EntitySurveyInfoDao(); //Epi.Web.BLL.SurveyInfo implementation = new Epi.Web.BLL.SurveyInfo(surveyInfoDao); Epi.Web.Enter.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyInfo implementation = new Epi.Web.BLL.SurveyInfo(surveyInfoDao); // Validate client tag, access token, and user credentials if (!ValidRequest(pRequest, result, Validate.All)) { return(result); } //Validate UserPublishKey exists if (pRequest.Criteria.UserPublishKey == null) { return(result); } var criteria = pRequest.Criteria as SurveyInfoCriteria; string sort = criteria.SortExpression; List <string> SurveyIdList = new List <string>(); foreach (string id in criteria.SurveyIdList) { SurveyIdList.Add(id.ToUpper()); } List <SurveyInfoBO> SurveyBOList = new List <SurveyInfoBO>(); // int ResponseMaxSize = 16384; int ResponseMaxSize = Int32.Parse(ConfigurationManager.AppSettings["maxBytesPerRead"]); int BandwidthUsageFactor = Int32.Parse(ConfigurationManager.AppSettings["BandwidthUsageFactor"]); Epi.Web.Enter.Interfaces.DataInterfaces.IOrganizationDao entityDaoFactory1 = new EF.EntityOrganizationDao(); //Epi.Web.Enter.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.Enter.Interfaces.DataInterfaces.IOrganizationDao surveyInfoDao1 = entityDaoFactory1; Epi.Web.BLL.Organization implementation1 = new Epi.Web.BLL.Organization(surveyInfoDao1); bool ISValidOrg = implementation1.ValidateOrganization(pRequest.Criteria.OrganizationKey.ToString()); if (ISValidOrg) { if (pRequest.Criteria.ReturnSizeInfoOnly == true) { // add BandwidthUsageFactor PageInfoBO PageInfoBO = implementation.GetSurveySizeInfo(SurveyIdList, criteria.ClosingDate, criteria.OrganizationKey.ToString(), BandwidthUsageFactor, criteria.SurveyType, criteria.PageNumber, criteria.PageSize, ResponseMaxSize); result.PageSize = PageInfoBO.PageSize; result.NumberOfPages = PageInfoBO.NumberOfPages; } else { SurveyBOList = implementation.GetSurveyInfo(SurveyIdList, criteria.ClosingDate, criteria.OrganizationKey.ToString(), criteria.SurveyType, criteria.PageNumber, criteria.PageSize);//Default foreach (SurveyInfoBO surveyInfoBO in SurveyBOList) { result.SurveyInfoList.Add(Mapper.ToDataTransferObject(surveyInfoBO)); } } } else { result.Message = "Organization Key not found"; } return(result); } catch (Exception ex) { CustomFaultException customFaultException = new CustomFaultException(); customFaultException.CustomMessage = ex.Message; customFaultException.Source = ex.Source; customFaultException.StackTrace = ex.StackTrace; customFaultException.HelpLink = ex.HelpLink; throw new FaultException <CustomFaultException>(customFaultException); } }
/// <summary> /// /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public SurveyAnswerResponse GetFormResponseList(SurveyAnswerRequest pRequest) { try { SurveyAnswerResponse result = new SurveyAnswerResponse(pRequest.RequestId); Epi.Web.Interfaces.DataInterfaces.IDaoFactory entityDaoFactory = new EF.EntityDaoFactory(); Epi.Web.Interfaces.DataInterfaces.ISurveyResponseDao ISurveyResponseDao = entityDaoFactory.SurveyResponseDao; Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao ISurveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyResponse Implementation = new Epi.Web.BLL.SurveyResponse(ISurveyResponseDao, ISurveyInfoDao); SurveyAnswerCriteria criteria = pRequest.Criteria; //result.SurveyResponseList = Mapper.ToDataTransferObject(Implementation.GetFormResponseListById(pRequest.Criteria.SurveyId, pRequest.Criteria.PageNumber, pRequest.Criteria.IsMobile)); result.SurveyResponseList = Mapper.ToDataTransferObject(Implementation.GetFormResponseListById(criteria));//Pain point //Query The number of records //result.NumberOfPages = Implementation.GetNumberOfPages(pRequest.Criteria.SurveyId, pRequest.Criteria.IsMobile); //result.NumberOfResponses = Implementation.GetNumberOfResponses(pRequest.Criteria.SurveyId); result.NumberOfPages = Implementation.GetNumberOfPages(pRequest.Criteria); result.NumberOfResponses = Implementation.GetNumberOfResponses(pRequest.Criteria); //Get form info //Interfaces.DataInterface.IFormInfoDao surveyInfoDao = new EF.EntityFormInfoDao(); //Epi.Web.BLL.FormInfo ImplementationFormInfo = new Epi.Web.BLL.FormInfo(surveyInfoDao); //result.FormInfo = Mapper.ToFormInfoDTO(ImplementationFormInfo.GetFormInfoByFormId(pRequest.Criteria.SurveyId, false, pRequest.Criteria.UserId)); SurveyInfoResponse response = new SurveyInfoResponse(pRequest.RequestId); Epi.Web.Interfaces.DataInterfaces.ISurveyInfoDao surveyInfoDao = entityDaoFactory.SurveyInfoDao; Epi.Web.BLL.SurveyInfo surveyInfo = new Epi.Web.BLL.SurveyInfo(surveyInfoDao); if (!ValidRequest(pRequest, response, Validate.All)) { return(result); } List <string> SurveyIdList = new List <string>(); SurveyIdList.Add(pRequest.Criteria.SurveyId.ToUpper()); List <SurveyInfoBO> bo = surveyInfo.GetSurveyInfoById(SurveyIdList); result.SurveyInfo = Mapper.ToDataTransferObject(bo)[0]; return(result); } catch (Exception ex) { CustomFaultException customFaultException = new CustomFaultException(); customFaultException.CustomMessage = ex.Message; customFaultException.Source = ex.Source; customFaultException.StackTrace = ex.StackTrace; customFaultException.HelpLink = ex.HelpLink; throw new FaultException <CustomFaultException>(customFaultException); } }