Base solution for your next web application

Activities of "thobiasxp"

Hi, Good Afternoon,

Hi guys, I am trying to get UTC timing for each users by assigning to them. I saw that tenant timing zone configuration is coming from " <a class="postlink" href="http://localhost:22742/AbpUserConfiguration/GetAll">http://localhost:22742/AbpUserConfiguration/GetAll</a>". Can we know whether it is a controller or appservice or meta data or where we can edit these information.

Thanks

Hi, Good Morning,

Thanks it worked.

Hi , Good Morning,

We need to set UTC time for the user. But we were not able to see UTC time settings under tenant setting. Can you help us to how to enable UTC timing for users.

Thanks

Hi, Good Morning,

We have created customer repository by adding reference from core and code is below. If its wrong can u give us sample custom repository code.

public class CountryAppService : stemAppServiceBase, ICountryAppService
    {
        private readonly stemDbContext _spDbContext;

        public CountryAppService(stemDbContext spDbContext)
        {
            _spDbContext = spDbContext;
        };


        public async Task GetDeleteCountry(EntityDto input) 
        {

                var idd = new SqlParameter
                {
                    ParameterName = "TableId",
                    Value = 1
                };

                var list = _spDbContext.Database.SqlQuery<FindDelete>("exec Sp_FindMappedTable @TableId", idd).ToList();

                var count = list.Where(f => f.id == input.Id).ToList();
                if (count.Count() <= 0)
                {

                    await _countryRepository.DeleteAsync(input.Id);
                }
                else
                {
                    throw new UserFriendlyException("Unable to Delete", "Data is being used by another Field");
                }

 }       
}

Hi, Good Morning,

We don't have customer custom repository. we are trying to access database from this code of yours

public class SpDbContext : DbContext
    {
        public SpDbContext()
            : base(GetConnectionString())
        {

        }

        private static string GetConnectionString()
        {
            //Notice that; this logic only works on development time.
            //It is used to get connection string from appsettings.json in the Web project.

            var configuration = AppConfigurations.Get(
                WebContentDirectoryFinder.CalculateContentRootFolder()
                );

            return configuration.GetConnectionString(
                stemConsts.ConnectionStringName
                );
        }

        public SpDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {

        }

        public SpDbContext(DbConnection existingConnection)
            : base(existingConnection, false)
        {

        }

        public SpDbContext(DbConnection existingConnection, bool contextOwnsConnection)
            : base(existingConnection, contextOwnsConnection)
        {

        }
    }

and we are calling above class inside our method like this

// Method

public async Task DeleteCity(EntityDto input) { try { using (var context = new SpDbContext()) {

                var idd = new SqlParameter
                {
                    ParameterName = "TableId",
                    Value = 2
                };
                var list = context.Database.SqlQuery&lt;FindDelete&gt;("exec Sp_FindMappedTable @TableId", idd).ToList();

                var count = list.Where(f => f.id == input.Id).ToList();
                if (count.Count() <= 0)
                {

                    await _cityRepository.DeleteAsync(input.Id);
                }
                else
                {
                    throw new UserFriendlyException("Unable to Delete", "Data is being used by another Field");
                }
            }
            }
            catch (Exception ex)
            {

            }
    }

This code is working perfectly fine when we run from the visual studio but when we publish and host it on server we are getting above errors. can you help us sort it out... otherwise is there any other way to call stored procedure.

Thanks

Hi, Good Morning,

This is the error message we are getting in log.

DEBUG 2017-06-08 10:32:17,427 [17   ] osoft.AspNetCore.Routing.Tree.TreeRouter - Request successfully matched the route with name '(null)' and template 'api/services/app/Country/DeleteCountry'.
DEBUG 2017-06-08 10:32:17,431 [17   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action tibs.stem.Countrys.CountryAppService.DeleteCountry (tibs.stem.Application)
INFO  2017-06-08 10:32:17,466 [17   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method tibs.stem.Countrys.CountryAppService.DeleteCountry (tibs.stem.Application) with arguments (Abp.Application.Services.Dto.EntityDto) - ModelState is Valid
ERROR 2017-06-08 10:32:17,483 [17   ] Mvc.ExceptionHandling.AbpExceptionFilter - Could not find content root folder!
System.ApplicationException: Could not find content root folder!
   at tibs.stem.Web.WebContentDirectoryFinder.CalculateContentRootFolder() in F:\Project Backups\Bafco Backups\bafco 7\aspnet-core\src\tibs.stem.Core\Web\WebContentFolderHelper.cs:line 26
   at tibs.stem.Tenants.Dashboard.SpDbContext.GetConnectionString() in F:\Project Backups\Bafco Backups\bafco 7\aspnet-core\src\tibs.stem.Application\Tenants\Dashboard\SpDbContext.cs:line 27

Thanks

Hi, Good Morning,

Thanks for your help, it worked.

Hi, Good Evening,

We have custom dbcontext and we try to run store procedure while on development that Store procedure is running perfectly but when we publish and try to run stored procedure its showing as internal error. Kindly provide us solution.

////Db Context

public class SpDbContext : DbContext
    {
        public SpDbContext()
            : base(GetConnectionString())
        {

        }

        private static string GetConnectionString()
        {
            //Notice that; this logic only works on development time.
            //It is used to get connection string from appsettings.json in the Web project.

            var configuration = AppConfigurations.Get(
                WebContentDirectoryFinder.CalculateContentRootFolder()
                );

            return configuration.GetConnectionString(
                stemConsts.ConnectionStringName
                );
        }

        public SpDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {

        }

        public SpDbContext(DbConnection existingConnection)
            : base(existingConnection, false)
        {

        }

        public SpDbContext(DbConnection existingConnection, bool contextOwnsConnection)
            : base(existingConnection, contextOwnsConnection)
        {

        }
    }


// Method of Stored Procedure


public async Task DeleteCity(EntityDto input)
        {
             try
                {
                using (var context = new SpDbContext())
                  {

                    var idd = new SqlParameter
                    {
                        ParameterName = "TableId",
                        Value = 2
                    };
                    var list = context.Database.SqlQuery<FindDelete>("exec Sp_FindMappedTable @TableId", idd).ToList();

                    var count = list.Where(f => f.id == input.Id).ToList();
                    if (count.Count() <= 0)
                    {

                        await _cityRepository.DeleteAsync(input.Id);
                    }
                    else
                    {
                        throw new UserFriendlyException("Unable to Delete", "Data is being used by another Field");
                    }
                }
                }
                catch (Exception ex)
                {

                }
        }

Thanks

Hi, Good Evening,

[Table("Country")] public class Country : FullAuditedEntity { [Required] public virtual string CountryName { get; set; }

    [Required]
    public virtual string CountryCode { get; set; } 
}

Hi,

Good Morning, While updating a table the creator userid is missing and updated creator userid as null and we have tried to add using full audited entity class but also same result creator userid is updated as null. Can you please provide us solution while updating table.

This is the method we have written for updating a table

public async Task UpdateCountry(CountryInputDto input) { var country = input.MapTo<Country>(); await _countryRepository.UpdateAsync(country); }

Input Class

[AutoMapTo(typeof(Country))] public class CountryInputDto { public int Id { get; set; } public virtual string CountryName { get; set; } public virtual string CountryCode { get; set; } }

Thanks

Showing 1 to 10 of 64 entries