Beispiel #1
0
        } // constructor

        public LicensingUsage Get()
        {
            if (_data.Licenses == null)
            {
                throw new InvalidDataException();
            }
            if (_data.Licenses.Count == 0)
            {
                throw new InvalidDataException();
            }

            _licenses   = new Dictionary <string, LicenseAppliesTo>(_data.Licenses.Count, StringComparer.InvariantCultureIgnoreCase);
            _libraries  = new Dictionary <string, HashSet <string> >(StringComparer.InvariantCultureIgnoreCase);
            _thirdParty = new Dictionary <string, HashSet <string> >(StringComparer.InvariantCultureIgnoreCase);

            foreach (var license in _data.Licenses)
            {
                _licenses.Add(license.Id, new LicenseAppliesTo
                {
                    Libraries  = new List <LibraryDependency>(),
                    ThirdParty = new List <ThirdPartyDependency>()
                });
                _libraries.Add(license.Id, new HashSet <string>(StringComparer.InvariantCulture));
                _thirdParty.Add(license.Id, new HashSet <string>(StringComparer.InvariantCulture));
            } // foreach

            AddLibrary(_data.Licensed.ConvertToLibraryDependency());
            AddLibraries(_data.Dependencies?.Libraries);
            AddThirdParty(_data.Dependencies?.ThirdParty);
            Sort();

            var result = new LicensingUsage
            {
                Licensed = _data.Licensed,
                Usage    = new List <LicenseUsage>(_data.Licenses.Count)
            };

            foreach (var license in _data.Licenses)
            {
                var expanded = new LicenseUsage {
                    License = license, AppliesTo = _licenses[license.Id]
                };
                if (!expanded.AppliesTo.LibrariesSpecified && !expanded.AppliesTo.ThirdPartySpecified)
                {
                    expanded.AppliesTo = null;
                } // if

                result.Usage.Add(expanded);
            } // foreach license

            return(result);
        } // Get
Beispiel #2
0
        public async Task <LicenseUsage> GetLicenseUsage(int?month, int?year)
        {
            var prm = new DynamicParameters();

            prm.Add("@month", month);
            prm.Add("@year", year);
            var usage = new LicenseUsage();

            usage.Summary = await _connectionWrapper.QueryAsync <LicenseUsageSummary>("[AdminStore].GetLicenseUsage", prm, commandType : CommandType.StoredProcedure);

            usage.UserActivities = await _connectionWrapper.QueryAsync <LicenseUserActivity>("[AdminStore].GetLicenseUserActivity", prm, commandType : CommandType.StoredProcedure);

            return(usage);
        }
Beispiel #3
0
        // foreach (Control control in controls)
        //{
        //   if (control.GetType().Equals(CheckBox))
        //   {
        //       //----------
        //   }
        //}

        private void FillLicenseUsagegrid()
        {
            try
            {
                DataTable dt = VSWebBL.ConfiguratorBL.LicenseBL.Ins.Getlicenseusage();
                LicenseUsage.DataSource = dt;
                Session["Licence"]      = dt;
                LicenseUsage.DataBind();
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }
        public static string GetLicenseUsage(LicenseUsage usage)
        {
            switch (usage)
            {
            case LicenseUsage.Demo:
                return("Evaluation");

            case LicenseUsage.Academic:
                return("Academic");

            case LicenseUsage.Personal:
                return("Personal");

            case LicenseUsage.Commercial:
                return("Commercial");

            default:
                return(string.Empty);
            } // switch
        }
Beispiel #5
0
        private void FillLicenseUsagegridfromSession()

        {
            try
            {
                DataTable Licenceinformation = new DataTable();
                if (Session["Licence"] != null && Session["Licence"] != "")
                {
                    Licenceinformation = (DataTable)Session["Licence"];                    //VSWebBL.ConfiguratorBL.WindowsPropertiesBL.Ins.GetAllData();
                }
                if (Licenceinformation.Rows.Count > 0)
                {
                    LicenseUsage.DataSource = Licenceinformation;
                    LicenseUsage.DataBind();
                }
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }