I have a mobile application that calls different services that I have in c#
with Wcf
. The issue is that I have one of those services in which the user from the mobile sends an object called Medicion
. This object has a list of CeldaKeyValUpload
.
public class Medicion
{
[DataMember]
public string medicion_user_email { get; set; }
[DataMember]
public string medicion_user_nombre { get; set; }
[DataMember]
public string medicion_app_os { get; set; }
[DataMember]
public string medicion_app_version { get; set; }
[DataMember]
public string medicion_latitud { get; set; }
[DataMember]
public string medicion_longitud { get; set; }
[DataMember]
public string medicion_sala_id { get; set; }
[DataMember]
public string medicion_codigo_empresa { get; set; }
[DataMember]
public string medicion_codigo_cadena { get; set; }
[DataMember]
public string medicion_codigo_modulo { get; set; }
[DataMember]
public string medicion_categoria_codigo { get; set; }
[DataMember]
public List<CeldaKeyValUpload> celdas { get; set; }
}
Y
public class CeldaKeyValUpload
{
[DataMember]
public int celda_id { get; set; }
[DataMember]
public string celda_key_codigo { get; set; }
[DataMember]
public string celda_key_valor { get; set; }
}
The list that can reach me from the mobile can be very extensive, say an example 200 records. In my database I have two tables one called MedicionEncabezado
and MedicionDetalle
. In the first table, everything of class Medicion
is saved except the list CeldaKeyValUpload
, since it is saved in MedicionDetalle
.
The problem I have is that I put myself in the case that for any reason the mobile loses internet and can not upload these 200 records. For this I have created temporary tables called TmpMedicionEncabezado
and TmpMedicionDetalle
. When the device sends the data, it loads these temporary tables, and once it finishes successfully, the load fills my official tables with the data . This is why I need to create a Stored Procedure
that is responsible for passing the data from the temporary tables to the official tables. Why do I do this? To not fill my junk data table.
The problem I have is that I do not know how to get the data from the temporary tables and save them in the official tables. I still do not handle much in sql-server-2005
.