Ejemplo n.º 1
0
        /// <summary>
        /// function to create the License  for multiple User . This function will be used for bulk license mapping to
        /// multiple User.
        /// </summary>
        /// <param name="licList">license List</param>
        /// <param name="userIdList">user Id List</param>
        /// <returns></returns>
        public bool CreateMultipleTeamLicense(TeamLicenseDataMapping model)
        {
            LicenseLogic licLogic = new LicenseLogic();

            foreach (var teamId in model.TeamList)
            {
                for (int concurrentUserIndex = 0; concurrentUserIndex < model.ConcurrentUserCount; concurrentUserIndex++)
                {
                    int id = int.Parse(teamId);
                    for (int index = 0; index < model.ProductIdList.Count; index++)
                    {
                        var         proId = model.ProductIdList[index];
                        var         data  = Work.LicenseDataRepository.GetData(l => l.ProductId == proId).ToList().Select(l => l.Id).ToList();
                        var         licId = licLogic.GetUnassignedLicenseForTeam(model.ProductIdList[index]);
                        TeamLicense tl    = new TeamLicense()
                        {
                            LicenseId = licId.Id,
                            TeamId    = id,
                            ProductId = proId
                        };
                        CreateTeamLicense(tl);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        private bool CreateTeamLicense(TeamLicense teamLicense)
        {
            var obj = AutoMapper.Mapper.Map <TeamLicense, Core.Model.TeamLicense>(teamLicense);

            obj = Work.TeamLicenseRepository.Create(obj);
            Work.TeamLicenseRepository.Save();
            UpdateLicenseStatus(obj.LicenseId, true);
            return(obj.Id > 0);
        }