コード例 #1
0
        public ActionResult Upload()
        {
            DataSync model = new DataSync();

            model.formResultIds = formsSql.GetCompletedFormResultIds();
            return(View("uploadSync", model));
        }
コード例 #2
0
 private void CellMouseBTNDown(EventMgr.MouseButtonDownEventInfo info)
 {
     if (player == null)
     {
         return;
     }
     if (GameCtrl.IsOnlineGame)
     {
         lock (castingMutex)
         {
             if (!expectedCasting)
             {
                 expectedCasting = true;
                 DataSync.SyncMouseButton0Down(player, Gamef.SystemTimeInMillisecond);
             }
         }
     }
     else
     {
         // 为技能设置施法时刻
         skillTable.CurrentCell.SetInstant(Gamef.SystemTimeInMillisecond);
         // 为技能设置目标
         if (skillTable.CurrentSkill.Data.IsTracking && skillTable.CurrentSkill is ITracking it)
         {
             it.Target = AimController.Instance.TargetForStrafeSkill;
         }
         skillTable.CurrentCell.Start();
     }
 }
コード例 #3
0
    private void Start()
    {
        GameCtrl.PlayerUnitChangeEvent.AddListener(UpdateMover);
        if ((mover == null && GameCtrl.PlayerUnit != null))
        {
            mover = GameCtrl.PlayerUnit.GetComponent <Mover>();
            rb    = mover.GetComponent <Rigidbody>();
        }
        if (mover == null)
        {
            return;
        }

        mover.V             = InputMgr.GetVerticalAxis();
        mover.H             = InputMgr.GetHorizontalAxis();
        mover.CameraForward = CameraGroupController.Instance.transform.forward;

        if (GameCtrl.IsOnlineGame)
        {
            lastSyncA = Gamef.SystemTimeInMillisecond;
            lastSyncT = Gamef.SystemTimeInMillisecond;
            Unit unit    = GameCtrl.PlayerUnit;
            long instant = Gamef.SystemTimeInMillisecond;
            DataSync.SyncMobileControlAxes(unit, instant, Mathf.RoundToInt(mover.H), Mathf.RoundToInt(mover.V), CameraGroupController.Instance.transform.forward);
            DataSync.SyncTransform(unit, instant, unit.transform.position, unit.transform.rotation, rb.velocity.magnitude);
        }
    }
コード例 #4
0
        public ActionResult UploadSingle()
        {
            DataSync model = new DataSync();

            model.ID = SessionHelper.Read <Int32>("uploadFormResultId");
            return(View("uploadSingle", model));
        }
コード例 #5
0
ファイル: Unit.cs プロジェクト: RealTonyShaw/IEC-Project
    private void Update()
    {
        //回复 护盾值
        attributes.SheildPoint += attributes.SPRegenerationRate.Value * Time.deltaTime;

        if (attributes.data.IsCaster)
        {
            //回复 魔法值 和 当前技能冷却(应当是全体技能冷却,同时技能初始精确度未设置)
            attributes.ManaPoint.Value += attributes.MPRegenerationRate.Value * Time.deltaTime;
            skillTable.CurrentSkill.AccuracyCooldown(Time.deltaTime);
        }

        //触发buff效果
        BuffEvent?.Invoke();

        if (GameCtrl.IsOnlineGame && IsLocal)
        {
            if (Gamef.SystemTimeInMillisecond - lastSyncUnitStateInstant >= GameDB.SYNC_TRANSFORM_INTERVAL)
            {
                Debug.Log("Send Hp = " + attributes.SheildPoint + ", Mp = " + attributes.ManaPoint.Value);
                lastSyncUnitStateInstant = Gamef.SystemTimeInMillisecond;
                DataSync.SyncHP(this, lastSyncUnitStateInstant, attributes.SheildPoint);
                DataSync.SyncMP(this, lastSyncUnitStateInstant, attributes.ManaPoint.Value);
            }
        }

        ////单位画布面对摄像机
        //if (unitCanvas != null)
        //    unitCanvas.transform.forward = unitCamera.position - unitCanvas.transform.position;
    }
コード例 #6
0
ファイル: Unit.cs プロジェクト: RealTonyShaw/IEC-Project
    /// <summary>
    /// 护盾值事件,包括因为护盾损失和恢复在内的一切效果的显现等。
    /// 考虑以后加入Death类,作为静态函数,统一处理。
    /// </summary>
    /// <param name="info"></param>
    private void SPEvent(EventMgr.SPChangeEventInfo info)
    {
        //只负责实现当前挂载单位的效果
        if (info.Unit != this)
        {
            return;
        }

        if (GameCtrl.IsOnlineGame && IsLocal)
        {
            lock (deathRequestMutex)
            {
                if (!sendDeathRequest)
                {
                    if (IsLocal && info.CurrentValue <= 0)
                    {
                        sendDeathRequest = true;
                        Death();
                        DataSync.DestroyObj((byte)attributes.ID);
                    }
                }
            }
        }
        else
        {
            //SP过低,死亡
            if (info.CurrentValue <= 0)
            {
                Death();
            }
        }
    }
コード例 #7
0
        public void GivenTheFollowingDataSyncEditInput(Table table)
        {
            Assert.IsNotNull(table);

            foreach (var row in table.Rows)
            {
                //_editId = row["Id"];
                //_firstName = row["FirstName"];
                //_lastName = row["LastName"];
                //_email = row["Email"];
                //_mobileNumber = row["MobileNumber"];
            }
            Assert.IsNotNull(_editId);
            _editIdValue = ConvertToIntValue(_editId);

            //var temp = GetResponseById<DataSync>(_editIdValue);

            //Assert.IsTrue(_editIdValue > 0);
            //Assert.IsNotNull(_firstName);
            //Assert.IsNotNull(_email);
            //Assert.IsNotNull(_email.IsValidEmailAddress());

            _editItem = new DataSync
            {
                Id = _editIdValue
            };
        }
コード例 #8
0
        private async void btnSystemStart_ClickAsync(object sender, EventArgs e)
        {
            if (!HasInternetConnection())
            {
                return;
            }

            CL_Dialog.PleaseWait.Show("Data syncing...\r\nPlease Wait", ParentForm);

            SyncResult result = await DataSync.HandShakeAsync();

            if (result.Successful)
            {
                var resultSync = await DataSync.RunSyncSystem(_systemSyncList);

                if (resultSync.Successful)
                {
                    string msg = LoginUser.AddSqlUsers();
                    if (msg != null)
                    {
                        GuiCommon.ShowMessage(msg);
                    }
                }

                GuiCommon.ShowMessage(resultSync.DisplayMessage());
                AfterSync?.Invoke();
            }
            else
            {
                GuiCommon.ShowMessage(result.DisplayMessage());
            }

            CL_Dialog.PleaseWait.Hide();
        }
コード例 #9
0
    public void StartCreatePlayer(int playerID)
    {
        Debug.Log("Player ID = " + playerID);
        if (GameSceneInfo.Instance == null)
        {
            Debug.Log("Null instance");
        }
        else if (GameSceneInfo.Instance.spawnPoints[playerID] == null)
        {
            Debug.Log("Null spawnPoint");
        }
        Transform t = GameSceneInfo.Instance.spawnPoints[playerID].transform;

        if (GameCtrl.IsOnlineGame)
        {
            DataSync.CreateObject(UnitName.Player, t.position, t.rotation);
        }
        else
        {
            UnitData data = Gamef.LoadUnitData(UnitName.Player);
            Unit     unit = Gamef.Instantiate(data.LocalPrefab, t.position, t.rotation).GetComponent <Unit>();
            CameraGroupController.Instance.ResetTransform(t.position, t.rotation);
            GameCtrl.PlayerUnit = unit;
        }
    }
コード例 #10
0
        public static List <GitLabIssue> getIssues(string externalProject, DataSync sync, DateTime filterDate)
        {
            //create the URL and perform the GET request
            //Make sure the date-time is UTC
            filterDate = DateTime.SpecifyKind(filterDate, DateTimeKind.Utc);
            string issueUrl = sync.apiUrl + "/projects/" + sync.connectionString + "%2F" + externalProject + "/issues?updated_after=" + filterDate.ToString("o") + "&scope=all";

            List <GitLabIssue> externalSystemBugs = new List <GitLabIssue>();

            while (issueUrl != null)
            {
                Response httpResponse = InternalFunctions.httpGET(issueUrl, sync.externalPassword);
                //parse the JSON and get a list from it
                List <GitLabIssue> newIssues = JsonConvert.DeserializeObject <List <GitLabIssue> >(httpResponse.body);
                //add each new issue to the list
                foreach (GitLabIssue issue in newIssues)
                {
                    //get the comments about the specific issue
                    List <GitLabComment> comments = GetGitLabComments(externalProject, sync, issue);
                    issue.CommentsList = comments;
                    externalSystemBugs.Add(issue);
                }
                //get the next url from the link header
                issueUrl = nextUrl(httpResponse.headers);
            }

            return(externalSystemBugs);
        }
コード例 #11
0
        private async void btnSync_ClickAsync(object sender, EventArgs e)
        {
            CL_Dialog.PleaseWait.Show("Data syncing...\r\nPlease Wait", ParentForm);

            SyncResult result = await DataSync.HandShakeAsync();

            if (result.Successful)
            {
                var resultSync = await DataSync.RunSyncSystem(DataSync.GetSyncSystemList());

                if (resultSync.Successful)
                {
                    string msg = LoginUser.AddSqlUsers();
                    if (msg != null)
                    {
                        GuiCommon.ShowMessage(msg);
                    }
                }

                GuiCommon.ShowMessage(resultSync.DisplayMessage());
            }
            else
            {
                GuiCommon.ShowMessage(result.DisplayMessage());
            }

            CL_Dialog.PleaseWait.Hide();
        }
コード例 #12
0
        private async Task SynchronizeBodyBuildingDatas()
        {
            await DataSync.SynchronizeMusclesAsync(DbContext);

            await DataSync.SynchronizeMuscularGroupAsync(DbContext);

            await DataSync.SynchronizeBodyExercisesAsync(DbContext);
        }
コード例 #13
0
        private async void btnCoreCancel_ClickAsync(object sender, EventArgs e)
        {
            var result = await DataSync.CancelSyncCompanyCoreAsync(_coreSyncList);

            if (!result.Successful)
            {
                GuiCommon.ShowMessage(result.DisplayMessage());
            }
        }
コード例 #14
0
        /// <summary>
        ///     Retuns a linq expression to compare the specific Entity handled by the repositor
        ///     to the version in the last sync
        /// </summary>
        /// <param name="lastSync"></param>
        /// <returns></returns>
        public virtual Func <T, bool> GetVersionPredicate(DataSync lastSync)
        {
            var query =
                new Func <T, bool>(
                    v =>
                    AppUtility.IsHigherVersion(v.Version, lastSync.RowVersion));

            return(query);
        }
コード例 #15
0
        public void WhenICallTheAddDataSyncPostApiEndpointToAddADataSyncItChecksIfExistsPullsItemEditsItAndDeletesIt()
        {
            HttpResponseMessage response;

            _addItem = Add(_addItem, out response);

            Assert.IsNotNull(response);
            ScenarioContext.Current[AddItemKey] = response;
        }
コード例 #16
0
 void TryLogIn()
 {
     if (isListening)
     {
         ClientLauncher.Instance.OnConnected.RemoveListener(TryLogIn);
         isListening = false;
     }
     DataSync.Login(uName, key);
 }
コード例 #17
0
        /// <summary>
        /// Get the specific issue by ID
        /// </summary>
        /// <param name="sync"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static GitLabIssue getSpecificIssue(string externalProject, DataSync sync, int id)
        {
            string url = sync.apiUrl + "/projects/" + sync.connectionString + "%2F" + externalProject + "/issues/" + id;
            //perform the GET request
            Response    response = httpGET(url, sync.externalPassword);
            GitLabIssue issue    = JsonConvert.DeserializeObject <GitLabIssue>(response.body);

            return(issue);
        }
コード例 #18
0
 public static void InitData()
 {
     dataSync = LoadData();
     if (dataSync == null)
     {
         dataSync        = new DataSync();
         dataSync.device = new DeviceInfo();
     }
 }
コード例 #19
0
            public myTextEdit()
            {
                m_data       = DataSync.createInstance();
                m_data.m_qry = "select * from group_name";

                m_txt = new TextBox();
                m_txt.AutoCompleteMode   = AutoCompleteMode.Suggest;
                m_txt.AutoCompleteSource = AutoCompleteSource.CustomSource;
                m_txt.Validated         += M_txt_Validated;
            }
コード例 #20
0
        private async Task <bool> RefreshDataActionAsync()
        {
            DataIsRefreshing = true;
            bool result = await DataSync.SynchronizeTrainingWeeksAsync(_dbContext);

            RetreiveLocalData();
            SynchronizeData();
            DataIsRefreshing = false;
            return(result);
        }
コード例 #21
0
        private async Task SynchronizeWebDataAsync()
        {
            try
            {
                //Synchronise Web data to local database
                var userImageTask     = DataSync.SynchronizeUserImageAsync();
                var countriesTask     = DataSync.SynchronizeCountriesAsync();
                var musclesTask       = DataSync.SynchronizeMusclesAsync(_dbContext);
                var muscularGroupTask = DataSync.SynchronizeMuscularGroupAsync(_dbContext);
                var bodyExercisesTask = DataSync.SynchronizeBodyExercisesAsync(_dbContext);
                var translationsTask  = DataSync.SynchronizeTranslationsAsync(_dbContext);
                var trainingWeeksTask = DataSync.SynchronizeTrainingWeeksAsync(_dbContext);

                //Wait end of end of synchronisation
                SynchronizationLabel = Translation.Get(TRS.USER);
                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;
                await userImageTask;

                SynchronizationLabel = Translation.Get(TRS.COUNTRY);
                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;
                await countriesTask;

                SynchronizationLabel = Translation.Get(TRS.MUSCLES);
                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;
                await musclesTask;

                SynchronizationLabel = Translation.Get(TRS.MUSCULAR_GROUP);
                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;
                await muscularGroupTask;

                SynchronizationLabel = Translation.Get(TRS.BODY_EXERCISES);
                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;
                await bodyExercisesTask;

                SynchronizationLabel = Translation.Get(TRS.TRANSLATIONS);
                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;
                await translationsTask;

                SynchronizationLabel = Translation.Get(TRS.TRAINING_WEEK);
                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;
                await trainingWeeksTask;
            }
            catch (Exception except)
            {
                ILogger.Instance.Error("Unable to synchronize web data for MainViewModel", except);
            }
        }
コード例 #22
0
        /// <summary>
        /// Post a new comment to GitLab
        /// </summary>
        /// <param name="sync"></param>
        /// <param name="id"></param>
        /// <param name="body">In HTML</param>
        public static void postComment(string externalProject, DataSync sync, int id, string body, string username)
        {
            string url = sync.apiUrl + "/projects/" + sync.connectionString + "%2F" + externalProject + "/issues/" + id + "/notes";

            NewGitLabComment newComment = new NewGitLabComment();

            //add the posted by field
            newComment.body = addUsername(body, username);
            string toPost = JsonConvert.SerializeObject(newComment);

            string response = httpPOST(url, sync.externalPassword, toPost);
        }
コード例 #23
0
 /// <summary>
 /// Makes sure the comment doesn't already exist
 /// </summary>
 /// <param name="comment"></param>
 /// <param name="comments"></param>
 /// <returns></returns>
 public static bool noCommentExists(string comment, RemoteComment[] comments, DataSync sync)
 {
     comment = CommonMark.CommonMarkConverter.Convert(comment);
     foreach (RemoteComment c in comments)
     {
         if (trimComment(c.Text).Contains(trimComment(comment)))
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #24
0
 public void OnSignInClick()
 {
     if (userName.text == null || userName.text.Length < 1)
     {
         return;
     }
     if (password.text == null || password.text.Length < 6)
     {
         return;
     }
     DataSync.Login(userName.text, password.text);
 }
コード例 #25
0
 public void OnMatchClick()
 {
     if (isMatching && mt_timer > 3)
     {
         DataSync.CancelMatch();
         EventHandler.GetEventHandler().AddOnceListener(ProtoName.CancelMatch, OnCancelMatchBack);
     }
     else if (!isMatching)
     {
         EventHandler.GetEventHandler().AddOnceListener(ProtoName.Match, OnMatchBack);
         DataSync.Match();
     }
 }
コード例 #26
0
 public HttpResponseMessage AddThread(Thread threadMaster)
 {
     try
     {
         ThreadMaster thread = DataSync.ThreadSync(threadMaster);
         _unitOfWork.GetRepoInstance <ThreadMaster>().Add(thread);
         return(Request.CreateResponse(HttpStatusCode.OK, thread));
     }
     catch (Exception)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while executing AddThread"));
     }
 }
コード例 #27
0
    public void GetSave()
    {
        string value = "";

        value = PlayerPrefs.GetString("datasave", "");
        if (!string.IsNullOrEmpty(value))
        {
            data = JsonMapper.ToObject <DataSync>(value);
        }
        else
        {
            data = new DataSync();
            GetOwner();
        }
    }
コード例 #28
0
 private void _checkIsDone()
 {
     if (ao.isDone)
     {
         if (IsOnlineGame)
         {
             DataSync.CanControll();
         }
         else
         {
             StartCreatePlayer(0);
         }
         EventMgr.UpdateEvent.RemoveListener(_checkIsDone);
     }
 }
コード例 #29
0
        private async Task SynchronizeWebDataAsync()
        {
            try
            {
                //Synchronise Web data to local database
                SynchronizationLabel = Translation.Get(TRS.TRANSLATIONS);
                await DataSync.SynchronizeTranslationsAsync(DbContext);

                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;

                SynchronizationLabel = Translation.Get(TRS.COUNTRY);
                await DataSync.SynchronizeCountriesAsync();

                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;

                SynchronizationLabel = Translation.Get(TRS.USER);
                await DataSync.SynchronizeUserImageAsync();

                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;

                SynchronizationLabel = Translation.Get(TRS.COUNTRY);
                await DataSync.SynchronizeCountriesAsync();

                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;

                SynchronizationLabel = Translation.Get(TRS.BODY_EXERCISES);
                await SynchronizeBodyBuildingDatas();

                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;

                SynchronizationLabel = Translation.Get(TRS.TRAINING_JOURNAL);

                IProgress <double> progress = new Progress <double>(value => { SecondaryProgress = value; });
                await DataSync.SynchronizeTrainingWeeksAsync(DbContext, progress);

                SynchronizeProgress(_maxSynchronizeCount, _synchronizeCount);
                _synchronizeCount++;
            }
            catch (Exception except)
            {
                ILogger.Instance.Error("Unable to synchronize web data for MainViewModel", except);
            }
        }
コード例 #30
0
        /// <summary>
        /// Get the comments on a specific GitLab issue
        /// </summary>
        /// <param name="issue"></param>
        /// <param name="connectionString"></param>
        /// <param name="externalLogin"></param>
        /// <param name="externalPassword"></param>
        /// <returns></returns>
        public static List <GitLabComment> GetGitLabComments(string externalProject, DataSync sync, GitLabIssue issue)
        {
            List <GitLabComment> comments = new List <GitLabComment>();
            string url = sync.apiUrl + "/projects/" + sync.connectionString + "%2F" + externalProject + "/issues/" + issue.IId + "/notes";

            //go through all of the comments pages
            while (url != null)
            {
                Response             httpResponse = httpGET(url, sync.externalPassword);
                List <GitLabComment> newComments  = JsonConvert.DeserializeObject <List <GitLabComment> >(httpResponse.body);
                comments.AddRange(newComments);
                url = nextUrl(httpResponse.headers);
            }

            return(comments);
        }
コード例 #31
0
        private void Sincronizar(object sender, RoutedEventArgs e)
        {
            RedEmpleoOffLineEntities db = new RedEmpleoOffLineEntities();
            string Usuario = LebelUsuario.Content.ToString();
            string UsurioUtente = (from u in db.UsuariosPuntos
                              where u.Usuario.ToString().ToLower().Equals(Usuario.ToLower(), StringComparison.OrdinalIgnoreCase)
                              select u.Redempleo_UTENTE).First().ToString();

            var Allpersonas = (from p in db.Personas where p.Estado.Equals(null)
                              select new { Id = p.Id, PrimerNombre = p.PrimerNombre, SegundoNombre = p.SegundoNombre, PrimerApellido = p.PrimerApellido, SegundoApellido = p.SegundoApellido, Sexo = p.Sexo, TipoDocumento = p.TipoDocumento, NoDocumento = p.NoDocumento, FechaNacimiento = p.FechaNacimiento, Usuario = p.Usuario, Contrasena = p.Contrasena, Departamento = p.Departamento, Ciudad = p.Ciudad, Direccion = p.Direccion, Barrio = p.Barrio, Telefono = p.Telefono, Celular = p.Celular, CorreoElectronico = p.CorreoElectronico, CentroEmpleo = p.CentroEmpleo,Fecha_Creacion = p.Fecha_Creacion, Redempleo_UTENTE = UsurioUtente }).ToList();
            List<Listado> Listlistado = new List<Listado>();
            foreach (var per in Allpersonas)
            {
                Listado listado = new Listado();
                listado.Id = Convert.ToInt64(per.Id);
                listado.PrimerNombre = per.PrimerNombre;
                listado.SegundoNombre = per.SegundoNombre;
                listado.PrimerApellido = per.PrimerApellido;
                listado.SegundoApellido = per.SegundoApellido;
                listado.Sexo = per.Sexo;
                listado.TipoDocumento = per.TipoDocumento;
                listado.NoDocumento = per.NoDocumento;
                listado.FechaNacimiento = per.FechaNacimiento.ToString("yyyy-MM-dd hh:mm:ss");
                listado.Usuario = per.Usuario;
                listado.Contrasena = per.Contrasena;
                listado.Departamento = per.Departamento;
                listado.Ciudad = per.Ciudad;
                listado.Direccion = per.Direccion;
                listado.Barrio = per.Barrio;
                listado.Telefono = per.Telefono;
                listado.Celular = per.Celular;
                listado.CorreoElectronico = per.CorreoElectronico;
                listado.CentroEmpleo = per.CentroEmpleo;
                listado.Fecha_Creacion = per.Fecha_Creacion.ToString("yyyy-MM-dd hh:mm:ss");
                listado.Redempleo_UTENTE = per.Redempleo_UTENTE;
                Listlistado.Add(listado);
            }

            UsuariosPuntos Auth = (from u in db.UsuariosPuntos
                                   where u.Usuario.ToString().ToLower().Equals(Usuario.ToLower(), StringComparison.OrdinalIgnoreCase)
                                   select u).FirstOrDefault();
            DataSync dataSync = new DataSync();
            dataSync.listado = Listlistado;
            dataSync.usuariosPuntos = Auth;

            string jsonContent = JsonConvert.SerializeObject(dataSync);

            jsonContent = Regex.Replace(jsonContent, "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
            //string url = "http://serviciodeempleo.gov.co:9095/api/redempleo/save/postPersonas";
            //string url = "http://ivandarioperill/RedEmpleoII/api/redempleo/save/postPersonas";
            string url = "http://*****:*****@"application/json";
            Mensage relustado = null;
            bool conexion= false;
            try
            {
                using (Stream dataStream = request.GetRequestStream()) {
                    dataStream.Write(byteArray, 0, byteArray.Length);
                }
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
                    //relustado = response.ToString();
                    if (response.StatusCode != HttpStatusCode.OK)
                        throw new Exception(String.Format(
                        "Server error (HTTP {0}: {1}).",
                        response.StatusCode,
                        response.StatusDescription));
                    using (Stream data = response.GetResponseStream())
                    using (var reader = new StreamReader(data))
                    {
                        string text = reader.ReadToEnd();
                       // var jobj = (JObject)JsonConvert.DeserializeObject(text);
                        relustado = JsonConvert.DeserializeObject<Mensage>(text);
                        conexion = true;
                    }
                }
            }
            catch (WebException ex) {
                MessageBox.Show("No hay conexion con el servidor: " + ex.Status +" ");
            }
            if (conexion)
            {
                if (relustado != null)
                {
                    foreach (ResultadoCollection resultadoCollection in relustado.resultadoCollection)
                    {
                        Personas persona = db.Personas.Find(resultadoCollection.PersonasOffline_Id);
                        persona.Fecha_Sincronizacion = DateTime.ParseExact(resultadoCollection.FechaSincronizacion, "yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture);
                        //sincronisacion exitosa
                        if (resultadoCollection.SyncOK)
                        {
                            persona.AllowEdit = false;
                            persona.Estado = true;
                        }
                        // Error Al  guardar
                        if (resultadoCollection.ErrorGuardar)
                        {
                            persona.Estado = false;
                            persona.AllowEdit = true;
                        }
                        //Persona Existe
                        if (resultadoCollection.personaexiste)
                        {
                            persona.Estado = false;
                            persona.AllowEdit = true;
                        }
                        //Conbinacion TipoDoc NoDocumento Existe
                        if (resultadoCollection.TipoDocDocumentoexiste)
                        {
                            persona.Estado = false;
                            persona.AllowEdit = true;
                        }
                        //Usuario Existe
                        if (resultadoCollection.usuarioexiste)
                        {
                            persona.Estado = false;
                            persona.AllowEdit = true;
                            persona.UsuarioValido = true;
                        }
                        persona.Respuesta = resultadoCollection.Respuesta;
                        persona.RedEmpleoID = resultadoCollection.Redempleo_Id;
                        try
                        {
                            db.Entry(persona).State = EntityState.Modified;
                            db.SaveChanges();
                        }
                        catch (DbEntityValidationException ex)
                        {
                            // Retrieve the error messages as a list of strings.
                            var errorMessages = ex.EntityValidationErrors
                            .SelectMany(x => x.ValidationErrors)
                            .Select(x => x.ErrorMessage);

                            // Join the list to a single string.
                            var fullErrorMessage = string.Join("; ", errorMessages);

                            // Combine the original exception message with the new one.
                            var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);
                            MessageBox.Show(exceptionMessage);
                        }
                    }
                    int oferentesSincronizados = (from o in relustado.resultadoCollection where o.SyncOK.Equals(true) select o.PersonasOffline_Id).ToList().Count();
                    int oferentesEsistentes = (from o in relustado.resultadoCollection where o.personaexiste.Equals(true) || o.TipoDocDocumentoexiste.Equals(true) select o.PersonasOffline_Id).ToList().Count();
                    int oferentesUsuarioExistente = (from o in relustado.resultadoCollection where o.usuarioexiste.Equals(true) select o.PersonasOffline_Id).ToList().Count();
                    MessageBox.Show("Sincronizacíon completa:\nTotal oferentes enviados => " + Listlistado.Count().ToString()
                        + "\nTotal oferentes procesados => " + relustado.resultadoCollection.Count().ToString()
                        + "\nTotal oferentes sincronizados => " + oferentesSincronizados.ToString()
                        + "\nTotal oferentes ya registrados => " + oferentesEsistentes.ToString()
                        + "\nTotal oferentes con usuario  existente => " + oferentesUsuarioExistente.ToString());
                    RefrescarDatagrid();
                }
                else
                {
                    MessageBox.Show("El no hay registros para sincronizar");
                }
            }
            else
            {
              //  MessageBox.Show("El no hay  registros para sincronizar");
            }
        }