예제 #1
0
        /// <summary>
        /// Método que Deserializa JSon a UPLOAD_LOG
        /// </summary>
        /// <returns>Regresa Dictionary<string,object></returns>
        /// <returns>Si no regresa null</returns>
        public bool GetDeserializeUpLoad(string upLoadLog)
        {
            bool val = false;
            Dictionary <string, object> res           = new Dictionary <string, object>();
            List <UPLOAD_LOG>           listUpLoadLog = new List <UPLOAD_LOG>();
            UPLOAD_LOG up = new UPLOAD_LOG();

            try
            {
                if (!String.IsNullOrEmpty(upLoadLog))
                {
                    //Prueba
                    res = (Dictionary <string, object>)JsonConvert.DeserializeObject(upLoadLog, typeof(Dictionary <string, object>));
                    foreach (var item in res)
                    {
                        up = JsonConvert.DeserializeObject <UPLOAD_LOG>(item.Value.ToString());
                    }
                    //inserta a la base local
                    InsertUploadLogLocal(up);
                    val = true;
                }
            }
            catch (Exception)
            {
                val = false;
            }

            return(val);
        }
예제 #2
0
        /// <summary>
        /// Método que serializa un POCO UPLOAD_LOG a Json
        /// </summary>
        /// <returns>Regresa un String en formato Json de UPLOAD_LOG</returns>
        /// <returns>Si no hay datos regresa null</returns>
        public string GetJsonUpLoadLog(UPLOAD_LOG upLoadLog)
        {
            string res = null;

            res = SerializerJson.SerializeParametros(upLoadLog);
            return(res);
        }
예제 #3
0
        /// <summary>
        /// Método que Deserializa JSon a List<UPLOAD_LOG>
        /// </summary>
        /// <returns>Regresa UPLOAD_LOG</returns>
        /// <returns>Si no regresa null</returns>
        public UPLOAD_LOG GetDeserializeUpLoadLog(string upLoadLog)
        {
            //UPLOAD_LOG listUpLoadLog = null;
            UPLOAD_LOG up = null;

            if (!String.IsNullOrEmpty(upLoadLog))
            {
                up = JsonConvert.DeserializeObject <UPLOAD_LOG>(upLoadLog);
            }
            return(up);
        }
예제 #4
0
 public void InsertUploadLogLocal(object element)
 {
     if (element != null)
     {
         using (var entity = new TAE2Entities())
         {
             UPLOAD_LOG uploadLog = (UPLOAD_LOG)element;
             entity.UPLOAD_LOG.AddObject(uploadLog);
             entity.SaveChanges();
         }
     }
 }
예제 #5
0
 public void insertElement(object element)
 {
     if (element != null)
     {
         using (var entity = new TAE2Entities())
         {
             UPLOAD_LOG uploadLog = (UPLOAD_LOG)element;
             uploadLog.UNID_UPLOAD_LOG = UNID.getNewUNID();
             entity.SaveChanges();
         }
     }
 }
        public void GetJsonUpLoadLogTest1()
        {
            UPLOAD_LOG newUpLoad = new UPLOAD_LOG()
            {
                UNID_USUARIO = 6543234567, PC_NAME = "isaac-pc", IP_DIR = "192.168.1.110"
            };
            UploadLogDataMapper target = new UploadLogDataMapper(); // TODO: Inicializar en un valor adecuado
            //UPLOAD_LOG upLoadLog = null; // TODO: Inicializar en un valor adecuado
            string expected = string.Empty;                         // TODO: Inicializar en un valor adecuado
            string actual;

            actual = target.GetJsonUpLoadLog(newUpLoad);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Compruebe la exactitud de este método de prueba.");
        }
예제 #7
0
        public string InsertUploadLogNew(object element)
        {
            string res = null;

            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    UPLOAD_LOG uploadLog = (UPLOAD_LOG)element;
                    entity.UPLOAD_LOG.AddObject(uploadLog);
                    entity.SaveChanges();
                    res = GetJsonUpLoadLog(uploadLog);
                }
            }
            return(res);
        }