C# Checking Same DOB & Different Name -
i checking on code regarding duplicate dob , different name. somehow stuck in here not sure start condition checking whereby if duplicate dob , different name logged file.
public static bool validatedob(string dob, string effdate, string policyno, string name) { bool var_return = true; string[] dobsplit = dob.split('/'); string var_day = dobsplit[0]; string var_month = dobsplit[1]; string var_year = dobsplit[2]; string[] effdatesplit = effdate.split('-'); //string var_name = name.tostring(); //streamwriter sb; if (convert.toint32(var_day) <= datetime.daysinmonth(convert.toint32(var_year), convert.toint32(var_month))) { datetime var_dob = convert.todatetime(var_year + "-" + var_month + "-" + var_day); datetime var_effdateastodaydate = convert.todatetime(effdatesplit[2] + "-" + effdatesplit[1] + "-" + effdatesplit[0]); int32 actualage = calculateage(var_dob, var_effdateastodaydate); if (actualage < 18 || actualage >= 60) { var_return = false; //sb = file.appendtext(var_logfilepath + "-testing.log"); //insertlogfile("error - age greater 64 or below 18 (actual age: " + actualage + ", dob: " + var_day + "/" + var_month + "/" + var_year + ")"); lfc.writetxtfile(var_logfilepath, var_errorlogfilename + "_" + var_minvalue + "-" + var_maxvalue + ".log", "error - age greater 60 or below 18 (policy no: " + policyno + ", actual age: " + actualage + ", dob: " + var_day + "/" + var_month + "/" + var_year + ")", true, true, false); } }
Comments
Post a Comment