Base solution for your next web application

Activities of "paul lee"

Hi All,

I am trying to add a Background Worker that will be executed according to a schedule, I am using HangFire integration.

Inside this BackgroundWorker I need to get some settings from DB, I am using the Setting infrastructure build into Abp. However, I couldn't seems to get the SettingManager populated and it is always null.

I have followed the Documentation:

  1. I have defined a new namespace: MyApp.Configuration in Core module. Inside this namespace there are 2 new classes, MyAppSettingsProvider and MyAppSettingNames.

  2. Since the Backgound Worker will be used in the Web module I have added the following to WebModule class in the PreInitialize() method:

public override void PreInitialize()
    {
      //Enable database based localization
      // Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization();
      Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-england", true));

      .....

      Configuration.Settings.Providers.Add<MyAppSettingsProvider>();

      Configuration.BackgroundJobs.UseHangfire(configuration =>
      {
        configuration.GlobalConfiguration.UseSqlServerStorage("Default");
      });
    }
  1. I am reading the setting during the constructor of the background worker, but I am getting Null Reference Exception:
public class MyPassiveWorker : PeriodicBackgroundWorkerBase, ISingletonDependency
  {
    private readonly string _workingPath;

    public MyPassiveWorker(AbpTimer timer) : base(timer)
    {
      _workingPath = SettingManager.GetSettingValue(MyAppSettingNames.FuntionName_WorkingDirectory);
      Timer.Period = 60000;
    }

I tried to debug into the SettingManager.GetSettingValue.... line and SettingManager is always null. So what am I missing?

Thanks you very much.

Paul

Hi all,

Does anyone knows or have links to samples or tutorials about how to send files to client from the ApplicationServices?

Do I just sent the encoded byte array in an OutputDTO?

Thanks.

Hi All,

I am following BackgroundJobAndNotificationDemo from Abp.Samples to try to get this document generation background job working.

I have a BackgroundJob defined as follows and following the sample project, this class lives in the Core module:

public class ExcelGenerationJob : BackgroundJob<ExcelGenerationJobArgs>, ITransientDependency
{
  // Some other code....

  public ExcelGenerationJob()
  {
    LocalizationSourceName = ProjectConsts.LocalizationSourceName;
  }

  // However, I get whatever string I passed to L() back here 
  public void ComposeAdText()
  {
    var stringBuilder = new StringBuilder();
    stringBuilder.AppendLine(L("AdTextLine1"));
    
    // Here in the Log I always see AdTextLine1 being attached to the log line...
    Logger.Debug("Localizing AdTextLine1 - " + stringBuilder.ToString()); 
  }
}

I tried to debug a bit and see that base.LocalizationManager.GetAllSources().Count is always 0. So what's the proper way to initialize Localization to get this working?

Thanks.

Hi all,

I am very very new to Hangfire (I just know it is used to run jobs in the background) and this will be my first contact with it so please bear with me.

I am in the middle of a project where I need to generate some report and data export files in Excel and PDF. But our web server is quite busy so I need to off-load this document generation process to some other servers. I have read up on Hangfire's overview page that this can be configured as "Separate Server".

I can not vision how this is possible with Abp + Hangfire, can someone kindly explain generally how this can be done?

Thank you very much. Paul

Hi there,

I have the following model:

public class User : AbpUser<Tenant, User>
  {
    // code omitted for brevity
    [ForeignKey("Employeer")]
    public virtual long? EmployeerId { get; set; }
    public virtual Company Employeer { get; set; }
  }

  public class Company : FullAuditedEntity<long>, IMustHaveTenant
  {
    // code omitted for brevity
    [Required]
    [StringLength(MaxCodeLength)]
    public virtual string Code { get; private set; }  
    [Required]
    [StringLength(MaxNameLength)]
    public virtual string Name { get; private set; }
    public virtual int TenantId { get; set; }

    public virtual ICollection<User> Employees { get; private set; }
  }

And I want to map this into the following DTO:

[AutoMapFrom(typeof(User))]
  public class UserLoginInfoDto : EntityDto<long>
  {
    public string Name { get; set; }
    public string Surname { get; set; }
    public string UserName { get; set; }
    public string EmailAddress { get; set; }
    public string EmployeerName { get; set; }
  }

But AutoMapper is not mapping the Company.Name into EmployeerName in the DTO. How can I make this happen?

Thanks

Hi,

I am working on a project which would benefit from using Abp, however, the management doesn't allow me to use the framework per see. So I am trying to grab stuff from Abp where-ever I need them (hope the author of Abp don't mind), hope that one day I can be allowed to transfer this app to use Abp.

At the moment I am trying to get the ng-include to successfully include the header.cshtml. When I ran the webapp, I am getting 403-Forbidden back from ASP.Net for those ng-include(s).

So, please can you explain how can I get cshtml successfully being included?

Thank you very much for your help.

I have successfully added a custom WebApi controller in the WebApiModule, but how can I get ABP to generate the Dynamic JavaScript Proxy for these custom WebApi controllers?

If I can not, does that means I will have to hardcode the URL in the AngularJs side to consume these controllers?

Hi All,

I am new to ASP.NET MVC and Single Page Application, I am trying to develop a SPA for managing member's information.

At the moment I am trying to add a new View for typing in the Member's Personal Info and needed a field for Date Of Birth, the field can either be a formatted TextBox or a DatePicker.

Here is what I have got so far in the cshtml:

<div ng-controller="coa.views.people.new as vm">
  <form id="NewPersonForm" role="form" name="newPersonForm" novalidate>
    <div class="form-group">
      <label for="MemberId">@L("MemberIdDescription")</label>
      <text id="MemberId" ng-model="vm.person.memberId" class="form-control"></text>
    </div>
    <div class="form-group">
      <label for="ChiSurname">@L("ChineseSurnameDescription")</label>
      <text id="ChiSurname" ng-model="vm.person.chiSurname" class="form-control" required></text>
    </div>
    <div class="form-group">
      <label for="ChiOtherNames">@L("ChineseOtherNamesDescription")</label>
      <text id="ChiOtherNames" ng-model="vm.person.chiOtherNames" class="form-control" required></text>
    </div>
    <div class="form-group">
      <label for="EngSurname">@L("EnglishSurnameDescription")</label>
      <text id="EngSurname" ng-model="vm.person.engSurname" class="form-control" required></text>
    </div>
    <div class="form-group">
      <label for="EngOtherNames">@L("EnglishOtherNamesDescription")</label>
      <text id="EngOtherNames" ng-model="vm.person.engOtherNames" class="form-control" required></text>
    </div>
    <div class="form-group">
      <label for="Alias">@L("AliasDescription")</label>
      <text id="Alias" ng-model="vm.person.alias" class="form-control"></text>
    </div>
    <div class="form-group">
      <label for="DateOfBirth">@L("DateOfBirthDescription")</label>
      <text id="DateOfBirth" ng-model="vm.person.dob" class="form-control" required></text>
    </div>
  </form> 
</div>

I am not sure what tag to use for Formatted TextBox or DatePicker, most of the examples from Google searches on Razor / cshtml seems to use the native Razor markups so I am not sure what to use here.

Please Help!

Thank you very much.

Paul

Showing 1 to 8 of 8 entries