示例#1
0
 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));
     }
 }
示例#2
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");
     }
 }
示例#3
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()));
        }
示例#4
0
 public void LogError(string module, string error)
 {
     SqlHelpers.Insert(SqlStatements.SQL_LOG_EXCEPTION.FormatWith(DateTime.Now.ConvertSqlDateTime(), module.FixSqlString(), error.FixSqlString(), string.Empty));
 }