Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "system15"

I am trying to download the file by id using this method but all it is doing is returning the HttpResponse in json format in swagger but what I'm trying to achieve is the file being download in the browser. Does anyone know what is needed to be done to get the correct outcome?

I have a FileUpload table that has the following columns (related to the file): Id = uniqueidentifier, Content = varbinary, ContentType = nvarchar, e.g. application/pdf FileName = nvarchar, e.g. filename.pdf FileType = tinyint e.g.

`Here is the method in the Project.Application

    /// <summary>
    /// Download the file from the database by id.
    /// </summary>
    /// <param name="id">The identifier.</param>
    /// <returns>The file.</returns>
    public async Task<HttpResponseMessage> GetDownloadFile(Guid id)
    {
        HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
        var file = await _fileUploadRepository.FirstOrDefaultAsync(id);
        var filename = file.FileName.ToString();
        var ms = new MemoryStream(file.Content);
        ms.Position = 0;
        result.Content = new StreamContent(ms);
        result.Content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType);
        result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
        {
            FileName = Uri.EscapeDataString(file.FileName)
        };

        return result;
    }

`

`Here is the typescript in Web.Host

/// <summary> 
/// Download the file from the database by id.
/// </summary>
///<param name="id">The identifier.</param>
downloadFile(id: string, event) {
    if (id) {
        debugger;//Todo: remove.

        this._fileUploadsServiceProxy.downloadFile(id)
            .subscribe(result => {
                this.notify.success(`Downloaded successfully.`);
            });
    }
}

`

I have created a new html email template and I've put it in the same directory as the default.html file (Directory: myProject\src\myProject.Core\Emailing\EmailTemplates) with the ideas to be able to use a second template.

I have copied the following method and renamed it:
public string GetDefaultTemplate(int? tenantId) { using (var stream = typeof(EmailTemplateProvider).GetAssembly().GetManifestResourceStream("HomeDelivery.Emailing.EmailTemplates.default.html")) { var bytes = stream.GetAllBytes(); var template = Encoding.UTF8.GetString(bytes, 3, bytes.Length - 3); template = template.Replace("{THIS_YEAR}",DateTime.Now.Year.ToString()); return template.Replace("{EMAIL_LOGO_URL}", GetTenantLogoUrl(tenantId)); } }

New method that doesn't work when called: public string GetBasicTemplate(int? tenantId) { using (var stream = typeof(EmailTemplateProvider).GetAssembly().GetManifestResourceStream("HomeDelivery.Emailing.EmailTemplates.newTemplate.html")) { var bytes = stream.GetAllBytes(); var template = Encoding.UTF8.GetString(bytes, 3, bytes.Length - 3); return template.Replace("{THIS_YEAR}", DateTime.Now.Year.ToString()); //return template.Replace("{EMAIL_LOGO_URL}", GetTenantLogoUrl(tenantId)); } }

When debugging and the line gets to the var bytes part I get an exception object reference not set to an instance of an object.

Any ideas how to resolve this so that I can alternate between templates without issues.

Hi as anyone had any luck using the metronic quicksearch plugin with the asp.net zero angular application because I can't get it working completely because I not sure how to query the application service using the service proxies.

Here is my template code:

header.component.html

<li class="m-nav__item m-dropdown m-dropdown--large m-dropdown--arrow m-dropdown--align-center m-dropdown--mobile-full-width m-dropdown--skin-light	m-list-search m-list-search--skin-light" data-dropdown-toggle="click" data-dropdown-persistent="true" id="m_quicksearch" data-search-type="dropdown">
    <a href="#" class="m-nav__link m-dropdown__toggle">
        <span class="m-nav__link-icon">
            <i class="flaticon-search-1"></i>
        </span>
    </a>
    <div class="m-dropdown__wrapper">
        <span class="m-dropdown__arrow m-dropdown__arrow--center"></span>
        <div class="m-dropdown__inner ">
            <div class="m-dropdown__header">
                <form class="m-list-search__form">
                    <div class="m-list-search__form-wrapper">
                        <span class="m-list-search__form-input-wrapper">
                            <input id="m_quicksearch_input" autocomplete="off" type="text" name="q" class="m-list-search__form-input" value="" placeholder="Search..."></span>
                        <span class="m-list-search__form-icon-close" id="m_quicksearch_close">
                            <i class="la la-remove"></i>
                        </span>
                    </div>
                </form>
            </div>
            <div class="m-dropdown__body">
                <div class="m-dropdown__scrollable m-scrollable" data-max-height="300" data-mobile-max-height="200">
                    <div class="m-dropdown__content"></div>
                </div>
            </div>
        </div>
    </div>
</li>

Hi there is it possible to change the default template in the folder ViewEntityComponentHtmlTemplate to allow properties to be in 2 columns instead of the 1 column approach?

Code:

<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">
                    <span>{{l("{{Entity_Name_Here}}")}}</span>
                </h4>
                <button type="button" class="close" (click)="close()" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
				<div class="row">
					<div class="col-lg-12">
						<div class="m-stack m-stack--hor m-stack--general m-stack--demo">
							<div class="row">
								<div class="col-lg-6">
									{{Property_Looped_Template_Here}}
									{{NP_Looped_Template_Here}}
								</div>
								<div class="col-lg-6">
								</div>
							</div>
						</div>
					</div>
				</div>
            </div>
            <div class="modal-footer">
                <button [disabled]="saving" type="button" class="btn btn-primary blue" (click)="close()">{{l("Close")}}</button>
            </div>
        </div>
    </div>

</div>

Here is the directory to the file in question: project\src\ProjectName.EntityFrameworkCore\EntityFrameworkCore\HomeDeliveryDbContext.cs

Hi there I'm getting a warning message after AppAuthorizationProvider gets modified:

-> AppAuthorizationProvider.cs is being modified. Warning : File not found => ..\src\MyProject.Core\EntityHistory\EntityHistoryHelper.cs

When I'm creating an entity using the rad tool. Does anyone have a fix for this as this file and entity history folder doesn't exist in my project?

Hi there does anyone know how to handle delete concurrecy if an entity gets deleted having two tabs opened with the same entites and deleting the entity in the first tab and trying to make changes to the entity in the second tab and saving that?

I'm trying to setup optimistic concurrency in my application using RowVersion property that is added to my entity. I can't get the DbUpdateConcurrencyException to appear during testing. The test that I have done is run an update SQL command on the entity while on the front end have the same entity loaded into memory. Does anyone have any ideas where I'm going wrong?

Test SQL script:

UPDATE [dbo].[MyEntity] SET [Name] = 'fdgopiifdgdf' WHERE [Id] = '11111111-DF4E-4F24-B321-11111111'

Entity:

[Table("MyEntity")]
public class MyEntity : FullAuditedEntity, IConcurrencyCheck
{
    [Required]
    public virtual string Name { get; set; }

    public virtual int Order { get; set; }
    public virtual bool Active { get; set; }

    [Timestamp]
    public byte[] RowVersion { get; set; }
}

Dto:

public class CreateOrEditMyEntityDto : EntityDto<Guid?>
{
    [Required]
    public string Name { get; set; }

    public int Order { get; set; }
    public bool Active { get; set; }

    [Timestamp]
    public byte[] RowVersion { get; set; }
}

CustomDtoMapper for entity:

configuration.CreateMap<MyEntity, MyEntityDto>();

DbContext OnModelCreating method:

modelBuilder.Entity<MyEntity>()
    .Property(a => a.RowVersion)
    .IsRowVersion()
    .IsConcurrencyToken()
    .ValueGeneratedOnAddOrUpdate();

Edit entity method:

public async Task Update(CreateOrEditMyEntityDto input)
{
    // Handle multi processing concurrency issues.
    try
    {
        var MyEntity = await _MyEntityRepository.FirstOrDefaultAsync((Guid)input.Id);
        ObjectMapper.Map(input, MyEntity);
    }
    catch (DbUpdateConcurrencyException)
    {
        throw new UserFriendlyException("Please reload to edit this record.");
    }
}

Hi all,

I was hoping someone could advise me; we have recently been having an issue when using the RAD tool in ASP.Net Zero with the tempFileCacheManager in the MainTemplate for ExportAppService Class (Excel Exporter).

The line that is causing errors is:

public {{Entity_Name_Plural_Here}}ExcelExporter( ITimeZoneConverter timeZoneConverter, IAbpSession abpSession, **ITempFileCacheManager tempFileCacheManager) : base(tempFileCacheManager) //HERE** { _timeZoneConverter = timeZoneConverter; _abpSession = abpSession; }

But when removed appears to cause no issues. Please can you advise as to whether this is required and its desired functionality? For the time being we have removed it from our templates but wanted to ensure there would be no loss by doing so.

The error we are getting is: "The Type or Namespace ITempFileCacheManager could not be found"

Thanks in advance

I have an error message with the same code from the aspnet zero documention step by step development guide. The error that I get is :

Expected 4 arguments but got 1.

Does anyone know how to resolve this ? show(personId): void { this.active = true; this._personService.getPersonForEdit(personId).subscribe((result) => { this.person = result; this.modal.show(); }); }

file: edit-person-modal.component.ts link to docs: [https://www.aspnetzero.com/Documents/Developing-Step-By-Step-Angular]

Showing 1 to 10 of 19 entries