Esempio n. 1
0
        public void CreateSchema(string connectionName = null)
        {
            string script = GetEmbeddedResourceFile("Tiraggo.AspNet.Identity.Schema.sql");

            // split script on GO command
            IEnumerable <string> commandStrings = Regex.Split(script, @"^\s*GO\s*$", RegexOptions.Multiline | RegexOptions.IgnoreCase);

            using (tgTransactionScope scope = new tgTransactionScope())
            {
                tgUtility util = new tgUtility();
                if (connectionName != null)
                {
                    util.ConnectionServiceOverride(connectionName);
                }

                foreach (string commandString in commandStrings)
                {
                    if (!String.IsNullOrWhiteSpace(commandString))
                    {
                        switch (commandString)
                        {
                        case "SET ANSI_NULLS ON":
                        case "SET QUOTED_IDENTIFIER ON":
                            continue;

                        default:
                            util.ExecuteNonQuery(tgQueryType.Text, commandString);
                            break;
                        }
                    }
                }

                scope.Complete();
            }
        }
Esempio n. 2
0
 public void Delete(TVShows show)
 {
     if (this.MessageBoxService.ShowMessage("Are you sure you wish to delete the selected show?", "Confirm", MessageButton.YesNo, MessageIcon.Question) == MessageResult.Yes)
     {
         try
         {
             this.SplashScreenService.ShowSplashScreen();
             using (tgTransactionScope scope = new tgTransactionScope())
             {
                 show.MarkAsDeleted();
                 this.TVShowsCollection.Save();
                 this.Shows.Remove(show);
                 scope.Complete();
             }
             this.SplashScreenService.HideSplashScreen();
         }
         catch (Exception ex)
         {
             this.SplashScreenService.HideSplashScreen();
             this.MessageBoxService.ShowMessage(ex.Message, "Error");
         }
     }
 }