public ActionResult Request(string method, string url, string data) { ResponseResult result = new ResponseResult(); if (!string.IsNullOrWhiteSpace(method) && !string.IsNullOrWhiteSpace(url)) { url = HttpUtility.UrlDecode(url); } var requestData = new RequestData(); if (!string.IsNullOrWhiteSpace(data)) { data = HttpUtility.UrlDecode(data); requestData = SerializeHelper.Deserialize <RequestData>(data); } string headers = ""; string body = ""; if (method == "POST") { body = WebClientHelper.Post(url, requestData.Header, requestData.Body, out headers); } else { body = WebClientHelper.Get(url, requestData.Header, out headers); } result.Headers = headers; result.Body = body; result.Code = string.IsNullOrEmpty(headers) ? 0 : 1; return(Json(result)); }
public void AddLog(Action <LogDTO, Exception> action, LogDTO log) { var url = string.Format(baseAddress); WebClientHelper.Post(new Uri(url, UriKind.Absolute), action, log, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddUnitIndexInPeriod(Action <UnitIndexInPeriodDTO, Exception> action, UnitIndexInPeriodDTO unitIndexInPeriod) { //action(unitIndexInPeriod, null); //var url = string.Format(baseAddress); //WebClientHelper.Post<UnitIndexInPeriod, UnitIndexInPeriod>(new Uri(url, UriKind.Absolute), // (res, exp) => action(res, exp), unitIndexInPeriod, // WebClientHelper.MessageFormat.Json); var url = string.Format(baseAddress + makeApiAdress(unitIndexInPeriod.PeriodId)); WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, unitIndexInPeriod, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public ActionResult Request(string method, string url, string data) { var result = string.Empty; if (!string.IsNullOrWhiteSpace(method) && !string.IsNullOrWhiteSpace(url)) { url = SAEA.Http.HttpUtility.UrlDecode(url); } if (!string.IsNullOrWhiteSpace(data)) { data = SAEA.Http.HttpUtility.UrlDecode(data); } if (method == "POST") { result = WebClientHelper.Post(url, data); } else { result = WebClientHelper.Get(url); } return(Content(result)); }
public void AddPolicy(Action <PolicyDTO, Exception> action, PolicyDTO policy) { var url = string.Format(apiAddress); WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, policy, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddCalculation(Action <CalculationDTO, Exception> action, CalculationDTO calculation) { var url = string.Format(baseAddress + makeApiAdress(calculation.PeriodId)); WebClientHelper.Post(new Uri(url, UriKind.Absolute), action, calculation, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddJobIndexCategory(Action <JobIndexCategoryDTO, Exception> action, JobIndexCategoryDTO jobIndexCategory) { var url = string.Format(apiAddress, UriKind.Absolute); WebClientHelper.Post(new Uri(url), action, jobIndexCategory, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddJobIndex(Action <JobIndexDTO, Exception> action, JobIndexDTO jobIndex) { var url = string.Format(apiAddress); WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, jobIndex, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void CompileRule(Action <string, Exception> action, long policyId, RuleContentDTO ruleContent) { var url = string.Format(PMSClientConfig.BaseApiAddress + "Policies/" + policyId + "/RuleCompilations"); WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, ruleContent, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddCustomField(Action <CustomFieldDTO, Exception> action, CustomFieldDTO customField) { var url = string.Format(apiCustomFieldAddress, UriKind.Absolute); WebClientHelper.Post(new Uri(url), action, customField, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddEmployee(Action <EmployeeDTO, Exception> action, EmployeeDTO employee) { var url = string.Format(baseAddress + makeApiAdress(employee.PeriodId)); WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, employee, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddJob(Action <JobDTO, Exception> action, JobDTO job) { WebClientHelper.Post(new Uri(apiAddress, PMSClientConfig.UriKind), action, job, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddPeriod(Action <PeriodDTO, Exception> action, PeriodDTO period) { var url = string.Format(baseAddress); WebClientHelper.Post(new Uri(url, UriKind.Absolute), action, period, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddJobPositionInPeriod(Action <JobPositionInPeriodAssignmentDTO, Exception> action, JobPositionInPeriodAssignmentDTO jobPositionInPeriod) { var url = string.Format(baseAddress + makeApiAdress(jobPositionInPeriod.PeriodId)); WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, jobPositionInPeriod, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddUser(Action <UserDTO, Exception> action, UserDTO userDto) { var url = string.Format(baseAddressUsers); WebClientHelper.Post(new Uri(url, UriKind.Absolute), action, userDto, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddUnitIndexGroupInPeriod(Action <UnitIndexGroupInPeriodDTO, Exception> action, UnitIndexGroupInPeriodDTO unitIndexGroupInPeriod) { var url = string.Format(baseAddress + makeApiAdress(unitIndexGroupInPeriod.PeriodId)); WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, unitIndexGroupInPeriod, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddFunction(Action <FunctionDTO, Exception> action, FunctionDTO function) { WebClientHelper.Post(new Uri(apiAddress, PMSClientConfig.UriKind), action, function, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddRule(Action <RuleDTO, Exception> action, RuleDTO rule) { WebClientHelper.Post(new Uri(apiAddress, PMSClientConfig.UriKind), action, rule, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }