Пример #1
0
        public static void Update()
        {
            Logger.MethodCalled("Database.Update()");
            var SavedDataManager = new DataSaver <SavedData>();

            SavedDataManager.SaveMyData(SavedData, "SavedData");
        }
Пример #2
0
        private static void SendLog()
        {
            try
            {
                var logDataSaver = new DataSaver <string>();
                var oldTodayLog  = logDataSaver.LoadMyData("logs");

                if (oldTodayLog != null)
                {
                    var obj = new JObject();
                    obj.Add("version", Constraints.ApiVersion);
                    obj.Add("username", Constraints.ApiUsername);
                    obj.Add("password", Constraints.ApiPassword);
                    var jsonReq = new JObject();
                    jsonReq.Add("type", ApiAction.SendLog);
                    var logObj    = new JObject();
                    var deviceObj = new JObject();
                    deviceObj.Add("id", DeviceHelper.Id);
                    deviceObj.Add("name", DeviceHelper.Name);
                    deviceObj.Add("platform", DeviceHelper.Platform);
                    deviceObj.Add("appVersion", DeviceHelper.AppVersion);
                    logObj.Add("device", deviceObj);
                    logObj.Add("actions", oldTodayLog);
                    jsonReq.Add("log", logObj);
                    obj.Add("request", jsonReq);

                    _byteArray = Encoding.UTF8.GetBytes(obj.ToString());
                    var request = HttpWebRequest.Create(ApiHelper.ApiUrl) as HttpWebRequest;
                    request.Method      = "POST";
                    request.ContentType = "application/json; charset=UTF-8";
                    request.BeginGetRequestStream(SendDataCallBack, request);
                }
            }
            catch { }
        }
Пример #3
0
        public static void Init()
        {
            Logger.MethodCalled("Database.Init()");
            var SavedDataManager = new DataSaver <SavedData>();

            SavedData = SavedDataManager.LoadMyData("SavedData") == null ? new SavedData() : SavedDataManager.LoadMyData("SavedData");
        }
Пример #4
0
        private static void loadTodayLog()
        {
            var logDataSaver = new DataSaver <string>();
            var oldTodayLog  = logDataSaver.LoadMyData("logs");

            if (oldTodayLog != null)
            {
                foreach (var log in oldTodayLog.Split('\n'))
                {
                    _buffer.Add(log);
                }
            }
        }
Пример #5
0
        public static void SaveStoredLog()
        {
            var sb = new StringBuilder();

            if (_buffer != null)
            {
                foreach (string s in _buffer)
                {
                    sb.AppendLine(s);
                }
            }

            var logDataSaver = new DataSaver <string>();

            logDataSaver.SaveMyData(sb.ToString(), "logs");
        }
Пример #6
0
        public static void Update()
        {
            DataSaver <List <Rezervasyon> > RezervasyonData = new DataSaver <List <Rezervasyon> >();

            RezervasyonData.SaveMyData(Rezervasyonlar, "Rezervasyonlar");

            DataSaver <string> NeredenData = new DataSaver <string>();

            NeredenData.SaveMyData(Nereden, "Nereden");

            DataSaver <string> NereyeData = new DataSaver <string>();

            NereyeData.SaveMyData(Nereye, "Nereye");

            DataSaver <DateTime> TarihData = new DataSaver <DateTime>();

            TarihData.SaveMyData(Tarih, "Tarih");

            DataSaver <List <Yolcu> > KisilerData = new DataSaver <List <Yolcu> >();

            KisilerData.SaveMyData(FavoriKisiler, "Kisiler");
        }
Пример #7
0
        public static void Fill()
        {
            DataSaver <List <Rezervasyon> > RezervasyonData = new DataSaver <List <Rezervasyon> >();

            Rezervasyonlar = RezervasyonData.LoadMyData("Rezervasyonlar") == null ? new List <Rezervasyon>() : RezervasyonData.LoadMyData("Rezervasyonlar");

            DataSaver <string> NeredenData = new DataSaver <string>();

            Nereden = NeredenData.LoadMyData("Nereden");

            DataSaver <string> NereyeData = new DataSaver <string>();

            Nereye = NereyeData.LoadMyData("Nereye");

            DataSaver <DateTime> TarihData = new DataSaver <DateTime>();

            Tarih = TarihData.LoadMyData("Tarih");

            DataSaver <List <Yolcu> > KisilerData = new DataSaver <List <Yolcu> >();

            FavoriKisiler = KisilerData.LoadMyData("Kisiler") == null ? new List <Yolcu>() : KisilerData.LoadMyData("Kisiler");
        }
Пример #8
0
        private static void RemoveLogs()
        {
            var logDataSaver = new DataSaver <string>();

            logDataSaver.SaveMyData(string.Empty, "logs");
        }