示例#1
0
        private void btnGo_Click(object sender, EventArgs e)
        {
            if (txtDonorID.Text != string.Empty || txtDonorID.Text != "")
            {
                //DonationInformation parent = (DonationInformation)this.Owner;
                DonationRecording parent = (DonationRecording)this.Owner;
                var donorId     = txtDonorID.Text;
                var donorExists = donorRepositoy.checkModifyDonorIDExists(donorId);
                if (donorExists == null)
                {
                    MessageBox.Show("Entered Donor Id dosen't exist, kindly enter again to modify the record");
                    return;
                }
                //var selectedDonor = donors.Where(donor => donor.Id == donorId.Id).FirstOrDefault();
                parent.getDataFromChildWindow(donorExists);
                parentWinValue = parentWinValue + 1;
                this.Close();
            }

            else if (txtDonorName.Text != string.Empty || txtDonorName.Text != "")
            {
                //DonationInformation parent = (DonationInformation)this.Owner;
                DonationRecording parent = (DonationRecording)this.Owner;
                var donorName            = txtDonorName.Text;
                var donorExists          = donorRepositoy.checkModifyDonorNameExists(donorName);
                if (donorExists == null)
                {
                    MessageBox.Show("Entered Donor Name dosen't exist, kindly enter again to modify the record");
                    return;
                }
                //var selectedDonor = donors.Where(donor => donor.Id == donorId.Id).FirstOrDefault();
                parent.getDataFromChildWindow(donorExists);
                parentWinValue = parentWinValue + 1;
                this.Close();
            }

            else if (txtMRNO.Text != string.Empty || txtMRNO.Text != "")
            {
                //DonationInformation parent = (DonationInformation)this.Owner;
                DonationRecording parent = (DonationRecording)this.Owner;
                var donorName            = txtMRNO.Text;
                var donorExists          = donorRepositoy.checkModifyMRNoExists(donorName);
                if (donorExists == null)
                {
                    MessageBox.Show("Entered MR Nnumber dosen't exist, kindly enter again to modify the record");
                    return;
                }
                //var selectedDonor = donors.Where(donor => donor.Id == donorId.Id).FirstOrDefault();
                parent.getDataFromChildWindow(donorExists);
                parentWinValue = parentWinValue + 1;
                this.Close();
            }
            else
            {
                MessageBox.Show("Kindly enter data to modify the data");
                return;
            }
        }