public UserAwardLogic()
        {
            string mode;

            try
            {
                mode = ConfigurationManager.AppSettings["DataMode"];
            }

            catch (Exception e)
            {
                Logger.Logger.WriteLog(e);
                throw new Exception("Some problem with configuration file", e);
            }

            try
            {
                switch (mode)
                {
                case "Files":
                {
                    dal_users      = new _EPAM_DALFile.DALFileUser();
                    dal_awards     = new _EPAM_DALFile.DALFileAward();
                    dal_user_award = new _EPAM_DALFile.DALFileUserAward();
                }

                break;

                case "Collection":
                {
                    dal_users      = new _EPAM_DALCollection.DALUser();
                    dal_awards     = new _EPAM_DALCollection.DALAward();
                    dal_user_award = new  _EPAM_DALCollection.DALUserAward();
                }

                break;

                case "DATABASE":
                {
                    dal_users      = new _EPAM_DALDATABASE.User();
                    dal_awards     = new _EPAM_DALDATABASE.Award();
                    dal_user_award = new _EPAM_DALDATABASE.UserAward();
                    dal_image      = new _EPAM_DALDATABASE.Image();
                }

                break;
                }
            }

            catch (Exception e)
            {
                Logger.Logger.WriteLog(e);
                throw e;
            }
        }
示例#2
0
        public AwardLogic()
        {
            string mode;

            try
            {
                mode = ConfigurationManager.AppSettings["DataMode"];
            }

            catch (Exception e)
            {
                Logger.Logger.WriteLog(e);
                throw new Exception("Some problem with configuration file", e);
            }

            try
            {
                switch (mode)
                {
                case "Files":
                {
                    string way = Environment.CurrentDirectory + @"\LogAward.txt";
                    dal = new _EPAM_DALFile.DALFileAward();
                }

                break;

                case "Collection":
                {
                    dal = new _EPAM_DALCollection.DALAward();
                }

                break;

                case "DATABASE":
                {
                    dal       = new _EPAM_DALDATABASE.Award();
                    dal_image = new _EPAM_DALDATABASE.Image();
                }

                break;
                }
            }

            catch (Exception e)
            {
                Logger.Logger.WriteLog(e);
                throw e;
            }
        }