Esempio n. 1
0
        private void UpdatePaymentDetails()
        {
            DataGridViewPaymentDetails.Rows.Clear();

            // Retrieve the RentYearID
            RentYear selectedRentYear = (RentYear)ComboBoxRentYear.SelectedItem;
            int      rentYearID       = selectedRentYear.YearID;

            // Retrieve records of LeasePayment for TenantID for RentYearID
            LeasePaymentDA paymentDA        = new LeasePaymentDA();
            DataTable      paymentDetailsDT = paymentDA.GetAllPaymentDetailsByRentYearID(rentYearID);

            DataGridViewPaymentDetails.Rows.Clear();

            for (int i = 0; i <= paymentDetailsDT.Rows.Count - 1; i++)
            {
                DataGridViewRow row = new DataGridViewRow();

                row.CreateCells(DataGridViewPaymentDetails);
                row.Cells[0].Value = Helper.GetNepaliNumber(i + 1);
                row.Cells[1].Value = paymentDetailsDT.Rows[i][0];
                row.Cells[2].Value = paymentDetailsDT.Rows[i][1];
                row.Cells[3].Value = paymentDetailsDT.Rows[i][2];
                row.Cells[4].Value = paymentDetailsDT.Rows[i][3];
                row.Cells[5].Value = paymentDetailsDT.Rows[i][5];
                row.Cells[6].Value = paymentDetailsDT.Rows[i][6];
                row.Cells[7].Value = paymentDetailsDT.Rows[i][7];
                row.Cells[8].Value = paymentDetailsDT.Rows[i][8];

                // Store land_id as Tag
                row.Tag = paymentDetailsDT.Rows[i][1];

                DataGridViewPaymentDetails.Rows.Add(row);
            }
        }
Esempio n. 2
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            LeasePaymentDA leasePaymentDA = new LeasePaymentDA();

            Tenant    selectedTenant = (Tenant)ComboBoxTenant.SelectedItem;
            LeaseLand leasedLand     = (LeaseLand)ComboBoxLeaseLand.SelectedItem;
            RentYear  rentYear       = (RentYear)ComboBoxRentYear.SelectedItem;

            MessageForm messageForm = new MessageForm();

            if (!leasePaymentDA.IsDuplicatePayment(leasedLand.LeaseID, rentYear.YearID))
            {
                LeasePayment newLeasePayment = new LeasePayment();
                newLeasePayment.LeaseID       = leasedLand.LeaseID;
                newLeasePayment.YearID        = rentYear.YearID;
                newLeasePayment.LeaseRent     = TextBoxAnnualRent.Text;
                newLeasePayment.PaymentDate   = TextBoxPaymentDate.Text;
                newLeasePayment.ReceiptNumber = TextBoxReceiptNumber.Text;
                newLeasePayment.Remarks       = TextBoxRemarks.Text;

                bool success = leasePaymentDA.SaveLeasePayment(newLeasePayment);

                if (success)
                {
                    messageForm.MessageText = $"उक्त जग्गाको {rentYear.TheRentYear} सालको ठेक्का बुझाएको अभिलेख सुरक्षित गरियो।";
                }
                else
                {
                    messageForm.MessageText = $"प्राविधिक कारणले गर्दा उक्त ठेक्का बुझाएको विवरण सुरक्षित गर्न सकिएन।";
                }
                messageForm.ShowDialog();
            }
            else
            {
                messageForm.MessageText = $"उक्त जग्गाको {rentYear.TheRentYear} सालको ठेक्का बुझाइसकेको छ।";
                messageForm.ShowDialog();
            }

            ClearFields();
        }