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

Activities of "sampath"

Question

Hi, I have partly updated my app to V 1.8 and created separate branch for it as ver-1.8.I just updated all the nugget packages, db script changes and breaking changes.Now I can compile that branch and working fine.But I didn't do any manual changes which it requires to do on the Ui layer yet.I'll do those changes later hence it'll require lot of time and care.So my question is this,Is that OK to merge it into my Master branch (Production version) ? If I'll merge it into master then I can use git cherry pick option to commit my latest changes to ver-1.8 branch also until I'll complete the full version update. What is your thoughts ? Thanks.

Hi,

My SPA app's pop up is having around 30 drop downs.All the data are retrieving through the ajax calls as shown below. This pop up is very slow due to so many drop downs.Hence I would like to use redis cache with it.Is asp.net zero support redis cache out of the box (ver. v1.7.1.1 [20160328]) ? If I need to use redis cache for the above scenario can you suggest me the best way for doing it ? Do I need to run back end task to fill those data to the redis cache or which way is it good ? Thanks.

JS

vm.getAllCities = function () {
                cityService.getAllCitiesAsync().success(function (result) {
                    vm.cities = result.items;
                });
            };

            vm.getAllCities();

Html

<div class="col-xs-3">
                <div class="form-group">
                    <label class="control-label">@L("City")</label>
                    <select id="cityDropDown" required
                            class="form-control"
                            ng-options="a.id as a.name + ' | '+ a.zipCode for a in vm.cities"
                            ng-model="vm.property.address.cityId"
                            ui-jq="selectpicker"
                            ui-options='{ iconBase: "famfamfam-flag", tickIcon: "fa fa-check" }'
                            ng-change="vm.changedCity(vm.property.address.cityId)"
                            data-live-search="true" title="@L("PfSelectCity")">
                        <option value=""></option>
                    </select>
                </div>
            </div>

C#

public async Task<ListResultOutput<CityListDto>> GetAllCitiesAsync()
        {
            var cities = await _cityRepository
                .GetAllListAsync();

            return new ListResultOutput<CityListDto>(cities.OrderBy(o => o.Name).MapTo<List<CityListDto>>());
        }

Hi, This is actually not related to the asp.netzero. But hope you can give a better solution for me with your vast experience.

public List<PropertyListDto> GetPropertiesByStatus(GetPropertyInput input)
        {
     
            //exception occurs here
            var properties = _propertyRepository
                .GetAll()
                .Include(p => p.Address)
                .ToList();

            var results = new List<PropertyListDto>(properties.OrderBy(p => p.Id).MapTo<List<PropertyListDto>>());
           return results;
            
        }
[AutoMapFrom(typeof(Property))]
    public class PropertyListDto : FullAuditedEntityDto
    {
        public new int Id { get; set; }
        public CountyListDto County { get; set; }
        public string Priority { get; set; }
        public string Dist { get; set; }
        public decimal ListingPrice { get; set; }
        public string Blk { get; set; }
        public AddressDto Address { get; set; }
        public string Contact { get; set; }
        public string Lot { get; set; }
        public decimal Taxes { get; set; }
        public string Mls { get; set; }
        public ICollection<CommentEditDto> Comments { get; set; }
        public int? LegacyId { get; set; }
    }

Q : I need to show around 100,000 (1 lakh) data on the Angular UI Grid.But the problem is, above query gives memory exception.So could you tell me how to sort out this issue ? Thanks.

Note : I need to show the data without pagination.So I have selected this UI Grid.

[http://ui-grid.info/docs/#/tutorial/404_large_data_sets_and_performance])

Hi,

app.js

$stateProvider.state('tenant.propertyGoogleMap', {
            url: '/PropertyGoogleMap',
            templateUrl: '~/App/tenant/views/propertymanagement/propertyGoogleMap.cshtml',
            menu: 'PropertyGoogleMap.Tenant'
        });

js

Here I have loaded the new browser window tab when user clicks the button.

vm.propertyGoogleMap = function () {
                var url = $state.href('tenant.propertyGoogleMap', {}, { absolute: false });
                $window.open(url, '_blank');
            };

propertyGoogleMap.cshtml

I have tried with the null as shown below.But still it is being loaded the menus and etc. Why's that ?

@{
    Layout = null;
}

<div ng-controller="tenant.views.propertymanagement.propertyGoogleMap as vm">

    <style type="text/css">
        .angular-google-map-container {
            height: 400px;
        }
    </style>

   <div class="row">
        <ui-gmap-google-map center="vm.map.center" zoom="vm.map.zoom" options="vm.options"></ui-gmap-google-map>
    </div>
</div>

So my question is,could you tell me how can I load the new tab window without the layout page details ? I mean without menus and etc.. If I want, I can load angular and other related js files on that page (propertyGoogleMap.cshtml) manually.Thanks.

Hi, Could you tell me which library you're using for below mentioned drop down ? If you can provide any doc reference for that it's highly appreciated. Thanks.

<div class="form-group">
                <label for="LanguageNameSelectionCombobox">@L("Language")</label>
                <select
                    id="LanguageNameSelectionCombobox"
                    class="form-control"
                    ng-options="languageName.value as languageName.displayText for languageName in vm.languageNames"
                    ng-model="vm.language.name"
                    ui-jq="selectpicker"
                    ui-options='{ iconBase: "famfamfam-flag", tickIcon: "fa fa-check" }'
                    ng-change="vm.languageChanged()"
                    data-live-search="true"></select>
            </div>
Question

Hi, Could you tell me how to use "SweetAlert" on my app ? I can see that there is a lib added to the project.But "hSweetAlert" module has not been injected on the app.js file.So then how can I use it ? Thanks.

I just need to show message like this :

sweet.show('Simple right?');

Hi, I have developed below mentioned code snippets for the app with the WebApi (not for the ABP app).So my question is how can I replace Application Layer method instaed of the Web api Url below (i.e. url: "/api/EventImages/AddPictures",) ? Thanks.

Note : In other words how can I implement below kind of implementation with the ABP.

JS

//to add Pictures
            vm.AddPictures = function ($files) {
                vm.upload = [];
                for (var i = 0; i < $files.length; i++) {
                    var $file = $files_;
                    (function (index) {
                        vm.upload[index] = $upload.upload({
                            url: "/api/EventImages/AddPictures",
                            method: "POST",
                            data: {},
                            file: $file
                        }).progress(function (evt) {
                         }).success(function (data, status, headers, config) {
                          }).error(function (data, status, headers, config) {
                         });
                    })(i);
                }
            };

[i:2h7l3lfn]Web Api method which above app has been consumed_

[HttpPost]
        public async Task<HttpResponseMessage> AddPictures()
        {
            if (!Request.Content.IsMimeMultipartContent())
            {
                this.Request.CreateResponse(HttpStatusCode.UnsupportedMediaType);
            }

            var newImageName = string.Empty;
            var path = System.Web.Hosting.HostingEnvironment.MapPath("~");
            var provider = GetMultipartProvider();
            await Request.Content.ReadAsMultipartAsync(provider);

            foreach (var r in provider.FileData)
            {
                var uploadedFileInfo = new FileInfo(r.LocalFileName);
                var uploadedFileName = uploadedFileInfo.Name;
                var originalFileName = GetDeserializedFileName(r);
                var extension = Path.GetExtension(originalFileName);
                if (extension == null) continue;

                var ext = extension.ToLower();
                var guid = Guid.NewGuid().ToString();
                newImageName = guid + ext;

                try
                {
                    File.Move(path + "\\Resources\\images\\temp\\" + uploadedFileName, path + "\\Resources\\images\\event-images\\" + newImageName);
                }
                catch (IOException ex)
                {
                    //Write error
                }
            }

            return Request.CreateResponse(HttpStatusCode.OK, new { newImageName });
        }

Hi, I have written one of my application layer method as shown below.Here I didn't use repository pattern due to I don't know how to do that by using repository pattern.I know it is not good to use db context directly on the application layer as shown below.And also I have added "Abp.Zero.Entityframework" reference into the Application layer.So all are BAD I think.So could you tell me how to use below mentioned code snippet with the repository pattern ? Thanks.

public async Task<int?> EditPropertyAsync(CreateOrEditPropertyInput input)
        {
            // Load original parent including the child item collection
            var property = await _context.Properties
                    .Where(p => p.Id == input.Property.Id)
                    .Include(p => p.TaxMapLots)
                    .FirstOrDefaultAsync();

            foreach (var child in property.TaxMapLots.ToList())
            {
                _context.TaxMapLots.Remove(child);
            }

            _unitOfWorkManager.Current.SaveChanges();

            input.Property.MapTo(property);
            if (AbpSession.TenantId != null)//set TenantId
            {
                property.TenantId = AbpSession.TenantId.Value;
                property.Address.TenantId = AbpSession.TenantId.Value;
            }

            foreach (var child in property.TaxMapLots.ToList())
            {
                _context.TaxMapLots.Add(child);
            }

            _context.SaveChanges();

            return input.Property.Id;
        }

Hi,

System.InvalidOperationException: The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted.

I have seen some solutions for the above issue as shown below.But I don't know how to apply it with the ABP. Any help would be highly appreciated.Thanks.

[http://stackoverflow.com/questions/5538974/the-relationship-could-not-be-changed-because-one-or-more-of-the-foreign-key-pro])

[http://stackoverflow.com/questions/19325473/ef6-0-the-relationship-could-not-be-changed-because-one-or-more-of-the-foreign])

[Table("IpTaxMapLots")]
    public class TaxMapLot : FullAuditedEntity
    {
        public const int MaxLength = 50;

        [Required]
        [MaxLength(MaxLength)]
        public virtual string District { get; set; }

        [ForeignKey("PropertyId")]
        public virtual Property Property { get; set; }
        public virtual int PropertyId { get; set; }
    }
[Table("IpProperties")]
    public class Property : FullAuditedEntity
    {
        public const int MaxLength = 50;

        [MaxLength(MaxLength)]
        public virtual string Dist { get; set; }

        public virtual ICollection<TaxMapLot> TaxMapLots { get; set; }
    }
public async Task<int?> EditPropertyAsync(CreateOrEditPropertyInput input)
        {
            var property = await _propertyRepository.FirstOrDefaultAsync(p => p.Id == input.Property.Id);
            input.Property.MapTo(property);
          
            await _propertyRepository.UpdateAsync(property);
            return input.Property.Id;
        }
public class CreateOrEditPropertyInput : IInputDto
    {
        [Required]
        public PropertyEditDto Property { get; set; }
    }
[AutoMap(typeof(Property))]
    public class PropertyEditDto
    {
        public const int MaxLength = 50;
        public int? Id { get; set; }

        [MaxLength(MaxLength)]
        public string Dist { get; set; }

        public List<TaxMapLotDto> TaxMapLots { get; set; }

    }

I have a business use case like this :

Since they want to add photos using phones, tablets and from the web app, we should write it as a service that can be called to upload photos to the database from the phone/tablet and same service should be used to upload photos from the computer.

At this moment I have written all the services on the Application layer (Not on the Web Api layer) and working fine with the web app.So is it possible to access application layer's methods from the mobile app ? If it's No,then how can I do that ? Thanks.

Showing 31 to 40 of 62 entries