Пример #1
0
        private void Delete_click(object sender, RoutedEventArgs e)
        {
            using (SqliteConnection con = new SqliteConnection(path))
            {
                con.Open();
                int    a   = Convert.ToInt32(((ExGit.RepoModel)((Windows.UI.Xaml.FrameworkElement)sender).DataContext).repoID);
                string stm = "delete from tblrepo where tblrepoID=" + a;
                using (SqliteCommand cmd = new SqliteCommand(stm, con))
                {
                    cmd.ExecuteNonQuery();
                }
            }
            RepoModel repoModel = (ExGit.RepoModel)((Windows.UI.Xaml.FrameworkElement)sender).DataContext;

            inventoryList.Remove(repoModel);
        }
Пример #2
0
 public ObservableCollection <RepoModel> GetProducts()
 {
     try
     {
         var ImportedFiles = new ObservableCollection <RepoModel>();
         using (SqliteConnection con = new SqliteConnection(path))
         {
             con.Open();
             string stm = "SELECT * FROM tblRepo";
             using (SqliteCommand cmd = new SqliteCommand(stm, con))
             {
                 using (SqliteDataReader rdr = cmd.ExecuteReader())
                 {
                     while (rdr.Read())
                     {
                         var product = new RepoModel();
                         product.repoID            = rdr.GetInt32(0);
                         product.name              = rdr.IsDBNull(1) ? "null" : rdr.GetString(1);
                         product.repourl           = rdr.IsDBNull(2) ? "null" : rdr.GetString(2);
                         product.WorkingDirectory  = rdr.IsDBNull(3) ? null : rdr.GetString(3);
                         product.AutoTrack         = rdr.GetBoolean(4);
                         product.EnableDesNot      = rdr.GetBoolean(5);
                         product.NotificationEmail = rdr.IsDBNull(6) ? "null" : rdr.GetString(6);
                         product.CurrentBranch     = rdr.IsDBNull(7) ? "null" : rdr.GetString(7);
                         product.IsUntrackedRepo   = rdr.GetBoolean(8);
                         product.CreatedAt         = rdr.GetDateTime(9);
                         product.ModifiedAt        = rdr.GetDateTime(10);
                         product.RecentCheck       = rdr.IsDBNull(11) ? (DateTime?)null : rdr.GetDateTime(11);
                         product.IsActive          = rdr.GetBoolean(12);
                         ImportedFiles.Add(product);
                     }
                     return(ImportedFiles);
                 }
             }
         }
     }
     catch (Exception eSql)
     {
         Debug.WriteLine("Exception: " + eSql.Message);
     }
     return(null);
 }