public static void Initialization() { sAttr = ConfigurationManager.AppSettings["Mode"]; switch (sAttr) { case "0": { Path = AppDomain.CurrentDomain.BaseDirectory; usersandawardsLogic = Dependencies.UsersAndAwardsDBLogic; } break; case "1": { Path = AppDomain.CurrentDomain.BaseDirectory; usersandawardsLogic = Dependencies.UsersAndAwardsFileLogic; ReadFiles(Path + @"App_Data"); } break; default: { Path = AppDomain.CurrentDomain.BaseDirectory; usersandawardsLogic = Dependencies.UsersAndAwardsFileLogic; ReadFiles(Path + @"App_Data"); } break; } }
public static void Refresh(string path) { sAttr = ConfigurationManager.AppSettings["Mode"]; switch (sAttr) { case "0": { usersandawardsLogic = Dependencies.UsersAndAwardsDBLogic; } break; case "1": { usersandawardsLogic = Dependencies.UsersAndAwardsFileLogic; ReadFiles(path); } break; default: { path = AppDomain.CurrentDomain.BaseDirectory; usersandawardsLogic = Dependencies.UsersAndAwardsFileLogic; ReadFiles(path); } break; } PrintMenu(); SelectMode(InputMode()); }
static DependencyResolver() { switch (ConfigurationManager.AppSettings["DAL"]) { case "Memory": _userDao = new UserOnMemoryDAO(); _awardDao = new AwardOnMemoryDAO(); _usersAndAwardsDao = new UsersAndAwardsOnMemoryDAO(); break; case "File": _userDao = new UserOnFileDAO(); _awardDao = new AwardOnFileDAO(); _usersAndAwardsDao = new UsersAndAwardsOnFileDAO(); _webUserDao = new WebUserFileDao(); _userRoleDao = new UserRoleFileDAO(); _imagesDao = new ImagesDAO(); _usersAndImagesDao = new UsersAndImagesOnFileDAO(); _awardsAndImagesDao = new AwardsAndImagesDAO(); break; case "Database": _userDao = new UserDatabaseDAO(); _awardDao = new AwardDatabaseDAO(); _usersAndAwardsDao = new UsersAndAwardsDatabaseDAO(); _webUserDao = new WebUserDatabaseDAO(); _userRoleDao = new UserRoleDatabaseDAO(); _imagesDao = new ImagesDatabaseDAO(); _usersAndImagesDao = new UsersAndImagesDatabaseDAO(); _awardsAndImagesDao = new AwardsAndImagesDatabaseDAO(); break; } _usersAndAwardsLogic = new UsersAndAwardsLogic(_usersAndAwardsDao); _webUserLogic = new WebUserLogic(_webUserDao); _userRoleLogic = new UserRoleLogic(_userRoleDao); _usersAndImagesLogic = new UsersAndImagesLogic(_usersAndImagesDao); _awardsAndImagesLogic = new AwardsAndImagesLogic(_awardsAndImagesDao); _userLogic = new UserLogic(_userDao, _usersAndAwardsDao, _usersAndImagesLogic); _awardLogic = new AwardLogic(_awardDao, _usersAndAwardsDao, _awardsAndImagesLogic); _imagesLogic = new ImagesLogic(_imagesDao, _usersAndImagesLogic, _awardsAndImagesLogic); }