public static string GetAgeByBirthday(string birthday, string currentDate) { DateTime dateBirthday; DateTime dateCuurrent; if (DataValidateManager.ValidateDateFormat(birthday)) { dateBirthday = DateTime.Parse(birthday); if (DataValidateManager.ValidateDateFormat(currentDate)) { dateCuurrent = DateTime.Parse(currentDate); } else { dateCuurrent = DateTime.Now; } return(RoundInt((dateCuurrent - dateBirthday).Days / 365).ToString()); } return("0"); }
public static bool ValidateUserPurview(string strUserID, string strUserGroupID, string strPurviewID) { Database db = DatabaseFactory.CreateDatabase("strConnManager"); string strProcName = "SP_ValidatePurview"; DbCommand cmdProc = db.GetStoredProcCommand(strProcName); db.AddInParameter(cmdProc, "@UserID", DbType.String); db.AddInParameter(cmdProc, "@UserGroupID", DbType.String); db.AddInParameter(cmdProc, "@PurviewID", DbType.String); db.AddOutParameter(cmdProc, "@MessageID", DbType.String, 50); db.SetParameterValue(cmdProc, "@UserID", strUserID); db.SetParameterValue(cmdProc, "@UserGroupID", strUserGroupID); db.SetParameterValue(cmdProc, "@PurviewID", strPurviewID); db.ExecuteNonQuery(cmdProc); return(DataValidateManager.ValidateIsNull(db.GetParameterValue(cmdProc, "@MessageID"))); }