Hi all,
I need to display a warning alert from the 15th of the current month to the last day of the current month for each month using C # and ASP NET.
For each month is compiled by users the customer satisfaction survey relating to the previous month.
This month June must be completed the month May customer satisfaction survey.
The May survey must be completed from 01st June to 16th June.
From 16th June to 30th June I need to display a alert that the survey for the month of June will be available from July 1st.
My question is if this C# code usable for all months of the year?
string tMonthS = DateTime.Now.AddMonths(1).ToString("MMMM");
DateTime dt = DateTime.Now;
DateTime start = new DateTime(dt.Year, dt.Month, 1).AddDays(15);
DateTime end = start.AddMonths(1).AddDays(-16);
string startOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).ToString("dd/MM/yyyy");
if (dt >= start && dt <= end)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "Msg",
"alert('Alert " + tMonthS.ToString() + " " + DateTime.Now.Year + "\\n" +
"available from the day " + startOfMonth.ToString() + "');", true);
}