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

Activities of "shyamjith"

Hi

Sorry, [it was my mistake. I was not passing the tenantId properly to the method.

new TenantRoleAndUserBuilder(context, Tenant.Id).Create();

Issue fixed

Hi,

  1. Yes seed method hits by VS in debug mode when you debug Migrator tool.
  2. "does it insert seed data when you create databases from scratch ?" Yes In case of host DB and not in case of tenant DB

Hi,

I am using Abp version 0.9.5.0. My application is a Single App Multiple DB SAAS .

I have a Host DB Called Host and three tenants DBs called T1, T2 and T3. I have seed for Inserting Admin Users and Default Roles and some other Initial Data, So I did run the migration tool which provided in the ABP Package, unfortunately, seed data are not inserted to Tenant DBs.

Here is the output I am getting

2017-05-25 17:52:35 | Host database: Default
2017-05-25 17:52:35 | Continue to migration for this host database and all tenan
ts..? (Y/N):
Y
2017-05-25 17:52:39 | HOST database migration started...
2017-05-25 17:52:52 | HOST database migration completed.
2017-05-25 17:52:52 | --------------------------------------------------------
2017-05-25 17:52:52 | Tenant database migration started... (1 / 2)
2017-05-25 17:52:52 | Name              : T1
2017-05-25 17:52:52 | TenancyName       : T1
2017-05-25 17:52:52 | Tenant Id         : 3
2017-05-25 17:52:52 | Connection string : Server=localhost; Database=T1; User ID=*****;password=******;
2017-05-25 17:52:55 | Tenant database migration completed. (1 / 2)
2017-05-25 17:52:55 | --------------------------------------------------------
2017-05-25 17:52:55 | Tenant database migration started... (2 / 2)
2017-05-25 17:52:55 | Name              : T2
2017-05-25 17:52:55 | TenancyName       : T2
2017-05-25 17:52:55 | Tenant Id         : 5
2017-05-25 17:52:55 |  Connection string : Server=localhost; Database=T2; User ID=*****;password=******;
2017-05-25 17:52:58 | Tenant database migration completed. (2 / 2)
2017-05-25 17:52:58 | --------------------------------------------------------
2017-05-25 17:52:58 | All databases have been migrated.
Press ENTER to exit...

But still, data are not inserted to tenant db

Hi,

I am developing an application, In this application, we are different portals for different User Role 1.B2B 2.B2C 3.Admin Portal

Users may have the same username, email Id but with Different roles, In Login I need to check username, password, tenancy name and role. How do I do this?

Hi,

I am using " _userManager.LoginAsync(usernameOrEmailAddress, password, tenancyName);" Method to login the application, which will accept both username and email address. but my requirement is to authenticate the user only with Username and password not with Email and password, How do I do that?

Hi,

I am using " _userManager.LoginAsync(usernameOrEmailAddress, password, tenancyName);" Method to login the application, which will accept both username and email address. but my requirement is to authenticate user only with Username and password not with Email and password, How do I do that?

No Actually . But it is a multi tenant ( Multiple DB) Application

Hi

In my application I have a list of recurring jobs , which are taken from the data base,

What I have done is , Taken the list of recurring job details from database , Iterated it and added to hangfire recurring job, But when I do this my DB is getting locked and application crashes or a timeout exception arises .

Please have a look at my code and help me figure out the problem

public void AddJob()
{

 var schedulerSettings = _schedulerManager.GetSchedulerSettings();
            List<SchedulerSettingViewModel> schedulerModel = schedulerSettings.Select(x => new SchedulerSettingViewModel()
            {
                Id = x.Id,
                MethodName = x.MethodName,
                ScheduledHour = x.ScheduledHour,
                ScheduledMinute = x.ScheduledMinute,
                SchedulerIntervalId = x.SchedulerIntervalId,
                SchedulerName = x.SchedulerName
            }).ToList();
            if (schedulerModel != null && schedulerModel.Count > 0)
            {
                foreach (var item in schedulerModel)
                {
                    if (item != null)
                    {
                          RecurringJob.RemoveIfExists(item.SchedulerName);
                        string jobInterval = "";
                        if (item.SchedulerIntervalId == (int)Enums.SchedulerInterval.Hourly)
                        {
                            jobInterval = Cron.Hourly(item.ScheduledHour);
                        }
                        else
                        {
                            jobInterval = Cron.Daily(item.ScheduledHour, item.ScheduledMinute);
                        }
                        //Type thisType = this.GetType();
                        //MethodInfo theMethod = thisType.GetMethod(item.MethodName);


                        //MethodInfo method = typeof(IBackGroundJobManager).GetMethod(item.MethodName);


                        //RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => method.Invoke(this, null), jobInterval);
                        switch (item.MethodName)
                        {
                            case "Job1":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job1(), jobInterval);
                                break;
                            case "Job2":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job2(), jobInterval);
                                break;
                            case "Job3":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job3(), jobInterval);
                                break;
                            case "Job4":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job4(), jobInterval);
                                break;
                            case "Job5":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job5(), jobInterval);
                                break;
                            case "Job6":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job6(), jobInterval);
                                break;
                        }

                    }
                }
            }

}


  public List<SchedulerSettingModel> GetSchedulerSettings()
        {

            using (_unitOfWorkManager.Begin())
            {
                _unitOfWorkManager.Current.SetTenantId(null);
                var schedulerSettingsList = _schedulerSettingsRepository.GetAllList();

                return schedulerSettingsList.Select(x => new SchedulerSettingModel()
                {

                    Id = x.Id,
                    MethodName = x.MethodName,
                    ScheduledHour = x.ScheduledHour,
                    ScheduledMinute = x.ScheduledMinute,
                    SchedulerIntervalId = x.SchedulerIntervalId,
                    SchedulerName = x.SchedulerName
                }).ToList();
            }

        }

Hi

I am trying to add a list of hangfire recurring jobs by iterating a list but I am getting an exception when running this code.

"An exception of type 'System.Transactions.TransactionManagerCommunicationException' occurred in System.Transactions.dll but was not handled in user code"

"Additional information: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool."

Here I am attacting my code

foreach(var item in schedulerModel)
                {
                    if(item!=null)
                    {
                        RecurringJob.RemoveIfExists(item.SchedulerName);
                        string jobInterval = "";
                        if(item.SchedulerIntervalId==(int)Enums.SchedulerInterval.Hourly)
                        {
                            jobInterval = Cron.Hourly(item.ScheduledHour);
                        }
                        else
                        {
                            jobInterval = Cron.Daily(item.ScheduledHour,item.ScheduledMinute);
                        }
                        //Type thisType = this.GetType();
                        //MethodInfo theMethod = thisType.GetMethod(item.MethodName);

                      
                        //MethodInfo method = typeof(IBackGroundJobManager).GetMethod(item.MethodName);

                      
                        //RecurringJob.AddOrUpdate(item.SchedulerName,() => method.Invoke(this, null), jobInterval);

                    switch(item.SchedulerName)
                        {
                            case "Job1":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t =>t.Job1(), jobInterval);
                                break;
                            case "Job2":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.Job2(), jobInterval);
                                break;
                            case "Job3":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.job3(), jobInterval);
                                break;
                            case "job4":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.job4(), jobInterval);
                                break;
                            case "job5":
                                RecurringJob.AddOrUpdate<IBackGroundJobManager>(item.SchedulerName, t => t.job5(), jobInterval);
                                break;
                       
                        }
                    }

                }

Hi,

I am trying to write code for downloading a file . I have a button called Download PDF, which will call an api to generate PDF and send the httpresponse object including the file and details, Here is my code

vm.getPDF = function () {
                    debugger;
                $http.get('api/services/app/user/getPdf', { responseType: "arraybuffer" }).success(function (data, status, headers) {
                    headers = headers();
                    debugger;
                    var filename = headers['x-filename'];
                    var contentType = headers['content-type'];

                    var linkElement = document.createElement('a');
                    try {
                        var blob = new Blob([data], { type: contentType });
                        var url = window.URL.createObjectURL(blob);

                        linkElement.setAttribute('href', url);
                        linkElement.setAttribute("download", filename);

                        var clickEvent = new MouseEvent("click", {
                            "view": window,
                            "bubbles": true,
                            "cancelable": false
                        });
                        linkElement.dispatchEvent(clickEvent);
                    } catch (ex) {
                        console.log(ex);
                    }
                }).error(function (data) {
                    console.log(data);
                });
            }
[HttpGet]
        public HttpResponseMessage getPDF()
        {
            HttpResponseMessage httpResponseMessage = new HttpResponseMessage();
            try
            {
                string fileName = "sample.pdf";
                string filePath = HttpContext.Current.Server.MapPath("~/App_Data/") + fileName;

                using (MemoryStream ms = new MemoryStream())
                {
                    using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                    {
                        byte[] bytes = new byte[file.Length];
                        file.Read(bytes, 0, (int)file.Length);
                        ms.Write(bytes, 0, (int)file.Length);


                        httpResponseMessage.Content = new ByteArrayContent(bytes.ToArray());
                        httpResponseMessage.Content.Headers.Add("x-filename", fileName);
                        httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
                        httpResponseMessage.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
                        httpResponseMessage.Content.Headers.ContentDisposition.FileName = fileName;
                        httpResponseMessage.StatusCode = HttpStatusCode.OK;

                    }

                }
                return httpResponseMessage;
            }
            catch (Exception ex)
            {

                return httpResponseMessage;
            }

        }

But I am getting result as null, I have tried this without using the ABP (using angular js, and web api) It works fine, I am attaching both projects here , Please have a look and let me know where it went wrong.

Showing 1 to 10 of 25 entries