Ejemplo n.º 1
0
		public async void TestSQLiteService(){
			
			SQLiteService sqliteService = new SQLiteService (new SQLitePlatformWin32(), await GetPath("VTSTest"));

			VacationInfoDTO person = new VacationInfoDTO {
				Date="",
				ImageSRC="test",
				Id=12,
				Status="qwe",
				VacationType = "asd"
			};

			await sqliteService.Insert<VacationInfoDTO> (person);
			var personTest =await sqliteService.Get<VacationInfoDTO>(person.Id.ToString());
			Assert.AreNotEqual (person, personTest,"Message Insert or Get error");

			person.ImageSRC="https://ru.wikipedia.org/wiki";
			await sqliteService.Update<VacationInfoDTO> (person);
			personTest =await sqliteService.Get<VacationInfoDTO>(person.Id.ToString());
			Assert.IsTrue(person.ImageSRC == personTest.ImageSRC,"Message Update or Get error");

			await sqliteService.Delete<VacationInfoDTO>(person.Id.ToString());
			personTest =await sqliteService.Get<VacationInfoDTO>(person.Id.ToString());
			Assert.IsNull (personTest,"Message Delete error");
		}
Ejemplo n.º 2
0
        private void GetUsuarioInfoResult(FBResult result)
        {
            if (!string.IsNullOrEmpty(result.Error))
            {
                Debug.LogError(result.Error);
            }
            else
            {
                var json = new JSONObject(result.Text);
                var user = new Usuario(json);

                var modelPool = ModelPoolManager.GetInstance();

                if (!modelPool.Contains("Usuario"))
                {
                    user.email = user.email.Replace("\\u0040", "@");
                    ModelPoolManager.GetInstance().Add("Usuario", user);

                    using (var sqliteService = new SQLiteService())
                    {
                        bool isInDB = false;
                        var  query  = "SELECT * FROM Usuario WHERE idUsuarioFacebook = " + user.idUsuarioFacebook.Value;
                        using (var reader = sqliteService.SelectQuery(query))
                        {
                            if (reader.Read())
                            {
                                isInDB = true;
                            }
                            else
                            {
                                isInDB = false;
                            }
                        }

                        if (!isInDB)
                        {
                            query = "SELECT MAX(id) as id FROM Usuario";

                            int id = 0;
                            using (var reader = sqliteService.SelectQuery(query))
                            {
                                int temp;
                                if (int.TryParse(Convert.ToString(reader["id"]), out temp))
                                {
                                    id = temp;
                                }
                            }

                            id++;
                            sqliteService.TransactionalQuery(
                                "INSERT INTO Usuario VALUES (" + id + ",'" + user.idUsuarioFacebook + "','" + user.nombre + "','" + user.apellido + "','" + user.email + "','" + user.gender + "');"
                                );
                        }
                    }

                    FB.API("/me/picture?width=128&height=128", Facebook.HttpMethod.GET, GetUsuarioInfoPhotoResult);
                    StartCoroutine(SendUserFacebookId(user));
                }
            }
        }
Ejemplo n.º 3
0
        public async Task <VacationInfoModel> GetVacationByIdFromSql(int id)
        {
            string            result   = String.Empty;
            VacationInfoModel vacation = null;

            try
            {
                if (sqliteService == null)
                {
                    sqliteService = new SQLiteService(_sqlitePlatform, await _fileSystemService.GetPath(_configuration.SqlDatabaseName));
                }
                if (sqliteService != null)
                {
                    var vacationInfoModelDTO = await sqliteService.Get <VacationInfoModelDTO>(id.ToString());

                    if (vacationInfoModelDTO != null)
                    {
                        vacation = _converter.ConvertToVacationInfoModel(vacationInfoModelDTO);
                    }
                }
            }
            catch (AggregateException e)
            {
                result   = e.InnerExceptions[0].Data["message"].ToString();
                vacation = null;
            }
            catch (Exception e)
            {
                result   = e.Message;
                vacation = null;
            }
            return(await Helper.Complete(vacation));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                // This just gets in the way.
                //this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            // Install the Voice Command Definition File

            var storageFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommands.xml"));

            await Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(storageFile);

            // Insert the M3_Initialize snippet here


#if SQLITE
            await SQLiteService.InitDb();
#endif

            SetupShell(args);

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 5
0
        private void SendPay()
        {
            models.Payment payment = new models.Payment();
            payment.id       = 0;
            payment.account  = account;
            payment.customer = user;
            payment.debt     = deuda;
            payment.paid     = deposito;
            payment.date     = DateTime.Now.ToString("dd/MM/yyyy hh:mm");

            SQLiteService sqlite = new SQLiteService();

            if (sqlite.InsertPay(payment) == "OK")
            {
                MessageBox.Show("PAGO REGISTRADO");
            }
            else
            {
                MessageBox.Show("ERROR DE SISTEMA");
            }

            if (WebService.PostTransaction(payment.account, payment.paid) != "OK")
            {
                MessageBox.Show("ERROR EN SERVIDOR");
            }

            device.Close();
            this.Parent.Parent.Controls[1].Text = "welcome";
        }
Ejemplo n.º 6
0
        public static void GenSQLite(string outPath)
        {
            var tablePath = IPath.Combine(Application.dataPath, "Resource/Table/");
            var xlslFiles = Directory.GetFiles(tablePath, "*.xlsx", SearchOption.AllDirectories);

            //
            if (Directory.Exists(outPath) == false)
            {
                Directory.CreateDirectory(outPath);
            }

            var _path = IPath.Combine(outPath, "Local.db");

            //
            sql = new SQLiteService(SqliteLoder.CreateConnetion(_path));
            foreach (var f in xlslFiles)
            {
                var excel = new ExcelUtility(f);
                var json  = excel.GetJson();
                Json2Sqlite(f, json);
            }

            sql.Close();
            EditorUtility.ClearProgressBar();
            Debug.Log("导出Sqlite完成!");
            AssetDatabase.Refresh();
        }
Ejemplo n.º 7
0
        private void ProcessRequest(object obj)
        {
            using (var service = new SQLiteService())
            {
                var idNodo = Convert.ToInt32(obj.GetType().GetProperty("nodo").GetValue(obj, null));

                var sql = "SELECT idUbicacion, edificio, nombre " +
                          "FROM Nodo " +
                          "WHERE idNodo = " + idNodo;

                using (var reader = service.SelectQuery(sql))
                {
                    while (reader.Read())
                    {
                        this.modelNode = new ModelNode()
                        {
                            name        = Convert.ToString(reader["nombre"]),
                            idNodo      = idNodo,
                            idUbicacion = Convert.ToInt32(reader["idUbicacion"])
                        };

                        var edificio = Convert.ToInt32(reader["edificio"]);
                        modelNode.isBuilding = (edificio == modelNode.idUbicacion ? true : false);
                    }
                }
            }

            UIUtils.FindGUI(name + "/TextBoxUbicacion/Label").GetComponent <UILabel>().text = modelNode.name;

            var mensaje = Convert.ToString(obj.GetType().GetProperty("mensaje").GetValue(obj, null));

            UIUtils.FindGUI(name + "/TextBoxMessage/Label").GetComponent <UILabel>().text = mensaje;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Try to Get The Favicon From the homepage Server
        /// Use Google tool, So please ensure your computer unblocked  Google
        /// </summary>
        ///

        public static async Task  TryUpdateIconSource(this FeedViewModel feedViewModel, string HomePageUrl)
        {
            if (feedViewModel.IconSrc.ToString() != string.Empty)
            {
                return;
            }
            if (HomePageUrl == string.Empty)
            {
                return;
            }

            //一般这个不会发生
            var feedId = feedViewModel.Id ?? -1;

            int  numberOfAttempts = 2;
            bool success          = false;

            // 尝试下载2次
            do
            {
                success = await WebIconDownloadTool.DownLoadIconFrom_IconUri(HomePageUrl, feedId.ToString());
            } while (!success && numberOfAttempts-- > 0);


            // 如果成功,更新IconSrc, iconsrc为下载的图片文件的文件名,否则IconSrc还会是默认的那个图标路径
            if (success)
            {
                feedViewModel.IconSrc = feedId.ToString() + ".png";
                await SQLiteService.UpdateFeedInfoAsync(feedViewModel.AbstractInfo());
            }
        }
Ejemplo n.º 9
0
        public override async Task <bool> PrepareView(params object[] data)
        {
            //string isRemember = LocalStorage.Storage[StorageKey.IsAccountRemember];
            //if (!string.IsNullOrEmpty(isRemember))
            //	IsRemembered = bool.Parse(isRemember);

            //Email = LocalStorage.Storage[StorageKey.UserEmail];
            //Password = LocalStorage.Storage[StorageKey.UserPassword];

            var user = await SQLiteService.FirstAsync <User>();

            if (user != null)
            {
                Email        = user.Email;
                Password     = user.Password;
                IsRemembered = user.IsRemember;
            }
            else
            {
                Email        = string.Empty;
                Password     = string.Empty;
                IsRemembered = false;
            }

            return(await Task.FromResult(true));
        }
Ejemplo n.º 10
0
        private void CellEditEnded(DataGridCellEditEndedEventArgs obj)
        {
            var normal = (obj.Row as FrameworkElement).DataContext as NormalAnimal;

            SQLiteService.AddUserFish(new UserFish {
                Name = normal.Name, Owned = normal.Owned, MuseumHave = normal.MuseumHave
            });
            if (_beforeEditOwned == false && normal.Owned == true)
            {
                BookCount += 1;
            }
            if (_beforeEditOwned == true && normal.Owned == false)
            {
                BookCount -= 1;
            }

            if (_beforeEditMuseum == false && normal.MuseumHave == true)
            {
                MuseumCount += 1;
            }
            if (_beforeEditMuseum == true && normal.MuseumHave == false)
            {
                MuseumCount -= 1;
            }
        }
Ejemplo n.º 11
0
        private void OnTouchResetButton(object sender, TouchEventArgs e)
        {
            StringBuilder sqlQueryBuilder = new StringBuilder();

            //Poner las fechas de la lista de los detalleUsuarioTourList en blanco
            foreach (var detalleUsuarioTour in detalleUsuarioTourList)
            {
                ////En la base de datos
                sqlQueryBuilder.Append(
                    "UPDATE DetalleUsuarioTour SET fechaInicio = null, fechaLlegada = null, fechaFin = null " +
                    "WHERE id = " + detalleUsuarioTour.idDetalleUsuarioTour.Value + ";"
                    );

                ////En la lista
                detalleUsuarioTour.fechaFin     = null;
                detalleUsuarioTour.fechaInicio  = null;
                detalleUsuarioTour.fechaLlegada = null;
            }

            using (var service = new SQLiteService())
            {
                service.TransactionalQuery(sqlQueryBuilder.ToString());
            }

            //Poner los hijos actualizados
            UpdateCreateScrollView();
        }
Ejemplo n.º 12
0
        public async Task ClearPreference()
        {
            try
            {
                if (sqliteService == null)
                {
                    sqliteService = new SQLiteService <PrefSql>(sqlitePlatform, await fileSystemService.GetPath(configuration.SqlDatabaseName));
                }
            }
            catch (Exception exp)
            {
                var err = exp.Message;
                sqliteService = null;
            }
            if (sqliteService != null)
            {
                try
                {
                    List <PrefSql> list = await sqliteService.Get();

                    if (list != null && list.Count != 0)
                    {
                        foreach (var item in list)
                        {
                            await sqliteService.Delete(item.Id.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    var err = ex.Message;
                    throw ex;
                }
            }
        }
Ejemplo n.º 13
0
        public async Task <string> GetPrefValue(PrefEnums key)
        {
            try
            {
                if (sqliteService == null)
                {
                    sqliteService = new SQLiteService <PrefSql>(sqlitePlatform, await fileSystemService.GetPath(configuration.SqlDatabaseName));
                }
            }
            catch (Exception exp)
            {
                sqliteService = null;
            }
            if (sqliteService != null)
            {
                try
                {
                    var oldprefSql = await sqliteService.Get(((int)key).ToString());

                    if (oldprefSql != null)
                    {
                        return(oldprefSql.Value);
                    }
                }
                catch (Exception ex)
                {
                    var err = ex.Message;
                    throw ex;
                }
            }
            return(null);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Clear all data in SQLite local DB
        /// </summary>
        /// <returns></returns>

        public async Task ClearMasterPair()
        {
            try
            {
                if (sqliteService == null)
                {
                    sqliteService = new SQLiteService <MasterSQL>(sqlitePlatform, await fileSystemService.GetPath(configuration.SqlDatabaseName));
                }
            }
            catch (Exception exp)
            {
                sqliteService = null;
            }
            if (sqliteService != null)
            {
                try
                {
                    List <MasterSQL> oldmasters = await sqliteService.Get();

                    if (oldmasters != null && oldmasters.Count != 0)
                    {
                        foreach (var master in oldmasters)
                        {
                            await sqliteService.Delete(master.Id.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    var err = ex.Message;
                    throw ex;
                }
            }
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            Console.WriteLine("=========================================");
            Console.WriteLine("      Conversor de CSV para SQLite       ");
            Console.WriteLine("=========================================");

            var distritos      = LoadDistritos();
            var concelhos      = LoadConcelhos(distritos);
            var codigosPostais = LoadTodosCP(distritos, concelhos);
            var apartados      = LoadTodosApartados(distritos, concelhos);

            dbService = new Service.SQLiteService();

            Console.WriteLine("Writing Distritos...");
            dbService.GravarDistritos(distritos);

            Console.WriteLine("Writing Concelhos...");
            dbService.GravarConcelhos(concelhos);

            Console.WriteLine("Writing Codigos Postais...");
            dbService.GravarCodigosPostais(codigosPostais);

            Console.WriteLine("Writing Apartados...");
            dbService.GravarApartados(apartados);

            Console.WriteLine("=========================================");

            dbService.Dispose();

            Console.WriteLine("Done.");
        }
Ejemplo n.º 16
0
        public async Task <int> SaveScreenShotToSql(ScreenShot screenShot)
        {
            int result = 0;

            if (screenShot == null)
            {
                return(result);
            }

            try
            {
                if (sqliteService == null)
                {
                    sqliteService = new SQLiteService <ScreenShotSQL>(sqlitePlatform, await fileSystemService.GetPath(configuration.SqlDatabaseName));
                }
            }
            catch (Exception exp)
            {
                sqliteService = null;
            }
            if (sqliteService != null)
            {
                try
                {
                    result = await sqliteService.Insert(converter.ConvertToScreenShotSQL(screenShot));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(await TaskHelper.Complete(result));
        }
Ejemplo n.º 17
0
        public IEnumerator FollowingAcceptance(long idFollower, string acceptanceStatus)
        {
            WWWForm form   = new WWWForm();
            var     idUser = "";

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                idUser = "******";
            }
            else
            {
                idUser = FB.UserId;
            }

            form.AddField("followed", idUser);
            form.AddField("follower", idFollower.ToString());
            form.AddField("status", acceptanceStatus);

            yield return(WebService.POST(SERVER_URL + "/usuario/followResponse", form,
                                         (status, response) =>
            {
                if (status)
                {
                    using (var sqlite = new SQLiteService())
                    {
                        sqlite.TransactionalQuery("DELETE FROM UserFollowingNotification WHERE idUsuarioFacebook = '" + idUser + "' and idFollower = '" + idFollower + "'");
                    }
                }
            }
                                         ));
        }
Ejemplo n.º 18
0
        public async void LoadData()
        {
            SQLiteService.LoadDatabase();
            CourseList = await CourseManager.GetCourseListFromDatabase();

            LessonList = await CourseManager.GetLessonListFromDatabase();
        }
Ejemplo n.º 19
0
 public async Task DeletePair()
 {
     try
     {
         if (sqliteService == null)
         {
             sqliteService = new SQLiteService <CodeResponceSQL>(sqlitePlatform, await fileSystemService.GetPath(configuration.SqlDatabaseName));
         }
     }
     catch (Exception exp)
     {
         sqliteService = null;
     }
     if (sqliteService != null)
     {
         try
         {
             await sqliteService.Delete("1");
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Ejemplo n.º 20
0
 public async Task DeleteVacationsInfoInSqlById(int id)
 {
     try
     {
         if (sqliteService == null)
         {
             sqliteService = new SQLiteService(_sqlitePlatform, await _fileSystemService.GetPath(_configuration.SqlDatabaseName));
         }
     }
     catch (Exception exp)
     {
         sqliteService = null;
     }
     if (sqliteService != null)
     {
         try
         {
             await sqliteService.Delete <VacationInfoModelDTO>(id.ToString());
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Ejemplo n.º 21
0
        public static async Task <bool> AddLesson(Lesson lesson, string year = null, string term = null)
        {
            var lessonList = ((App)App.Current).LessonList;

            lessonList.Add(lesson);
            SQLiteService.InsertLesson(lesson.id, lesson.courseId, lesson.week, lesson.day, lesson.homework, lesson.studyMaterial, lesson.studyState);
            return(true);
        }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            string exePath          = @"F:\C_shap\Git\MyORM\trunk\TestApp";
            string mySQL_conStr     = "Your MySQL connection string";
            string sqlServer_conStr = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + exePath + @"\TestDataBases\SQLServerDB.mdf" + ";Integrated Security=True;Connect Timeout=30";
            string sqlite_conStr    = @"Data Source=" + exePath + @"\TestDataBases\SQLiteDB.db";

            // step 1  SetConnectionString
            MySQLService.SetConnection(mySQL_conStr);
            SQLServerService.SetConnection(sqlServer_conStr);
            SQLiteService.SetConnection(sqlite_conStr);

            DataBaseTypesEnum DBType  = DataBaseTypesEnum.SQLite;
            SQLService        service = null;

            switch (DBType)
            {
            case DataBaseTypesEnum.MySQL:
            {
                //step 2 tell Service that which type of database you want to use in default
                ModelBase.SetDefaultService(DataBaseTypesEnum.MySQL);

                //step 3 create a new instance and use it
                service = new MySQLService();
                break;
            }

            case DataBaseTypesEnum.SQLServer:
            {
                ModelBase.SetDefaultService(DataBaseTypesEnum.SQLServer);
                service = new SQLServerService();
                break;
            }

            case DataBaseTypesEnum.SQLite:
            {
                ModelBase.SetDefaultService(DataBaseTypesEnum.SQLite);
                service = new SQLiteService();
                break;
            }
            }

            LoadById(service);

            ReadAll(service);

            ReadByCondition(service);

            ReadPageList(service);

            Update(service);

            Insert(service);

            Delete(service);

            Console.ReadKey();
        }
Ejemplo n.º 23
0
        public override Task OnLaunchedAsync(ILaunchActivatedEventArgs e)
        {
            // Load the database
            SQLiteService.LoadDatabase();

            this.NavigationService.Navigate(typeof(Views.MainPage));

            return(Task.FromResult <object>(null));
        }
Ejemplo n.º 24
0
        public async Task LoadData()
        {
            var con = await SQLiteService.GetDbConnection();

            var plants = await con.Table <Plant>().ToListAsync();

            Plants = plants;
            await con.CloseAsync();
        }
Ejemplo n.º 25
0
 public RestViewModel()
 {
     this._data = new SQLiteAccessService();
     this.SelectedRestaurant = new RestModel();
     this.NewRestaurant      = new RestModel();
     this.AddRestCommand     = new RelayCommand(insertRestaurant);
     this.Restaurants        = _data.GetRestaurants();
     this.DelRestCommand     = new RelayCommand(deleteRestaurant);
     this.UpdateRestCommand  = new RelayCommand(updateRestaurant);
 }
Ejemplo n.º 26
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            string folderPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            string dbPath     = Path.Combine(folderPath, "wineot.sqlite3");

            SQLiteService.SetupDatabase(dbPath, new  SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS());
            Console.WriteLine(dbPath);
            LoadApplication(new App());
            return(base.FinishedLaunching(app, options));
        }
Ejemplo n.º 27
0
        public static async Task <List <FeedViewModel> > GetFeedsAsync()
        {
            var feeds = (await SQLiteService.QueryAllFeeds()).Select(feedinfo => new FeedViewModel(feedinfo)).ToList();

            foreach (var feedviewmodel in feeds)
            {
                await feedviewmodel.LoadArticlesFromDb();

                // 如果需要加载就刷新一次,就在这里加多一个函数
            }
            return(feeds);
        }
        public async void LoadDataAsync()
        {
            var con = await SQLiteService.GetDbConnection();

            var littleAnimals = await con.Table <LittleAnimal>().ToListAsync();

            LittleAnimals = littleAnimals;
            //LittleAnimalDeatil = LittleAnimals[0];
            await con.CloseAsync();

            TodayIsWhoBrithday(LittleAnimals);
        }
Ejemplo n.º 29
0
        public async Task <LoginResponce> LogInOffline(string name, string password)
        {
            string result  = String.Empty;
            bool   success = false;

            try
            {
                if (sqliteService == null)
                {
                    sqliteService = new SQLiteService(_sqlitePlatform, await _fileSystemService.GetPath(_configuration.SqlDatabaseName));
                }
            }
            catch (Exception exp)
            {
                sqliteService = null;
            }
            try {
                if (sqliteService != null)
                {
                    LoginInfoDTO currentLoginInfo = new LoginInfoDTO();
                    currentLoginInfo.UserName = name;
                    currentLoginInfo.Password = SecurytyHash.CalculateSha1Hash(password);
                    result = _localizservice.Localize("NotSavedDataOffline");
                    List <LoginInfoDTO> listlogins = await sqliteService.Get <LoginInfoDTO>();

                    if (listlogins != null && listlogins.Count != 0)
                    {
                        foreach (LoginInfoDTO login in listlogins)
                        {
                            if (login.UserName == currentLoginInfo.UserName)
                            {
                                result = string.Empty;
                                if (login.Password == currentLoginInfo.Password)
                                {
                                    success = true;
                                    result  = string.Empty;
                                }
                                else
                                {
                                    result = _localizservice.Localize("IncorrectLoginOrPassword");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                result  = String.Format("Error = " + e.Message);
                success = false;
            }
            return(await Helper.Complete(new LoginResponce(success, result)));
        }
Ejemplo n.º 30
0
        //Get saved to local sql code A
        public async Task <Pair> GetPair()
        {
            Pair pair = null;

            try
            {
                if (sqliteService == null)
                {
                    sqliteService = new SQLiteService <CodeResponceSQL>(sqlitePlatform, await fileSystemService.GetPath(configuration.SqlDatabaseName));
                }
            }
            catch (Exception exp)
            {
                sqliteService = null;
            }
            if (sqliteService != null)
            {
                try
                {
                    CodeResponceSQL codeResponcesSQL = await sqliteService.Get("1");

                    if (codeResponcesSQL != null)
                    {
                        //DateTime saved = ConverterHelper.ConvertMillisecToDateTime(Convert.ToInt64(codeResponcesSQL.Date));
                        //DateTime expiredtime = saved.AddSeconds(configuration.TimeOutValidCodeASecond);
                        //DateTime now = DateTime.Now;
                        //bool exp = now > expiredtime;
                        pair = new Pair
                        {
                            CodeA             = codeResponcesSQL.Code,
                            CodeB             = 0,
                            ErrorMessage      = string.Empty,
                            isCodeAExpired    = (DateTime.Now > (ConverterHelper.ConvertMillisecToDateTime(Convert.ToInt64(codeResponcesSQL.Date)).AddSeconds(configuration.TimeOutValidCodeASecond))),
                            TimeOutValidCodeA = configuration.TimeOutValidCodeASecond
                        };
                    }
                }
                catch (Exception ex)
                {
                    pair = new Pair
                    {
                        CodeA             = 0,
                        CodeB             = 0,
                        ErrorMessage      = ex.Message,
                        isCodeAExpired    = true,
                        TimeOutValidCodeA = configuration.TimeOutValidCodeASecond
                    };
                }
            }

            return(pair);// await Helper.Complete(pair);
        }
Ejemplo n.º 31
0
        private void UpdateCreateScrollView()
        {
            var scrollView = UIUtils.FindGUI("MenuUsuarioTourSelection/ScrollView").transform;

            //Delete ScrollView Childrens
            UIUtils.DestroyChilds("MenuUsuarioTourSelection/ScrollView", true);

            using (var sqlService = new SQLiteService())
            {
                for (int i = 0; i < detalleUsuarioTourList.Count; i++)
                {
                    //Creando el item del Tree View con world coordinates
                    var item = (GameObject.Instantiate(scrollViewItemTemplate.gameObject) as GameObject).transform;

                    item.name = "DetalleUsuarioTourItem" + i;

                    //Agregando relacion de padre (Tree View List) - hijo (item del Tree View List)
                    item.parent = scrollView;

                    //Agregando la posicion relativa del hijo con relacion al padre
                    item.transform.localPosition = new Vector3(
                        scrollViewItemTemplate.localPosition.x,
                        scrollViewItemTemplate.localPosition.y - 65f * i,
                        scrollViewItemTemplate.localPosition.z
                        );

                    //Agregando la escala relativa del hijo con relacion al padre
                    item.localScale = scrollViewItemTemplate.localScale;

                    //Encontrando texto del un item (su hijo)
                    var itemText = item.FindChild("Label").GetComponent <UILabel>();

                    var sql = "SELECT NOD.nombre FROM PuntoReunionTour PUN, Nodo NOD " +
                              "WHERE PUN.id = " + detalleUsuarioTourList[i].idPuntoReunionTour + " AND PUN.idNodo = NOD.idNodo";

                    using (var result = sqlService.SelectQuery(sql))
                    {
                        if (result.Read())
                        {
                            itemText.text = Convert.ToString(result["nombre"]);
                        }
                    }

                    item.FindChild("checkImg").gameObject.SetActive(false);

                    if (detalleUsuarioTourList[i].fechaLlegada.HasValue || (i == 0 && detalleUsuarioTourList[i].fechaInicio.HasValue))
                    {
                        item.FindChild("checkImg").gameObject.SetActive(true);
                    }
                }
            }
        }
Ejemplo n.º 32
0
		public async Task SaveVacationInfo (VTSModel newItem)
		{
			ModelConverter converter = new ModelConverter ();

			SQLiteService sqliteService;
			try {
				sqliteService = new SQLiteService (_sqlitePlatform, await _fileSystem.GetPath ("VTS"));
			} catch {
				sqliteService = null;
			}
			VacationInfoDTO dt = converter.ConvertToVacationInfoDTO (newItem);
			await sqliteService.Insert<VacationInfoDTO> (dt);

			RestService restService = new RestService ("/api/Vacations", Server);
			var req = await restService.Post<VacationInfoModel> (converter.ConvertToVacationInfoModel(newItem));
		}
Ejemplo n.º 33
0
		public async Task<List<VTSModel>> GetVTSList ()
		{
			ModelConverter converter = new ModelConverter ();
			List<VacationInfoModel> listVacationInfoModel;

			try {
				RestService restService = new RestService ("/api/Vacations", Server);
				listVacationInfoModel = await restService.Get<VacationInfoModel> ();
			} catch (AggregateException e) {
				//ErrorMessage = e.InnerExceptions [0].Data ["message"].ToString ();
				listVacationInfoModel = null;
			}

			SQLiteService sqliteService;
			try {
				sqliteService = new SQLiteService (_sqlitePlatform, await _fileSystem.GetPath ("VTS"));
			} catch {
				sqliteService = null;
			}

			List<VTSModel> VTSViewModelList = new List<VTSModel> ();
			VTSModel newItem;

			listVacationInfoModel = new VacationInfoMockModel ().Vacations;


			if (listVacationInfoModel != null) {
				foreach (VacationInfoModel info in listVacationInfoModel) {
					newItem = converter.ConvertToVTSModel (info);
					VTSViewModelList.Add (newItem);
					if (sqliteService != null) {
						await sqliteService.Insert<VacationInfoDTO> (converter.ConvertToVacationInfoDTO (newItem));
					}
				}
			} else if(sqliteService != null) {
				List<VacationInfoDTO> vacationInfoList = await sqliteService.Get<VacationInfoDTO> ();
				if (vacationInfoList != null) {
					foreach (VacationInfoDTO info in vacationInfoList) {
						VTSViewModelList.Add (converter.ConvertToVTSModel (info));
					}
				}
			}
		
			return VTSViewModelList;
		}
Ejemplo n.º 34
0
		public async Task DeleteVacationInfo (string id)
		{
			ModelConverter converter = new ModelConverter ();

			SQLiteService sqliteService;
			try {
				sqliteService = new SQLiteService (_sqlitePlatform, await _fileSystem.GetPath ("VTS"));
			} catch {
				sqliteService = null;
			}

			await sqliteService.Delete<VacationInfoDTO> (id);

			RestService restService = new RestService ("/api/Vacations", Server);
			var req = await restService.Delete(id);
		}
Ejemplo n.º 35
0
		public async Task<VTSModel> GetVacationInfo (string id)
		{
			ModelConverter converter = new ModelConverter ();

			SQLiteService sqliteService;
			try {
				sqliteService = new SQLiteService (_sqlitePlatform, await _fileSystem.GetPath ("VTS"));
			} catch {
				sqliteService = null;
			}
			VacationInfoDTO info =await sqliteService.Get<VacationInfoDTO> (id);
			return  converter.ConvertToVTSModel(info);
		}