private void PaymentCD_CodeKeyDownEvent(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { PaymentCD.ChangeDate = bbl.GetDate(); if (!string.IsNullOrEmpty(PaymentCD.TxtCode.Text)) { if (PaymentCD.SelectData()) { PaymentCD.Value1 = PaymentCD.TxtCode.Text; PaymentCD.Value2 = PaymentCD.LabelText; } else { bbl.ShowMessage("E101"); PaymentCD.SetFocus(1); } } } }
private bool ErrorCheck() { if (!string.IsNullOrWhiteSpace(txtRecordDateFrom.Text) && !string.IsNullOrWhiteSpace(txtRecordDateTo.Text)) { DateTime dt1 = Convert.ToDateTime(txtRecordDateFrom.Text); DateTime dt2 = Convert.ToDateTime(txtRecordDateTo.Text); if (dt1 > dt2) { skhnobl.ShowMessage("E104"); txtRecordDateTo.Focus(); return(false); } } if (!string.IsNullOrWhiteSpace(txtEntryDateFrom.Text) && !string.IsNullOrWhiteSpace(txtEntryDateTo.Text)) { DateTime dt1 = Convert.ToDateTime(txtEntryDateFrom.Text); DateTime dt2 = Convert.ToDateTime(txtEntryDateTo.Text); if (dt1 > dt2) { skhnobl.ShowMessage("E104"); txtEntryDateTo.Focus(); return(false); } } if (!string.IsNullOrWhiteSpace(txtPaymentDateFrom.Text) && !string.IsNullOrWhiteSpace(txtPaymentDateTo.Text)) { DateTime dt1 = Convert.ToDateTime(txtPaymentDateFrom.Text); DateTime dt2 = Convert.ToDateTime(txtPaymentDateTo.Text); if (dt1 > dt2) { skhnobl.ShowMessage("E104"); txtPaymentDateTo.Focus(); return(false); } } if (!string.IsNullOrWhiteSpace(txtPaymentDueDateFrom.Text) && !string.IsNullOrWhiteSpace(txtPaymentDueDateTo.Text)) { DateTime dt1 = Convert.ToDateTime(txtPaymentDueDateFrom.Text); DateTime dt2 = Convert.ToDateTime(txtPaymentDueDateTo.Text); if (dt1 > dt2) { skhnobl.ShowMessage("E104"); txtPaymentDueDateTo.Focus(); return(false); } } if (!String.IsNullOrEmpty(PaymentCD.TxtCode.Text)) { if (!PaymentCD.IsExists(2)) { bbl.ShowMessage("E101"); PaymentCD.SetFocus(1); return(false); } } //<remark>支払済、未支払のどちらもチェックが入っていない場合、エラー<remark> if (chkPaid.Checked == false && chkUnpaid.Checked == false) { skhnobl.ShowMessage("E111"); chkPaid.Focus(); return(false); } if (!String.IsNullOrEmpty(scStaffCD.TxtCode.Text)) { if (!scStaffCD.IsExists(2)) { bbl.ShowMessage("E101"); scStaffCD.SetFocus(1); return(false); } } //zco //<remark>支払済、未支払両方チェックする場合、エラー<remark> //if (chkPaid.Checked == true && chkUnpaid.Checked == true) //{ // MessageBox.Show("Please! Check only one Checkbox.", "Message"); // chkPaid.Focus(); // return false; //} return(true); }