Пример #1
0
        public TempLocations ToTempLoc(object original)
        {
            Ins_CommonLocationEntity obj = original as Ins_CommonLocationEntity;

            return(new TempLocations {
                CollectTime = obj.Date, SendTime = obj.Date, X = (decimal)obj.Longitude, Y = (decimal)obj.Latitude, UniqueId = obj.UniqueID, Type = "cellphone"
            });
        }
        public override object FromIns(byte[] bytes)
        {
            if (bytes.Length < MinLength - 2)
            {
                return(null);
            }

            Ins_CommonLocationEntity s = new Ins_CommonLocationEntity();

            s.UniqueID = UniqueID(EncodeingHelper.CutOff(bytes, 0, 4));
            s.Date     = DateTime.Now;
            try
            {
                s.Latitude  = LatLongitude(EncodeingHelper.CutOff(bytes, 10, 4));
                s.Longitude = LatLongitude(EncodeingHelper.CutOff(bytes, 14, 4));
            }
            catch (Exception)
            {
                s.ExceptionsPackage = InstructsHelper.GeneratePackage(new byte[] { 0x10, InsCode }, 0xFF);
            }
            //s.InqueryPackage= InstructsHelper.GeneratePackage(null, 0x30);
            return(s);
        }