private activation GetProductKeyDetails() { activation pl = new activation(); string connectionString = ConfigurationManager.ConnectionStrings["dbx"].ConnectionString; using (SqlConnection conn = new SqlConnection(connectionString)) { using (SqlCommand cmd = new SqlCommand("SELECT * FROM productkey", conn)) { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); pl.ProductKey = reader["ProductKey"].ToString(); pl.TrialExpiryDate = Convert.ToDateTime(reader["TrialExpiryDate"]); } } return(pl); }
private void CheckProductKeyDetails() { activation prodlicense = GetProductKeyDetails(); int totaldaysleft = 0; if (prodlicense.ProductKey == string.Empty) { if (prodlicense.TrialExpiryDate == new DateTime(1900, 1, 1)) { UpdateTrialExpiryDate(); totaldaysleft = FindTotalTrialDaysLeft(DateTime.Now.Date.AddMonths(1), DateTime.Now.Date); } else { totaldaysleft = FindTotalTrialDaysLeft(prodlicense.TrialExpiryDate, DateTime.Now.Date); } ShowActivationForm(totaldaysleft); } }