void BtnRandomGenerateClick(object sender, EventArgs e) { var ra = new Random(); int ryear = Convert.ToInt32(DateTime.Now.Year.ToString()) - ra.Next(19, 45); int rmonth = ra.Next(1, 12); int rday = ra.Next(1, PRCIDSum.dayOfYearMonth(ryear, rmonth)); birthBox.Text = ryear + rmonth.ToString("D2") + rday.ToString("D2"); placeCodeBox.Text = PRCIDSum.placesIdList[ra.Next(0, PRCIDSum.placesIdList.Length)].ToString(); generateBtn_Click(sender, e); }
void generateBtn_Click(object sender, EventArgs e) { var generatedIdNumber = new StringBuilder(); generatedIdNumber.Append(placeCodeBox.Text).Append(birthBox.Text); int rdidNum = Rnd.Next(500) * 2; if (sexSelect_1.Checked) { rdidNum += 1; } generatedIdNumber.Append(rdidNum.ToString("D3")); char checkChr = PRCIDSum.getCheckChar(generatedIdNumber.ToString()); idNumBox.Text = checkChr == '?' ? "输入不符规范" : generatedIdNumber.Append(checkChr).ToString(); }
void checkBtn_Click(object sender, EventArgs e) { var vForm = new FormIsNumberValid(PRCIDSum.getInformationsInIdNumber(idNumBox.Text)); vForm.ShowDialog(this); }