public ResourceLink(int id)
        {
            var dataRow = SqlHelpers.Select(SqlStatements.SQL_GET_RESOURCE_LINK_BY_ID.FormatWith(id)).Rows[0];

            Id          = dataRow["Id"].ToString().GetInt32();
            Title       = dataRow["Title"].ToString();
            Description = dataRow["Description"].ToString();
            URL         = dataRow["URL"].ToString();
            ThumbNail   = dataRow["ThumbNail"].ToString();
            Count       = dataRow["Count"].ToString().GetInt32();
            LastClicked = dataRow["LastClicked"].ToString().GetAsDate();
            Active      = dataRow["Active"].ToString().GetAsBool();
        }
 public void SaveResourceLink()
 {
     if (Id == 0)
     {
         SqlHelpers.Insert(SqlStatements.SQL_CREATE_RESOURCE_LINK.FormatWith(
                               Title.FixSqlString(), URL.FixSqlString(), (Active) ? "1" : "0", ThumbNail.FixSqlNull(), Description.FixSqlString()));
     }
     else
     {
         SqlHelpers.Update(SqlStatements.SQL_UPDATE_RESOURCE_LINK_BY_ID.FormatWith(
                               Title.FixSqlString(), URL.FixSqlString(), (Active) ? "1" : "0", ThumbNail.FixSqlNull(), Description.FixSqlString(), Id));
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Set page name in the title section
            SessionInfo.CurrentPage = PageNames.Home;
            TitleTag.Text           = SessionInfo.DisplayCurrentPage;
            HomePageBottom.Text     = SessionInfo.PageContent(PageContentBlocks.HomePageBottom);
            var senText = SqlHelpers.Select(SqlStatements.SQL_SELECT_RANDOM_SAYING);

            if (!senText.IsNullOrEmpty())
            {
                SentimentalTitle.Text = senText.Rows[0][0].ToString();
                SentimentalText.Text  = senText.Rows[0][1].ToString();
            }
        }
Example #4
0
 public void LoadUserDetails(string id)
 {
     try {
         var dataRow = SqlHelpers.Select(SqlStatements.SQL_GET_USER_DETAILS.FormatWith(id)).Rows[0];
         if (dataRow.IsNullOrEmpty())
         {
             return;
         }
         Id          = dataRow["Id"].ToString();
         DisplayName = dataRow["DisplayName"].ToString();
         UserName    = dataRow["UserName"].ToString();
         Notes       = "Last Visit: {0}".FormatWith(dataRow["LastVisit"].ToString().GetAsDate().ToShortDateString());
     } catch (Exception ex) {
         LogError("SystemUser: Load User method", ex);
         throw new ApplicationException("Record not found");
     }
 }
Example #5
0
 private static SystemSettings LoadSystemSettings()
 {
     try {
         var dataRow = SqlHelpers.Select(SqlStatements.SQL_GET_MAIL_SETTINGS).Rows[0];
         return(new SystemSettings()
         {
             Id = dataRow["Id"].ToString(),
             MailServer = dataRow["MailServer"].ToString(),
             ServerPort = dataRow["ServerPort"].ToString().GetInt32(),
             SmtpUser = dataRow["SmtpUser"].ToString(),
             SmtpPassword = dataRow["SmtpPassword"].ToString().DecryptString(),
             FromEmail = dataRow["FromEmail"].ToString(),
             FromUsername = dataRow["FromUsername"].ToString(),
             RequireAuth = dataRow["RequireAuth"].ToString().GetAsBool(),
             RequireSsl = dataRow["RequireSsl"].ToString().GetAsBool()
         });
     } catch (Exception ex) {
         SqlHelpers.Insert(SqlStatements.SQL_LOG_EXCEPTION.FormatWith(DateTime.Now.ConvertSqlDateTime(), "SystemSettings", ex.Message.FixSqlString(), ex.StackTrace.FixSqlString()));
         throw new ApplicationException("Sql Server Not accessible");
     }
 }
Example #6
0
        //public void AuthenticateUser(string userName, string password) {
        //  try {
        //    var dataRow = SqlHelpers.Select(SqlStatements.SQL_AUTHENTICATE_USER.FormatWith(userName, password)).Rows[0];
        //    if(dataRow.IsNullOrEmpty()) return;
        //    Id = dataRow["Id"].ToString();
        //    RoleId = dataRow["RoleId"].ToString();
        //    DisplayName = dataRow["DisplayName"].ToString();
        //    UserName = dataRow["UserName"].ToString();
        //    IsSuperAdmin = dataRow["SuperAdmin"].ToString().GetAsBool();
        //    UserPassReset = dataRow["PasswordReset"].ToString().GetAsBool();
        //    Notes = dataRow["Notes"].ToString();
        //    Role = SqlHelpers.SelectScalar(SqlStatements.SQL_GET_USER_ROLE.FormatWith(RoleId)).ToString();
        //    IsAuthenticated = true;
        //    IsAdmin = Role == "System User";
        //  } catch(Exception ex) {
        //    LogError("SystemUser: Authenticate User method", ex);
        //    throw new ApplicationException("Record not found");
        //  }
        //}

        private void LogError(string module, Exception error)
        {
            SqlHelpers.Insert(SqlStatements.SQL_LOG_EXCEPTION.FormatWith(DateTime.Now.ConvertSqlDateTime(), module.FixSqlString(), error.Message.FixSqlString(), error.StackTrace.FixSqlString()));
        }
Example #7
0
 //Admin
 public static DataTable GetRegistrationList() => SqlHelpers.Select(SqlStatements.SQL_GET_REGISTRATION_LIST);
Example #8
0
 public static DataTable GetAdminResourceLinks() => SqlHelpers.Select(SqlStatements.SQL_GET_ALL_RESOURCE_LINKS);
Example #9
0
 public static DataTable GetAllPageLocations() => SqlHelpers.Select(SqlStatements.SQL_GET_PAGE_LOCATIONS);
Example #10
0
 //Pages
 public static DataTable GetAllSentimentalSayings() => SqlHelpers.Select(SqlStatements.SQL_SELECT_ALL_SAYINGS);
Example #11
0
 //public static DataTable GetClientList() => SqlHelpers.Select(SqlStatements.SQL_GET_CLIENT_LIST);
 public static DataTable GetAdminList() => SqlHelpers.Select(SqlStatements.SQL_GET_ADMIN_LIST);
Example #12
0
 public void LogError(string module, string error)
 {
     SqlHelpers.Insert(SqlStatements.SQL_LOG_EXCEPTION.FormatWith(DateTime.Now.ConvertSqlDateTime(), module.FixSqlString(), error.FixSqlString(), string.Empty));
 }
Example #13
0
 public string PageContent(PageContentBlocks pageLocation) => SqlHelpers.SelectScalar(SqlStatements.SQL_GET_PAGE_CONTENT_FOR_DISPLAY.FormatWith(pageLocation.TextValue())).ToString();