public AppRolResultModel Serialize() { AppRolResultModel send = new AppRolResultModel(); string webMethodName = "Upload_AppRol"; try { //send.UploadAppRolResult = GetIsModified(); var client = new RestClient(SyncProperties.routeUpload); //client.Authenticator = new HttpBasicAuthenticator(basicAuthUser, basicAuthPass); var request = new RestRequest(Method.POST); request.Resource = webMethodName; request.RequestFormat = RestSharp.DataFormat.Json; request.AddHeader("Content-type", "application/json"); //Body MaxTableModel maximos = new MaxTableModel(); IRestResponse response = null; RegistroRepository registroRepository = new RegistroRepository(); request.AddBody(new { param = send }); response = client.Execute(request); string res = response.Content; } catch (Exception) { } return send; }
public AppRolResultModel Upload_AppRol(AppRolResultModel param) { AppRolResultModel res = new AppRolResultModel(); try { } catch (Exception) { throw; } return param; }
public bool Download() { bool x = false; string webMethodName = "Download_AppRol"; string tableName = "APP_ROL"; try { string res = DownloadFactory.Instance.CallWebService(webMethodName, tableName); AppRolResultModel model = new AppRolResultModel(); model = new JavaScriptSerializer().Deserialize<AppRolResultModel>(res); if(model.Download_AppRolResult!=null && model.Download_AppRolResult.Count>0) { Upsert(model.Download_AppRolResult); } x = true; } catch (Exception ex) { x = false; AppBitacoraRepository.Insert(new AppBitacoraModel() { Fecha = DateTime.Now, Metodo = ex.StackTrace, Mensaje = ex.Message }); } return x; }