protected void btnSave_Click(object sender, EventArgs e)
        {
            string msg = "Student promotion has been submitted!";

            TblCurrentEnrollment objpromotion = new TblCurrentEnrollment();

            objpromotion.IsNew = true;

            if (!string.IsNullOrEmpty(hfEnrollementID.Value))
            {
                objpromotion       = new TblCurrentEnrollment(hfEnrollementID.Value);
                objpromotion.IsNew = false;
                msg = "Student promotion has been updated!";
            }

            if (objpromotion.IsNew)
            {
                TblCurrentEnrollment objprev = new TblCurrentEnrollment(hfEnrollementIDToUpdate.Value);
                objprev.IsNew    = false;
                objprev.IsActive = 0;
                objprev.Save();

                TblSchFeeStructure objSch = new TblSchFeeStructure(hfschFeeID.Value);
                objSch.IsNew    = false;
                objSch.IsActive = 0;
                objSch.Save();
            }

            objpromotion.StudentID      = Convert.ToInt32(hfstudentID.Value);
            objpromotion.ClassNo        = Convert.ToInt32(ddlClassP.SelectedValue);
            objpromotion.BranchID       = Convert.ToInt32(Session["BranchID"]);
            objpromotion.EnrollmentDate = txtEnrollmentDate.SelectedDate;
            objpromotion.IsActive       = 1;
            if (objpromotion.IsNew)
            {
                objpromotion.CreateBy = Convert.ToString(Session["BranchUserID"]);
            }
            else
            {
                objpromotion.UpdatedBy = Convert.ToString(Session["BranchUserID"]);
            }

            if (ddlLevelP.SelectedValue == "2")
            {
                objpromotion.GroupID = Convert.ToInt32(ddlGroup.SelectedValue);
            }
            else
            {
                objpromotion.GroupID = null;
            }
            objpromotion.Save();

            // lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, msg, "alert alert-success alert-icon alert-dismissible", icon, "icon mdi mdi-check");
            //helper.ClearInputs(this.pnlDrop.Controls);
            hfstudentID.Value = "";
            txtEnrollmentDate.SelectedDate = null;
            ddlLevelP.SelectedValue        = "-1";
            ddlClassP.SelectedIndex        = 0;
            hfEnrollementID.Value          = "";
            hfEnrollementIDToUpdate.Value  = "";
            //LoadEnrolledStudents();
            DataTable dt = helper.ExecutePlainQuery("select StudentID,RegistrationNo from TblStudents where StudentID=" + objpromotion.StudentID);

            Response.Redirect("SchFeeEnrolement.aspx?val=" + dt.Rows[0]["RegistrationNo"]);
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //TblStudent objstudent = new TblStudent(TblStudent.Columns.RegistrationNo, txtAdmissionNO.Text);

            DataTable dt = helper.ExecutePlainQuery("select * from TblStudents where RegistrationNo='" + txtAdmissionNO.Text + "' and BranchID=" + Session["BranchID"]);

            if (dt.Rows.Count > 0)
            {
                TblSchFeeStructure objschFee = new TblSchFeeStructure();
                string             msg       = "Fee detail has been submit";

                objschFee.IsNew = true;

                if (!string.IsNullOrEmpty(hfSchFeeID.Value))
                {
                    objschFee       = new TblSchFeeStructure(hfSchFeeID.Value);
                    objschFee.IsNew = false;
                    msg             = "Fee detail has been updated";
                }

                int discount, remainingMonthlyFee, Monthlyfee;


                discount            = Convert.ToInt32(txtDiscount.Text);
                Monthlyfee          = Convert.ToInt32(txtMonthlyFee.Text);
                remainingMonthlyFee = Monthlyfee - discount;

                objschFee.StudentID    = Convert.ToInt32(dt.Rows[0]["StudentID"]);
                objschFee.AdmissionFee = Convert.ToInt32(lblAdmissionFee.Text);

                objschFee.Discount         = discount;
                objschFee.AdmissionPayable = Convert.ToInt32(txtAdmisionFee.Text);
                objschFee.MonthlyFee       = Convert.ToInt32(lblMonthlyFee.Text);
                objschFee.MonthlyPayable   = remainingMonthlyFee;

                if (OtherDescDiv.Visible)
                {
                    objschFee.DescriptionforOthers = txtOtherDescr.Text;
                }
                else
                {
                    objschFee.DescriptionforOthers = "N/A";
                }

                if (rdNone.Checked)
                {
                    objschFee.IsEscholarship = false;
                    objschFee.EScholarship   = "None";
                }
                else
                {
                    objschFee.EScholarship   = EscholarShip;
                    objschFee.IsEscholarship = true;
                }
                objschFee.IsActive = 1;
                objschFee.Save();
                helper.ClearInputs(Page.Controls);
                btnSave.Text                       = "Submit";
                BasciInfo.Visible                  = false;
                SectionScholarShips.Visible        = true;
                SectionScholarShipsHeading.Visible = true;
                rdNone.Checked                     = true;
                hfSchFeeID.Value                   = string.Empty;

                Response.Redirect("SchFeeEnrolement.aspx?msg=" + helper.Encrypt(msg));
            }
        }