Ejemplo n.º 1
0
        private bool CheckLicense()
        {
            bool          result      = false;
            string        path        = Environment.CurrentDirectory;
            List <string> files       = IOHelper.Instance.GetAllFiles(path);
            List <string> licenseList = files.Where(f => f.EndsWith(".lic")).ToList();

            if (licenseList == null || licenseList.Count <= 0)
            {
                return(result);
            }
            var confirm = new ConfirmLicense();

            foreach (var license in licenseList)
            {
                using (FileStream fs = new FileStream(license, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    byte[] buffer = new byte[fs.Length];
                    fs.Seek(0, SeekOrigin.Begin);
                    fs.Read(buffer, 0, buffer.Length);
                    bool isMatch = confirm.VerifyData(buffer);
                    if (isMatch == true)
                    {
                        result = true;
                        break;
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public void GetConfigValuesOfIsExpired()
        {
            ConfirmLicenseManager objConfirmLicenseManager = new ConfirmLicenseManager();
            NandanaResult         getAllConfigValues       = objConfirmLicenseManager.GetAllConfigValues();

            if (getAllConfigValues.resultDS != null && getAllConfigValues.resultDS.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in getAllConfigValues.resultDS.Tables[0].Rows)
                {
                    if (dr["Config_Name"].ToString() == "IsExpired")
                    {
                        if (dr["Config_Value"].ToString() == "1")
                        {
                            ConfirmLicense obj = new ConfirmLicense();
                            obj.IsExpired = dr["Config_Value"].ToString();
                            obj.ShowDialog();
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void CheckScanDocCountValue()
        {
            ConfirmLicenseManager objConfirmLicenseManager = new ConfirmLicenseManager();
            NandanaResult         getAllConfigValues       = objConfirmLicenseManager.GetAllConfigValues();

            if (getAllConfigValues.resultDS != null && getAllConfigValues.resultDS.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in getAllConfigValues.resultDS.Tables[0].Rows)
                {
                    if (dr["Config_Name"].ToString() == "ScanRecordCount")
                    {
                        if (dr["Config_Value"].ToString() == "")
                        {
                            ConfirmLicense obj = new ConfirmLicense();
                            //EnterScanDocCount obj = new EnterScanDocCount();
                            obj.ShowDialog();
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void CheckLicenseExpired()
        {
            bool matchFound = false;

            string IntialDate = string.Empty;
            string NumOfDays  = string.Empty;
            //DateTime Givendate=DateTime.Now;

            ConfirmLicenseManager objConfirmLicenseManager = new ConfirmLicenseManager();
            NandanaResult         getAllConfigValues       = objConfirmLicenseManager.GetAllConfigValues();

            if (getAllConfigValues.resultDS != null && getAllConfigValues.resultDS.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in getAllConfigValues.resultDS.Tables[0].Rows)
                {
                    switch (Convert.ToString(dr["Config_Name"].ToString()))
                    {
                    case "SetupDate":
                        if (dr["Config_Value"].ToString() != "")
                        {
                            IntialDate = (this.Decrypt(dr["Config_Value"].ToString()));
                        }
                        else
                        {
                            IntialDate = "";
                        }
                        break;

                    case "AllowedDays":
                        if (dr["Config_Value"].ToString() != "")
                        {
                            NumOfDays = (this.Decrypt(dr["Config_Value"].ToString()));
                        }
                        else
                        {
                            NumOfDays = "0";
                        }
                        break;
                    }
                }
            }

            if (Convert.ToInt32(NumOfDays) == 0)
            {
                ConfirmLicense obj = new ConfirmLicense();
                obj.Days = NumOfDays;
                obj.ShowDialog();
            }

            //DateTime expirydate = DateTime.ParseExact(IntialDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
            if ((DateTime.Today - DateTime.Parse(IntialDate, System.Globalization.CultureInfo.InvariantCulture)).Days <= Convert.ToInt16(NumOfDays))
            {
                matchFound = true;
            }
            if (!matchFound)
            {
                ConfirmLicense obj = new ConfirmLicense();
                obj.Days           = NumOfDays;
                obj.LicenseExpired = "True";
                obj.ShowDialog();
            }
        }