示例#1
0
        private void btnPayed_Click_1(object sender, EventArgs e)
        {
            int curSfid = Convert.ToInt32(grdList.SelectedRows[0].Cells["SFID"].Value);
            int curadmno = Convert.ToInt32(grdList.SelectedRows[0].Cells["AdmNo"].Value);

            Fee d = new Fee();
            DataTable dt = d.GetMaxSFID(curadmno);
            int maxsfid = Convert.ToInt32(dt.Rows[0]["maxsfid"]);



            if (grdList.SelectedRows[0].Cells["Status"].Value.ToString() == "Payed")
            {
                MessageBox.Show("Selected Transaction is Already Payed", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else if (grdList.SelectedRows[0].Cells["Status"].Value.ToString() == "Canceled")
            {
                MessageBox.Show("You Can Not Pay Canceled Slips", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else if (grdList.SelectedRows.Count == 0)
            {
                MessageBox.Show("No Record is Selected", "Select Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }



            else if (curSfid == maxsfid)
            {

                string di = MessageBox.Show(" Pay Selected Transaction ?", "Pay ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();

                if (di == "Yes")
                {

                    Fee f = new Fee();

                    if (f.SetPayed(Convert.ToInt32(grdList.SelectedRows[0].Cells["SFID"].Value), Convert.ToInt32(grdList.SelectedRows[0].Cells["AdmNo"].Value), Convert.ToInt32(grdList.SelectedRows[0].Cells["Total"].Value), Convert.ToInt32(grdList.SelectedRows[0].Cells["Payed"].Value), grdList.SelectedRows[0].Cells["Status"].Value.ToString()) == true)
                    {
                        MessageBox.Show("Status Updated to PAYED", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (byadmno == true && byclass == false)
                        {
                            LoadList();
                        }
                        else
                            LoadListByClass();


                    }
                    else
                    {
                        MessageBox.Show("Problem in Updating the transaction", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (byadmno == true && byclass == false)
                        {
                            LoadList();
                        }
                        else if (byadmno == false && byclass == true)
                            LoadListByClass();
                    }
                }

            }
            else
            {
                MessageBox.Show("You cant not Edit old Fee Records", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
示例#2
0
        private void grdList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
          
            int curSfid = Convert.ToInt32(grdList.SelectedRows[0].Cells["SFID"].Value);
            int curadmno = Convert.ToInt32(grdList.SelectedRows[0].Cells["AdmNo"].Value);

            Fee d = new Fee();
            DataTable dt = d.GetMaxSFID(curadmno);
            int maxsfid = Convert.ToInt32(dt.Rows[0]["maxsfid"]);


            if (curSfid == maxsfid && grdList.SelectedRows[0].Cells["Status"].Value.ToString() == "Fee Slip Issued")
           {

               if (e.RowIndex >= 0)
               {

                   frmAEFeeAdmission frm = new frmAEFeeAdmission((DataRowView)grdList.Rows[e.RowIndex].DataBoundItem);

                   if (frm.ShowDialog() == DialogResult.OK)
                   {
                       LoadList();
                   }
               }
           }
           else
           {
               MessageBox.Show("You cant not Edit old or payed or canceled Fee Records");
           }
        }