Days count in particular month..

Hariinakoti
Posted by Hariinakoti under ASP.NET category on | Points: 40 | Views : 1639
string[] month = new string[13];
int j = 0, status = 0;
IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true);
String datetime = txtdate.Text.Trim();
DateTime dt = DateTime.Parse(datetime, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
int mh = (Convert.ToDateTime(dt)).Month;
string Mnth = string.Empty;
switch (mh)
{
case 1:
Mnth = "January";
break;
case 2:
Mnth = "February";
break;
case 3:
Mnth = "March";
break;
case 4:
Mnth = "April";
break;
case 5:
Mnth = "May";
break;
case 6:
Mnth = "June";
break;
case 7:
Mnth = "July";
break;
case 8:
Mnth = "August";
break;
case 9:
Mnth = "September";
break;
case 10:
Mnth = "October";
break;
case 11:
Mnth = "November";
break;
case 12:
Mnth = "December";
break;
}
try
{
string query = "select count(*) from Empwd where EmployeeID='" + eid + "' and Month='" + Mnth + "'";
int i = int.Parse(dal.Executescalard(query));
if (i == 0)
{
return true;
}
else
{
query = "select Month from Empwd where EmployeeID='" + eid + "'";
ds = new DataSet();
ds = dal.getdatasetd(query);
foreach (DataRow row in ds.Tables[0].Rows)
{
month[j] = row["Month"].ToString();
if (Mnth == month[j])
{
status = 1;
break;
}
j++;
}
return false;

}
}
catch (Exception ex)
{
lblmsg.Text = ex.Message;
lblmsg.Visible = true;
lblmsg.ForeColor = System.Drawing.Color.Red;
}

if (status == 0)
{
return true;
}
else
{
return false;
}

Comments or Responses

Posted by: Mani5155 on: 4/11/2012 Level:Starter | Status: [Member] | Points: 10
What is the purpose of code?

Login to post response