/// <summary> /// Update de valores do formulario de produto /// </summary> /// <param name="form">Form.</param> /// <param name="idProd">Identifier prod.</param> /// <param name="idVisita">Identifier visita.</param> /// <param name="latitude">Latitude.</param> /// <param name="longitude">Longitude.</param> /// <param name="status">Status.</param> internal void InsertUpdateValues(FormSchemasRestModel.FormSchema form, string idProd, string idVisita, double latitude, double longitude, StatusAPI status, int batery) { var param = new object[] { JsonConvert.SerializeObject(form), latitude, longitude, batery, (int)status, (int)StatusAPI.INICIADO, idProd, idVisita }; database.QueryAsync <TB_TAREFAS>("UPDATE TB_TAREFAS SET FORMULARIO = ? , LAT = ? , LONG = ? , BATERIA = ?" + ", STATUS = ?, STATUSCACHE = ? " + " WHERE PRODUTO_ID = ? AND VISITA_ID = ?", param).Wait(); }
internal string SerializeObject(List <TB_TAREFAS> tarefasTB, TB_VISITA visita) { var modelToSerialize = new FormSchemasRestModel.Result { formularios = new List <FormSchemasRestModel.FormSchema>() }; foreach (var item in formController) { var form = new FormSchemasRestModel.FormSchema(); form = item.Model.CamposForm; form.ID = item.Model.Id_form_server; form.tipo = item.Model.Tipo; modelToSerialize.formularios.Add(form); } if (tarefasTB != null && tarefasTB.Count > 0) { modelToSerialize.lat = tarefasTB[0].LAT.ToString().Replace(",", "."); modelToSerialize.lng = tarefasTB[0].LONG.ToString().Replace(",", "."); modelToSerialize.bateriaInicial = tarefasTB[0].BATERIA.ToString(); modelToSerialize.bateriaFinal = tarefasTB[0].BATERIA.ToString(); } else { modelToSerialize.lat = "0"; modelToSerialize.lng = "0"; modelToSerialize.bateriaInicial = "0"; modelToSerialize.bateriaFinal = "0"; } modelToSerialize.inicioVisita = visita.INICIO; if (!string.IsNullOrEmpty(visita.FIM)) { modelToSerialize.fimVisita = visita.FIM; } else { modelToSerialize.fimVisita = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); } modelToSerialize.statusVisita = (int)StatusVisitaServer.ANDAMENTO; return(JsonConvert.SerializeObject(modelToSerialize)); }