/// <summary>
        /// Defaults the type manager.
        /// </summary>
        /// <returns></returns>
        public static ITypesManager DefaultTypeManager()
        {
            var typeBuilder     = TypesBuildersFactory.CreateDynamicTypeBuilder();
            var typesRepository = new TypesRepository(typeBuilder);

            return(new TypesManager(typesRepository));
        }
Beispiel #2
0
 public UnitOfWork(IDbContextFactory <APPDbContext> dbContextFactory, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor)
 {
     _dbContext                     = dbContextFactory.GetContext();
     UserRepository                 = new UserRepository(_dbContext);
     MenuRepository                 = new MenuRepository(_dbContext);
     RolesRepository                = new RolesRepository(_dbContext);
     Role_PermissionsRepository     = new Role_PermissionsRepository(_dbContext);
     AccountsRepository             = new AccountsRepository(_dbContext);
     AccountRolesRepository         = new AccountRolesRepository(_dbContext);
     CategoryRepository             = new CategoryRepository(_dbContext);
     Content_CategoriesRepository   = new Content_CategoriesRepository(_dbContext);
     AuthorsRepository              = new AuthorsRepository(_dbContext);
     GroupsRepository               = new GroupsRepository(_dbContext);
     NewsSourcesRepository          = new NewsSourcesRepository(_dbContext);
     TypesRepository                = new TypesRepository(_dbContext);
     ContentTypesRepository         = new ContentTypesRepository(_dbContext);
     Content_GroupsRepository       = new Content_GroupsRepository(_dbContext);
     TitleImagesRepository          = new TitleImagesRepository(_dbContext);
     MediasRepository               = new MediasRepository(_dbContext);
     ContentsRepository             = new ContentsRepository(_dbContext);
     QuanLyDonGiaNhuanButRepository = new QuanLyDonGiaNhuanButRepository(_dbContext);
     TheLoai_HeSoRepository         = new TheLoai_HeSoRepository(_dbContext);
     NhuanButRepository             = new NhuanButRepository(_dbContext);
     ContactRepository              = new ContactRepository(_dbContext);
 }
Beispiel #3
0
 public override void LoadArt(FileFormats.IniFile.IniSection art)
 {
     base.LoadArt(art);
     Rotors      = art.ReadBool("Rotors");
     CustomRotor = art.ReadBool("CustomRotor");
     Trailer     = TypesRepository.GetAnimType(art.ReadString("Trailer"));
     SpawnDelay  = art.ReadInt("SpawnDelay", 3);
 }
        private async void showTypes(string typeName)
        {
            progRing.IsActive   = true;
            progRing.Visibility = Visibility.Visible;

            TypesRepository t = new TypesRepository();

            try
            {
                List <Types> types;
                if (!string.IsNullOrEmpty(typeName))
                {
                    types = await t.GetTypesContains(typeName.ToString());
                }
                else
                {
                    types = await t.GetTypess();
                }
                TypesList.ItemsSource = types.OrderBy(e => e.TypeName);
            }
            catch (ApiException apiEx)
            {
                var sbuilder = new StringBuilder();
                sbuilder.AppendLine("Errors:");
                foreach (var error in apiEx.Errors)
                {
                    sbuilder.AppendLine("-" + error);
                }
                ProfessorOak.ShowMessage("Could not complete operation:", sbuilder.ToString());
                progRing.IsActive   = false;
                progRing.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                if (ex.InnerException.Message.Contains("server"))
                {
                    ProfessorOak.ShowMessage("Error", "No connection with server.");
                }
                else
                {
                    ProfessorOak.ShowMessage("Error", "Could not complete operation.");
                }
            }
            finally
            {
                progRing.IsActive   = false;
                progRing.Visibility = Visibility.Collapsed;
            }
        }
 private async void BtnSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         TypesRepository t = new TypesRepository();
         if (View.ID == 0)
         {
             await t.AddTypes(View);
         }
         else
         {
             await t.UpdateTypes(View);
         }
         Frame.GoBack();
     }
     catch (AggregateException ex)
     {
         string errorMsg = "";
         foreach (var exception in ex.InnerExceptions)
         {
             errorMsg += Environment.NewLine + exception.Message;
         }
         ProfessorOak.ShowMessage("One or more exceptions have occured:", errorMsg);
     }
     catch (ApiException apiEx)
     {
         var sbuilder = new StringBuilder();
         sbuilder.AppendLine(string.Format("HTTP Status Code: {0}", apiEx.StatusCode.ToString()));
         sbuilder.AppendLine("Errors:");
         foreach (var error in apiEx.Errors)
         {
             sbuilder.AppendLine("-" + error);
         }
         ProfessorOak.ShowMessage("There was a problem saving the Type:", sbuilder.ToString());
     }
     catch (Exception ex)
     {
         if (ex.InnerException.Message.Contains("Connection with the server"))
         {
             ProfessorOak.ShowMessage("Error", "No connection with the server.");
         }
         else
         {
             ProfessorOak.ShowMessage("Error", "Could not complete operation.");
         }
     }
 }
        private async void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            string sTitle = "Confirm Delete";
            string sMsg   = "Are you certain you want to delete " + View.TypeName + "?";
            ContentDialogResult result = await ProfessorOak.ConfirmDialog(sTitle, sMsg);

            if (result == ContentDialogResult.Secondary)
            {
                try
                {
                    TypesRepository t = new TypesRepository();
                    await t.DeleteTypes(View);

                    Frame.GoBack();
                }
                catch (AggregateException ex)
                {
                    string errorMsg = "";
                    foreach (var exception in ex.InnerExceptions)
                    {
                        errorMsg += Environment.NewLine + exception.Message;
                    }
                    ProfessorOak.ShowMessage("One or more exceptions have occured:", errorMsg);
                }
                catch (ApiException apiEx)
                {
                    var sbuilder = new StringBuilder();
                    sbuilder.AppendLine("Errors:");
                    foreach (var error in apiEx.Errors)
                    {
                        sbuilder.AppendLine("-" + error);
                    }
                    ProfessorOak.ShowMessage("Problem deleting the Type:", sbuilder.ToString());
                }
                catch (Exception)
                {
                    ProfessorOak.ShowMessage("Error", "Error deleting Type.");
                }
            }
        }
Beispiel #7
0
 /// <summary>
 /// Defaults the type manager.
 /// </summary>
 /// <returns></returns>
 public static ITypesManager DefaultTypeManager()
 {
     var typeBuilder = TypesBuildersFactory.CreateDynamicTypeBuilder();
     var typesRepository = new TypesRepository(typeBuilder);
     return new TypesManager(typesRepository);
 }
 internal static IEnumerable <UserTypeModel> GetAllUserTypes()
 {
     return(TypesRepository.GetAllUserTypes());
 }
Beispiel #9
0
 public TypesController(ILogger <TypesController> logger, TypesRepository repo)
 {
     _logger = logger;
     _repo   = repo;
 }
        private async void PopulateLists()
        {
            progRing.IsActive   = true;
            progRing.Visibility = Visibility.Visible;

            TypesRepository  t  = new TypesRepository();
            RouteRepository  r  = new RouteRepository();
            RegionRepository re = new RegionRepository();

            try
            {
                List <Types> types = await t.GetTypess();

                List <Route> route = await r.GetRoutes();

                List <Region> region = await re.GetRegions();

                types.Add(new Types {
                    ID = 0, TypeName = " - All Types"
                });
                route.Add(new Route {
                    ID = 0, RouteName = " - All Routes"
                });
                region.Add(new Region {
                    ID = 0, RegionName = " - All Regions"
                });
                App thisApp = Application.Current as App;
                thisApp.ActiveTypes   = types;
                thisApp.ActiveRoutes  = route;
                thisApp.ActiveRegions = region;
            }
            catch (ApiException apiEx)
            {
                var sbuilder = new StringBuilder();
                sbuilder.AppendLine("Errors: ");
                foreach (var error in apiEx.Errors)
                {
                    sbuilder.AppendLine("-" + error);
                }
                ProfessorOak.ShowMessage("Could not complete operation:", sbuilder.ToString());
                progRing.IsActive   = false;
                progRing.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                if (ex.InnerException.Message.Contains("Connection with the server"))
                {
                    ProfessorOak.ShowMessage("Error", "No connection with server. Ensure you have the proper connections and try again.");
                }
                else
                {
                    ProfessorOak.ShowMessage("Error", "Could not complete operation.");
                }
                progRing.IsActive   = false;
                progRing.Visibility = Visibility.Collapsed;
            }
            finally
            {
                progRing.IsActive   = false;
                progRing.Visibility = Visibility.Collapsed;
            }
        }