private void IsMonthlyFeeGenerated()
        {
            int   LastMonthNo         = 0;
            Int32 currentAcademicYear = Common.Get_Current_Academic_Year();

            feeGenerate = new FeeGenerate();
            string returnValue = feeGenerate.IsMonthlyFeeGenerated(currentAcademicYear, out LastMonthNo);

            generatedMonthList = feeGenerate.GetPurchasesFeeList(currentAcademicYear);
            generatedMonthList = generatedMonthList ?? new List <Month_Model>();

            DisableMonthCheckBox(generatedMonthList);

            if (!string.IsNullOrWhiteSpace(returnValue))
            {
                bool isGenerated = returnValue.ToLower() == "true" ? true : false;
                if (isGenerated)
                {
                    lblMessage.Text = "Fee for the month is already generated.";
                }
                else
                {
                    lblMessage.Text = "Fee for the month is not generated. Please select month to generate\nmonthly fee.";
                }
            }

            /* Here 15 is eqivalent to MARCH
             * IF Month Value from DB IS 15(March)
             */
            //if (LastMonthNo == 15)
            //    btnGenerateFee.Enabled = false;
            //else
            //    btnGenerateFee.Enabled = true;
        }
        private void btnGenerateFee_Click(object sender, EventArgs e)
        {
            #region Count_of_Enable_Checked_Check_Box
            int EnableCheckBoxCount = 0;

            foreach (Control control in this.panelMonths.Controls)
            {
                if (control.GetType() == typeof(CheckBox))
                {
                    CheckBox ckBox = (CheckBox)control;
                    if (ckBox.Enabled == true && ckBox.Checked == true)
                    {
                        EnableCheckBoxCount++;
                    }
                }
            }

            if (EnableCheckBoxCount > 3)
            {
                MessageBox.Show("You can only generate fee of maximum 3 months.", "Generate Fee", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            #endregion

            #region Validation
            int    countMonths = dicCheckBox.Where(x => x.Value.Checked == false).Count();
            string month_Value = GetCommaSepratedMonthValue();
            if (countMonths > 0)
            {
                MessageBox.Show("Please select month to generate fee.", "Generate Fee", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            #endregion

            try
            {
                btnGenerateFee.Enabled = false;
                feeGenerate            = new FeeGenerate();
                lblPleaseWait.Visible  = true;
                short returnValue = feeGenerate.GenerateMonthlyFee(month_Value, Common.Get_Current_Academic_Year());
                switch (returnValue)
                {
                case 1:
                    MessageBox.Show("Fee Generated Successfully.", "Generate Fee", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    IsMonthlyFeeGenerated();
                    break;

                case 0:
                    MessageBox.Show("Fee Already Generated For This Month.", "Generate Fee", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;

                case -1:
                    MessageBox.Show("Error: Please Contact To Admin.", "Generate Fee", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: Please Contact To Admin.", "Generate Fee", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                lblPleaseWait.Visible = false;
            }
        }