Base solution for your next web application

Activities of "nitinrpatel"

Hello, @maliming is there any update in my query? Please provide solution for that AEAP.

I had performed steps from the below mentin link for MSDTC Settings on my server. https://suneethasdiary.wordpress.com/tag/how-to-start-the-service-msdtc/ But After this changes Error doesn't seems to be popup,Database is Created but all the tables are blank(Before performing MSDTC Steps Seed's are migrated in DB),No Error log & Action log Updated in Log.txt file.

After Performing MSDTC Steps on my server the Error doesn't seems to be popup, but I started facing issue like in Database Seed doesn't run now and also I am unble to create any Tenant, also no log files are maintained now.

I Am Using ASP.NET MVC 5.x with AngularJS.

public async Task<int> CreateWithAdminUserAsync(string tenancyName, string name, string adminPassword, string adminEmailAddress, string connectionString, bool isActive, int? editionId, bool shouldChangePasswordOnNextLogin, bool sendActivationEmail,string fullName, string companyName, string abn, string fax, string phone, string mobile, string email, float stcCharges, string retailerName, string retailerABN)
        {
            int newTenantId;
            long newAdminId;

            using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
            {
                //Create tenant
                var tenant = new Tenant(tenancyName, name)
                {
                    IsActive = isActive,
                    EditionId = editionId,
                    ConnectionString = connectionString.IsNullOrWhiteSpace() ? null : SimpleStringCipher.Instance.Encrypt(connectionString),
                    FullName= fullName,
                    CompanyName=companyName,
                    ABN=abn,
                    FAX=fax,
                    Phone=phone,
                    Mobile=mobile,
                    Email=email,
                    STCCharges=stcCharges,
                    RetailerName=retailerName,
                    RetailerABN=retailerABN
                };

                await CreateAsync(tenant);
                await _unitOfWorkManager.Current.SaveChangesAsync(); //To get new tenant's id.

                //Create tenant database
                _abpZeroDbMigrator.CreateOrMigrateForTenant(tenant);

                //We are working entities of new tenant, so changing tenant filter
                using (_unitOfWorkManager.Current.SetTenantId(tenant.Id))
                {
                    try
                    {
                        //Create static roles for new tenant
                        CheckErrors(await _roleManager.CreateStaticRoles(tenant.Id));
                        await _unitOfWorkManager.Current.SaveChangesAsync(); //To get static role ids
                    }
                    catch(Exception e)
                    {

                    }
                    

                    //grant all permissions to admin role
                    var adminRole = _roleManager.Roles.Single(r => r.Name == StaticRoleNames.Tenants.Admin);
                    await _roleManager.GrantAllPermissionsAsync(adminRole);

                    //User role should be default
                    var userRole = _roleManager.Roles.Single(r => r.Name == StaticRoleNames.Tenants.User);
                    userRole.IsDefault = false;
                    CheckErrors(await _roleManager.UpdateAsync(userRole));

                    //Installer role should be default
                    //var installerRole = _roleManager.Roles.Single(r => r.Name == StaticRoleNames.Tenants.Installer);
                    //installerRole.IsDefault = true;
                    //CheckErrors(await _roleManager.UpdateAsync(installerRole));

                    //Create admin user for the tenant
                    if (adminPassword.IsNullOrEmpty())
                    {
                        adminPassword = User.CreateRandomPassword();
                    }

                    var adminUser = User.CreateTenantAdminUser(tenant.Id, adminEmailAddress, adminPassword);
                    adminUser.ShouldChangePasswordOnNextLogin = shouldChangePasswordOnNextLogin;
                    adminUser.IsActive = true;

                    CheckErrors(await _userManager.CreateAsync(adminUser));
                    await _unitOfWorkManager.Current.SaveChangesAsync(); //To get admin user's id

                    //Assign admin user to admin role!
                    CheckErrors(await _userManager.AddToRoleAsync(adminUser.Id, adminRole.Name));

                    //Notifications
                    await _appNotifier.WelcomeToTheApplicationAsync(adminUser);

                    //Send activation email
                    if (sendActivationEmail)
                    {
                        adminUser.SetNewEmailConfirmationCode();
                        await _userEmailer.SendEmailActivationLinkAsync(adminUser, adminPassword);
                    }

                    await _unitOfWorkManager.Current.SaveChangesAsync();

                    await _demoDataBuilder.BuildForAsync(tenant);

                    newTenantId = tenant.Id;
                    newAdminId = adminUser.Id;
                }

                await uow.CompleteAsync();
            }

            //Used a second UOW since UOW above sets some permissions and _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync needs these permissions to be saved.
            using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
            {
                using (_unitOfWorkManager.Current.SetTenantId(newTenantId))
                {
                    await _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync(new UserIdentifier(newTenantId, newAdminId));
                    await _unitOfWorkManager.Current.SaveChangesAsync();
                    await uow.CompleteAsync();
                }
            }

            return newTenantId;
        }

protected virtual void CheckErrors(IdentityResult identityResult)
        {
            identityResult.CheckErrors(LocalizationManager);
        }

Error Accurs At This Line.

CheckErrors(await _roleManager.CreateStaticRoles(tenant.Id));

Hello, I Want to create new tenant with database.For that i have pass connection string but i got error while performing it. Database was successfully created, All the Migration and Seed Files are Successfully Run on that database but after that I am not work further System Gives "An internal error occurred during your request!"I Have Attached Screenshot Of my error page for reference.

Please Help me ASAP.

Hear is an error box and Stack Trace of my code

at System.Linq.Dynamic.ExpressionParser.ParseMemberAccess(Type type, Expression instance) at System.Linq.Dynamic.ExpressionParser.ParseIdentifier() at System.Linq.Dynamic.ExpressionParser.ParsePrimaryStart() at System.Linq.Dynamic.ExpressionParser.ParsePrimary() at System.Linq.Dynamic.ExpressionParser.ParseUnary() at System.Linq.Dynamic.ExpressionParser.ParseMultiplicative() at System.Linq.Dynamic.ExpressionParser.ParseAdditive() at System.Linq.Dynamic.ExpressionParser.ParseComparison() at System.Linq.Dynamic.ExpressionParser.ParseLogicalAnd() at System.Linq.Dynamic.ExpressionParser.ParseLogicalOr() at System.Linq.Dynamic.ExpressionParser.ParseExpression() at System.Linq.Dynamic.ExpressionParser.ParseOrdering() at System.Linq.Dynamic.DynamicQueryable.OrderBy(IQueryable source, String ordering, Object[] values) at System.Linq.Dynamic.DynamicQueryable.OrderBy[T](IQueryable`1 source, String ordering, Object[] values) at TechnoForms.NewInvitation.NewInvitationAppService.

"No property or field 'custName' exists in type 'Installer'" this is the error I am getting while I am performing sorting on Customer Name(we use tenant as a Customer).

Below is the class, I am using in my code which I had given before.

[AutoMapFrom(typeof(Installer))]
    public class InvitationListDto : FullAuditedEntityDto
    {
        public virtual int TenantId { get; set; }

        public virtual int UserId { get; set; }

        public virtual string CustName { get; set; }

        public virtual string FullName { get; set; }

        public virtual Guid Guid { get; set; }
    }

Below is an Installer Entity class file from which I am fetching details, I have given reference to tenant table and also want to give sorting on dashboard by tenant name and also with installer name.

[Table("Installer")]
    public class Installer : FullAuditedEntity, IMustHaveTenant
    {
        public const int MaxFullNameLength = 200;
        public const int MaxPhoneLength = 10;
        public const int MaxMobileLength = 10;
        public const int MaxEmailLength = 255;
        public const int MaxCompanyNameLength = 100;
        public const int MaxABNLength = 50;
        public const int MaxCompanyPhoneLength = 10;
        public const int MaxFaxLength = 20;
        public const int MaxPostalDelevaryNoLength = 50;
        public const int MaxlogoLength = 500;
        public const int MaxStreetAddressLength = 300;
        public const int MaxUnitNumberLength = 50;
        public const int MaxUnitTypeLength = 50;
        public const int MaxStreetNumberLength = 50;
        public const int MaxStreetNameLength = 100;
        public const int MaxStreetTypeLength = 50;
        public const int MaxStreetCityLength = 100;
        public const int MaxStreetStateLength = 50;
        public const int MaxStreetPostCodeLength = 50;
        public const int MaxInstallerExpiryLength = 100;
        public const int MaxElectricalExpiryLength = 100;
        public const int MaxDesignerExpiryLength = 100;
        public const int MaxAccreditationAccPhotoLength = 200;
        public const int MaxLicencePhotoLength = 200;
        public const int MaxInstallerSignatureLength = 50;
        public const int MaxElectricianSignatureLength = 50;
        public const int MaxDesignerSignatureLength = 50;

        public int TenantId { get; set; }

        public virtual int UserId { get; set; }

        public virtual string UserName { get; set; }

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

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

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

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

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

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

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

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

        public virtual int AddressType { get; set; }

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

        public virtual int PostalDelType { get; set; }

        [Required]
        public virtual bool IsGST { get; set; }

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

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

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

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

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

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

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

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

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

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

        public virtual bool? IsInst { get; set; }

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

        public virtual DateTime? InsAccreExDate { get; set; }

        public virtual bool? IsElec { get; set; }

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

        public virtual DateTime? EleLicenceExDate { get; set; }

        public virtual bool? IsDesc { get; set; }

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

        public virtual DateTime? DesignerAccreExDate { get; set; }

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

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

        public virtual Guid Guid { get; set; }

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

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

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

        public virtual int IsApproved { get; set; }

        public virtual string RejectReason { get; set; }
    }
Question

Hello,

There are Parent and Child table from which i fetch details and display on my Grid page. I Want to Sort my column which are not from my parent table but using belo code I got Some error.

public async Task<PagedResultDto<InvitationListDto>> GetInvitation(GetInvitationInput input)
        {
            var Invitation_List = _InstallerRepository
               .GetAll();

            var InvitationList = (from Inst in Invitation_List
                                  join Us in _userRepository.GetAll() on Inst.UserId equals Us.Id into Usjoined
                                  from Us in Usjoined.DefaultIfEmpty()
                                  where (Inst.UserId != 0 && Inst.IsApproved == 0)
                                  group Inst by Inst into instGrouped
                                  select instGrouped.Key);

            var resultCount = await InvitationList.CountAsync();
            var results = await InvitationList
                .AsNoTracking()
                .OrderBy(input.Sorting)
                .PageBy(input)
                .ToListAsync();

            var Invitation = results.MapTo<List<InvitationListDto>>();
            foreach (var item in Invitation)
            {
                item.CustName = _tenantRepository.GetAll().Where(p => p.Id == item.TenantId).Select(p => p.FullName).FirstOrDefault();
            }

            return new PagedResultDto<InvitationListDto>(resultCount, Invitation.MapTo<List<InvitationListDto>>());
        }
Answer

ASP.NET MVC 5.x with AngularJS

Showing 31 to 40 of 50 entries