private void btnOk_Click(object sender, EventArgs e) { if (cardGrid.RowCount == 0) { Pub.ShowErrorMsg(Pub.GetResText(formCode, "ErrorSelectEmp", "")); return; } selList = new TDownSelectList[cardGrid.RowCount]; DataTable dtEmp = (DataTable)cardGrid.DataSource; for (int i = 0; i < dtEmp.Rows.Count; i++) { selList[i] = new TDownSelectList(); selList[i].EmpSysID = dtEmp.Rows[i]["EmpSysID"].ToString(); selList[i].EnrollNumber = Convert.ToUInt32(dtEmp.Rows[i]["CardFingerNo"].ToString()); selList[i].EnrollName = dtEmp.Rows[i]["EmpName"].ToString(); selEmpSysID += "'" + selList[i].EmpSysID + "',"; } if (selEmpSysID != "") { selEmpSysID = selEmpSysID.Substring(0, selEmpSysID.Length - 1); } this.Close(); this.DialogResult = DialogResult.OK; }
private void btnOk_Click(object sender, EventArgs e) { string sql = ""; if (rbEmp.Checked) { if (cardGrid.RowCount == 0) { Pub.MessageBoxShow(Pub.GetResText(formCode, "ErrorSelectEmp", "")); return; } selList = new TDownSelectList[cardGrid.RowCount]; DataTable dtEmp = (DataTable)cardGrid.DataSource; for (int i = 0; i < dtEmp.Rows.Count; i++) { selList[i] = new TDownSelectList(); selList[i].EmpNo = dtEmp.Rows[i]["EmpNo"].ToString(); selList[i].EnrollName = dtEmp.Rows[i]["EmpName"].ToString(); selList[i].EnrollNumber = Convert.ToUInt32(dtEmp.Rows[i]["FingerNo"].ToString()); selEmpNo += "'" + selList[i].EmpNo + "',"; } if (selEmpNo != "") { selEmpNo = selEmpNo.Substring(0, selEmpNo.Length - 1); } } else { sql = Pub.GetSQL(DBCode.DB_000300, new string[] { "303" }); Upload = SystemInfo.db.GetDataTable(sql); for (int i = 0; i < Upload.Rows.Count; i++) { selEmpNo += "'" + Upload.Rows[i]["EmpNo"].ToString() + "',"; } if (selEmpNo != "") { selEmpNo = selEmpNo.Substring(0, selEmpNo.Length - 1); } } this.Close(); this.DialogResult = DialogResult.OK; }