public HrManage() { InitializeComponent(); helper = new OracleHelper(); employeeComment.DataSource = helper.showEmployeePerform(); employeeComment.Columns[1].ReadOnly = true; employeeComment.Columns[4].Visible = false; bool isLatest = true; string[] dateNow = System.DateTime.Now.ToShortDateString().ToString().Split('/'); DataTable allSalaryTypeAccountTime = helper.getAllSalaryTypeAccountTime(); for (int i = 0; i < allSalaryTypeAccountTime.Rows.Count; i++) { string[] dateExist = allSalaryTypeAccountTime.Rows[i][0].ToString().Split('/'); if (int.Parse(dateNow[0]) < int.Parse(dateExist[0])) { isLatest = false; break; } else if (int.Parse(dateNow[0]) == int.Parse(dateExist[0]) && int.Parse(dateNow[1]) <= int.Parse(dateExist[1])) { isLatest = false; break; } else { //isLatest } } if (isLatest == true) { helper.newSalaryTypeAccount(helper.getSalarySum(), System.DateTime.Now.ToLocalTime().ToString()); } }