public APIResponseBase TestEncryptStringWithKey(APIResponseBase request) { APIResponseBase response = new APIResponseBase(); response.ErrorMessage = CryptoUtil.EncryptStringWithKey(request.ErrorMessage); return(response); }
public string TplChange(string strListTplDetail) { List <TplDetailResponse> listTplDetail = JsonHelper.DeserializeJsonToObject <List <TplDetailResponse> >(strListTplDetail); var token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString(); TplRequest tplRequest = new TplRequest(); string strJson = string.Empty; APIResponseBase ai = new APIResponseBase { code = 0, message = "" }; strJson = JsonHelper.SerializeObject(ai); foreach (TplDetailResponse tpl in listTplDetail) { string termids = string.Empty; string ids = string.Empty; string editbypats = string.Empty; foreach (TplDetail_DetailInfo tpldetail in tpl.data.tpl_detail) { termids += tpldetail.termid + ","; ids += tpldetail.id + ","; editbypats += tpldetail.editbypat + ","; } string reponse = tplRequest.TplChange(tpl.data.id, tpl.data.period, tpl.data.freqs, termids.Trim(','), ids.Trim(','), editbypats.Trim(','), token); TplChangeResponse tcr = JsonHelper.DeserializeJsonToObject <TplChangeResponse>(reponse); if (tcr.code != 0) { return(reponse); } } return(strJson); }
public string GetTplReportDetail(string tplId, string periodId) { var token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString(); string apiResponse = string.Empty; TplReportDetailResponse trdr = new TplReportDetailResponse(); try { trdr = tplRequest.TplReportDetailObject(token, tplId, periodId); if (trdr.code == 0) { trdr.data.tpl.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.termid) - Convert.ToInt32(right.termid))); trdr.data.tpl.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid2) - Convert.ToInt32(right.sharpid2))); trdr.data.tpl.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) - Convert.ToInt32(right.sharpid))); apiResponse = JsonHelper.SerializeObject(trdr); } else { APIResponseBase ar = new APIResponseBase { code = 404, message = "报告不存在" }; apiResponse = JsonHelper.SerializeObject(ar); } } catch (Exception ex) { AppLog.Instance.Write("GetTplReportDetail", AppLog.LogMessageType.Error, ex); } return(apiResponse); }
public APIResponseBase TestDecryption(APIResponseBase request) { APIResponseBase response = new APIResponseBase(); response.ErrorMessage = CryptoUtil.DecryptInfo(request.ErrorMessage); return(response); }
public async Task <APIResponseBase> SaveUserHealthKit(UserHealthKitRequest request) { APIResponseBase response = ValidateUserToken(); if (response != null && response.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE) { response = await Task.Run(() => _userService.SaveUserHealthKit_sp((long)request.UserID, request)); } return(response); }
public async Task <APIResponseBase> SaveSpinWheelGame(SpinWheelGameRequest request) { APIResponseBase response = ValidateUserToken(); if (response != null && response.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE) { response = await Task.Run(() => _SurveyService.SaveSpinWheelGame(request)); } return(response); }
public async Task <APIResponseBase> SaveUserHealthKitV2(HealthKitUserRequest request) { LogUtil.Error("UserController/SaveUserHealthKitV2: xxxx1"); APIResponseBase response = ValidateUserToken(); if (response != null && response.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE) { response = await Task.Run(() => _userService.SaveUserHealthKitV2(request)); } return(response); }
public async Task <APIResponseBase> UpdateUserProfile(UserProfileRequest request) { APIResponseBase response = new APIResponseBase(); response = ValidateUserToken(); if (response != null && response.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE) { response = await Task.Run(() => _userService.UpdateUserProfile(request)); } return(response); }
public APIResponseBase TestDecryptStringWithKey(APIResponseBase request) { APIResponseBase response = new APIResponseBase(); if (request.ErrorCode == 11) { response.ErrorMessage = CryptoUtil.DecryptStringWithKey(request.ErrorMessage); } else { response.ErrorMessage = ""; } return(response); }
public async Task <ScheduleSurveyAndGame> GetSurveyandGameScheduleandJewelsSettings(SurveyAndGameScheduleRequest request) { var response = new ScheduleSurveyAndGame(); APIResponseBase tokenResponse = ValidateUserToken(); if (tokenResponse != null && tokenResponse.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE) { response = await Task.Run(() => _userService.GetSurveyandGameScheduleandJewelsSettings(request)); } else { response.ErrorCode = tokenResponse.ErrorCode; response.ErrorMessage = tokenResponse.ErrorMessage; } return(response); }
public async Task <ProtocolDateResponse> GetProtocolDate(ProtocolDateRequest request) { var response = new ProtocolDateResponse(); APIResponseBase tokenResponse = ValidateUserToken(); if (tokenResponse != null && tokenResponse.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE) { response = await Task.Run(() => _userService.GetProtocolDate(request)); } else { response.ErrorCode = tokenResponse.ErrorCode; response.ErrorMessage = tokenResponse.ErrorMessage; } return(response); }
public async Task <SurveyResponse> GetSurveyQueAndAns(SurveyQueAndAnsRequest request) { var response = new SurveyResponse(); APIResponseBase tokenResponse = ValidateUserToken(); if (tokenResponse != null && tokenResponse.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE) { response = await Task.Run(() => _SurveyService.GetSurveyQueAndAns(request)); } else { response.ErrorCode = tokenResponse.ErrorCode; response.ErrorMessage = tokenResponse.ErrorMessage; } return(response); }
public async Task <GameTotalScoreResponse> GetAllGameTotalSpinWheelScore(GameTotalScoreRequest request) { var response = new GameTotalScoreResponse(); APIResponseBase tokenResponse = ValidateUserToken(); if (tokenResponse != null && tokenResponse.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE) { response = await Task.Run(() => _SurveyService.GetAllGameTotalSpinWheelScore(request)); } else { response.ErrorCode = tokenResponse.ErrorCode; response.ErrorMessage = tokenResponse.ErrorMessage; } return(response); }
public APIResponseBase LogData(LogRequest request) { APIResponseBase response = new APIResponseBase(); try { LogUtil.Error("LogData ============================================="); LogUtil.Error("Id: " + request.Id.ToString() + " Text: " + request.Text); response.ErrorCode = (int)LAMPConstants.API_SUCCESS; } catch (Exception ex) { response.ErrorCode = (int)LAMPConstants.API_FAIL; } return(response); }
public string UserStatusDisable(string token, string id) { string strResponse = string.Empty; APIResponseBase apiResponse = new APIResponseBase(); try { Dictionary <string, string> sPara = new Dictionary <string, string>(); sPara.Add("userid", id); strResponse = F8YLSubmit.BuildRequest(sPara, "ucenter/user/status/disable?token=" + token); } catch (Exception) { } return(strResponse); }
public string ImportUser(string token, string filexls) { string strResponse = string.Empty; APIResponseBase apiResponse = new APIResponseBase(); try { Dictionary <string, string> sPara = new Dictionary <string, string>(); sPara.Add("filexls", filexls); strResponse = F8YLSubmit.BuildRequest(sPara, "ucenter/user/import?token=" + token); } catch (Exception ex) { AppLog.Instance.Write("ImportUser", AppLog.LogMessageType.Error, ex); } return(strResponse); }
public string UpdateUser(string token, string userid, string username, string deptname, string duty, string tel, string email) { string strResponse = string.Empty; APIResponseBase apiResponse = new APIResponseBase(); try { Dictionary <string, string> sPara = new Dictionary <string, string>(); sPara.Add("userid", userid); sPara.Add("username", username); sPara.Add("deptname", deptname); sPara.Add("duty", duty); sPara.Add("tel", tel); sPara.Add("email", email); strResponse = F8YLSubmit.BuildRequest(sPara, "ucenter/user/profile?token=" + token); } catch (Exception) { } return(strResponse); }
/// <summary> /// Authenticate User /// </summary> /// <param name="request">User details</param> /// <returns>Status</returns> public APIResponseBase AuthenticateUser(UserTokenRequest request) { APIResponseBase response = new APIResponseBase(); try { var mobileUser = _UnitOfWork.IUserRepository.RetrieveAll().Where(u => u.UserID == request.UserID && u.SessionToken == request.SessionToken).FirstOrDefault(); if (mobileUser == null) { response.ErrorCode = LAMPConstants.API_USER_SESSION_EXPIRED; response.ErrorMessage = ResourceHelper.GetStringResource(LAMPConstants.API_USER_SESSION_EXPIRED); } else { response.ErrorCode = LAMPConstants.API_SUCCESS_CODE; } } catch (Exception ex) { LogUtil.Error(ex); response.ErrorCode = LAMPConstants.API_UNEXPECTED_ERROR; } return(response); }
public async Task <APIResponseBase> ForgotPassword(ForgotPasswordRequest request) { APIResponseBase response = await Task.Run(() => _userService.SendPasswordOnEmail(request)); return(response); }