Exemple #1
0
        public static string GetWebsiteBuilderPath()
        {
            string catalog = AppUsers.GetCatalog();
            string path    = HostingEnvironment.MapPath(Format(CultureInfo.InvariantCulture, Path, catalog));

            return(path != null && !System.IO.Directory.Exists(path) ? Empty : path);
        }
Exemple #2
0
 public static IEnumerable <Content> GetContents()
 {
     using (var db = DbProvider.Get(ConnectionString.GetConnectionString(AppUsers.GetCatalog())).GetDatabase())
     {
         return(db.FetchBy <Content>(sql => sql.Where(c => c.IsHomepage)));
     }
 }
Exemple #3
0
 public static IEnumerable <MenuItemView> GetMenuItems(string menuName)
 {
     using (var db = DbProvider.Get(ConnectionString.GetConnectionString(AppUsers.GetCatalog())).GetDatabase())
     {
         return(db.FetchBy <MenuItemView>(sql => sql.Where(c => c.MenuName == menuName)).OrderBy(c => c.Sort));
     }
 }
Exemple #4
0
 public static User Get(string email)
 {
     using (var db = DbProvider.Get(ConnectionString.GetConnectionString(AppUsers.GetCatalog())).GetDatabase())
     {
         return(db.FetchBy <User>(sql => sql.Where(u => u.Email == email)).FirstOrDefault());
     }
 }
Exemple #5
0
        public static LoginResult Do(string email, int officeId, string challenge, string password, string browser, string ipAddress, string culture)
        {
            const string sql =
                "SELECT * FROM account.sign_in(@0::text, @1::integer, @2::text, @3::text, @4::text, @5::text, @6::text);";

            return(Factory.Get <LoginResult>(AppUsers.GetCatalog(), sql, email, officeId, challenge, password, browser, ipAddress, culture).FirstOrDefault());
        }
Exemple #6
0
 public static Contact GetContact(int contactId)
 {
     using (var db = DbProvider.Get(ConnectionString.GetConnectionString(AppUsers.GetCatalog())).GetDatabase())
     {
         return(db.FetchBy <Contact>(sql => sql.Where(c => c.ContactId.Equals(contactId))).FirstOrDefault());
     }
 }
Exemple #7
0
        public static DTO.Reset GetIfActive(string token)
        {
            const string sql =
                "SELECT * FROM account.reset_requests WHERE request_id=@0::uuid AND expires_on >= NOW() AND NOT confirmed;";

            return(Factory.Get <DTO.Reset>(AppUsers.GetCatalog(), sql, token).FirstOrDefault());
        }
Exemple #8
0
        public static string GetOverridePath()
        {
            string catalog = AppUsers.GetCatalog();
            string path    = HostingEnvironment.MapPath(string.Format(CultureInfo.InvariantCulture, Path, catalog));

            return(path != null && !Directory.Exists(path) ? string.Empty : path);
        }
Exemple #9
0
        public static LoginResult SignIn(string email, int officeId, string name, string token, string browser, string ipAddress,
                                         string culture)
        {
            const string sql = "SELECT * FROM account.google_sign_in(@0::text, @1::integer, @2::text, @3::text, @4::text, @5::text, @6::text);";

            return(Factory.Get <LoginResult>(AppUsers.GetCatalog(), sql, email, officeId, name, token, browser,
                                             ipAddress, culture).FirstOrDefault());
        }
Exemple #10
0
        public static string GetCurrentThemePath()
        {
            string catalog = AppUsers.GetCatalog();
            string path    = Path + "Themes/{1}/";
            string theme   = GetDefaultTheme();

            return(Format(CultureInfo.InvariantCulture, path, catalog, theme));
        }
Exemple #11
0
        public static DTO.Reset Request(InputModels.ResetInfo model)
        {
            const string sql = "SELECT * FROM account.reset_account(@0::text, @1::text, @2::text);";

            return
                (Factory.Get <DTO.Reset>(AppUsers.GetCatalog(), sql, model.Email, model.Browser, model.IpAddress)
                 .FirstOrDefault());
        }
Exemple #12
0
 public static IEnumerable <Contact> GetContacts()
 {
     using (var db = DbProvider.Get(ConnectionString.GetConnectionString(AppUsers.GetCatalog())).GetDatabase())
     {
         return(db.FetchBy <Contact>(sql => sql.Where(c => c.Status))
                .OrderBy(c => c.Sort)
                .ThenBy(c => c.ContactId));
     }
 }
Exemple #13
0
 public static PublishedContentView GetDefault()
 {
     using (var db = DbProvider.Get(ConnectionString.GetConnectionString(AppUsers.GetCatalog())).GetDatabase())
     {
         return
             (db.FetchBy <PublishedContentView>(sql => sql.Where(c => c.IsHomepage == true).Limit(1))
              .FirstOrDefault());
     }
 }
Exemple #14
0
        public static void Revoke(string clientToken)
        {
            if (string.IsNullOrWhiteSpace(clientToken))
            {
                return;
            }

            const string sql =
                "UPDATE account.access_tokens SET revoked=true, revoked_on = NOW() WHERE client_token=@0;";

            Factory.NonQuery(AppUsers.GetCatalog(), sql, clientToken);
        }
Exemple #15
0
        public async Task SendAsync()
        {
            string template = GetTemplate();
            string parsed   = ParseTemplate(template);
            string subject  = "Welcome to " + HttpContext.Current.Request.Url.Authority;
            string catalog  = AppUsers.GetCatalog();
            var    email    = this.GetEmail(this._user, subject, parsed);
            var    queue    = new MailQueueManager(catalog, email);

            queue.Add();
            await queue.ProcessMailQueueAsync(EmailProcessor.GetDefault());
        }
        protected ActionResult OnAuthenticated(LoginResult result)
        {
            if (!result.Status)
            {
                return(Json(result));
            }
            var        globalLoginId = AppUsers.GetMetaLoginId(AppUsers.GetCatalog(), result.LoginId);
            HttpCookie cookie        = AuthenticationManager.GetCookie(globalLoginId.ToString(CultureInfo.InvariantCulture));

            Response.Cookies.Add(cookie);

            return(Json(result));
        }
        public CustomFieldController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.CustomFieldRepository = new Frapid.Config.DataAccess.CustomField
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
        public HasAccountController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.repository = new HasAccountProcedure
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
        public BloodGroupController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.BloodGroupRepository = new Extems.Academic.DataAccess.BloodGroup
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
Exemple #20
0
        public GetRegistrationOfficeIdController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.repository = new GetRegistrationOfficeIdProcedure
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
        public SignInViewController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.SignInViewRepository = new Frapid.Account.DataAccess.SignInView
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
Exemple #22
0
        private string GetTemplate()
        {
            string path = "~/Catalogs/{catalog}/Areas/Frapid.Account/EmailTemplates/account-verification.html";

            path = path.Replace("{catalog}", AppUsers.GetCatalog());
            path = HostingEnvironment.MapPath(path);

            if (!File.Exists(path))
            {
                return(string.Empty);
            }

            return(path != null?File.ReadAllText(path, Encoding.UTF8) : string.Empty);
        }
Exemple #23
0
        public GetCustomFieldDefinitionController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.repository = new GetCustomFieldDefinitionProcedure
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
Exemple #24
0
        public AdmissionApplicationController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.AdmissionApplicationRepository = new Extems.Admission.DataAccess.AdmissionApplication
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
Exemple #25
0
        public AddEmailSubscriptionController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.repository = new AddEmailSubscriptionProcedure
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
        public CanRegisterWithGoogleController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.repository = new CanRegisterWithGoogleProcedure
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
Exemple #27
0
        public IsRestrictedUserController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.repository = new IsRestrictedUserProcedure
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
        public GetCategoryIdByCategoryAliasController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.repository = new GetCategoryIdByCategoryAliasProcedure
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
        public MenuItemViewController()
        {
            this._LoginId  = AppUsers.GetCurrent().View.LoginId.To <long>();
            this._UserId   = AppUsers.GetCurrent().View.UserId.To <int>();
            this._OfficeId = AppUsers.GetCurrent().View.OfficeId.To <int>();
            this._Catalog  = AppUsers.GetCatalog();

            this.MenuItemViewRepository = new Frapid.WebsiteBuilder.DataAccess.MenuItemView
            {
                _Catalog = this._Catalog,
                _LoginId = this._LoginId,
                _UserId  = this._UserId
            };
        }
Exemple #30
0
        private string GetTemplate()
        {
            string path = this._template;

            path = path.Replace("{catalog}", AppUsers.GetCatalog());
            path = HostingEnvironment.MapPath(path);

            if (!File.Exists(path))
            {
                return(string.Empty);
            }

            return(path != null?File.ReadAllText(path, Encoding.UTF8) : string.Empty);
        }