protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         LoadDDLs();
         if (CurrentStudentToPay != 0)
         {
             //BindData();
             DBLayer db = new DBLayer();
             DataSet ds = new DataSet();
             ds = db.GetInstallmentsByStudentIDAndSchoolYearID(CurrentStudentToPay, Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue));
             if (ds.Tables[0].Rows.Count > 0)
             {
                 uiTextBoxQty.Text = ds.Tables[0].Rows[0]["Quantity"].ToString();
                 uiTextBoxDate.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Parse(ds.Tables[0].Rows[0]["Date"].ToString()));
                 uiTextBoxPayOrderNo.Text = ds.Tables[0].Rows[0]["PayOrderNo"].ToString();
             }
             uiPanelCurrentInstallments.Visible = false;
             uiPanelCurrent.Visible = true;
         }
         else
         {
             uiPanelCurrentInstallments.Visible = true;
             uiPanelCurrent.Visible = false;
             BindStudentsData();
         }
     }
 }
예제 #2
0
        private void BindData()
        {
            DBLayer db = new DBLayer();
            DataSet Installments = new DataSet();
            DataSet Fees = new DataSet();
            Fees = db.GetFeesByStudentIDAndSchoolYear(Convert.ToInt32(Session["CurrentLoggedInStudent"].ToString()), Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue));
            Installments = db.GetInstallmentsByStudentIDAndSchoolYearID(Convert.ToInt32(Session["CurrentLoggedInStudent"].ToString()), Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue));

            uiGridViewInstallments.DataSource = Installments;
            uiGridViewInstallments.DataBind();
            float totalpaied = 0;
            float TotalFees = 0;

            float RemainingYearLastYear = 0;
            float BooksFees = 0;
            float BusFees = 0;
            float UniformFees = 0;
            float OtherFees = 0;
            float ActivitiesFees = 0;

            for (int i = 0; i < Installments.Tables[0].Rows.Count; i++)
            {
                totalpaied += float.Parse(Installments.Tables[0].Rows[i]["Quantity"].ToString());
            }

            for (int i = 0; i < Fees.Tables[0].Rows.Count; i++)
            {
                RemainingYearLastYear += float.Parse(Fees.Tables[0].Rows[i]["RemainingFeesLastYear"].ToString());
                BooksFees += float.Parse(Fees.Tables[0].Rows[i]["BooksFees"].ToString());
                BusFees += float.Parse(Fees.Tables[0].Rows[i]["BusFees"].ToString());
                UniformFees += float.Parse(Fees.Tables[0].Rows[i]["UniformFees"].ToString());
                OtherFees += float.Parse(Fees.Tables[0].Rows[i]["OtherFees"].ToString());
                ActivitiesFees += float.Parse(Fees.Tables[0].Rows[i]["ActivitiesFees"].ToString());
            }

            TotalFees = RemainingYearLastYear + BooksFees + BusFees + UniformFees + OtherFees + ActivitiesFees;

            uiLabelRemaining.Text = RemainingYearLastYear.ToString();
            uiLabelBooks.Text = BooksFees.ToString();
            uiLabelBus.Text = BusFees.ToString();
            uiLabelUniform.Text = UniformFees.ToString();
            uiLabelOther.Text = OtherFees.ToString();
            uiLabelAct.Text = ActivitiesFees.ToString();

            uiLabelTotal.Text = TotalFees.ToString();
            uiLabelTotalPaid.Text = totalpaied.ToString();

            uiLabelInvoiceTotal.Text = (TotalFees - totalpaied).ToString();
        }
 private void BindData()
 {
     DBLayer db = new DBLayer();
     DataSet ds = new DataSet();
     ds = db.GetInstallmentsByStudentIDAndSchoolYearID(CurrentStudentToPay, Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue));
     uiGridViewStudentsInstallments.DataSource = ds;
     uiGridViewStudentsInstallments.DataBind();
 }
 protected void uiGridViewStudents_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditInstallments")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentStudentToPay = id;
         DBLayer db = new DBLayer();
         DataSet ds = new DataSet();
         ds = db.GetStudent(CurrentStudentToPay);
         if (ds.Tables[0].Rows.Count > 0)
         {
             uiGridViewStudentsInstallments.DataSource = db.GetInstallmentsByStudentIDAndSchoolYearID(CurrentStudentToPay, Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue));
             uiGridViewStudentsInstallments.DataBind();
             uiLabelStudentName.Text = ds.Tables[0].Rows[0]["ARStudentName"].ToString() + " " + ds.Tables[0].Rows[0]["ArFatherName"].ToString();
             DataSet StudentClassRoom = new DataSet();
             StudentClassRoom = db.GetClassRoom(Convert.ToInt32(ds.Tables[0].Rows[0]["ClassRoomID"].ToString()));
             DataSet StudentClass = new DataSet();
             StudentClass = db.GetClass(Convert.ToInt32(StudentClassRoom.Tables[0].Rows[0]["ClassID"].ToString()));
             uiLabelClass.Text = StudentClass.Tables[0].Rows[0]["ArName"].ToString();
         }
         uiPanelCurrentInstallments.Visible = false;
         uiPanelCurrent.Visible = true;
     }
 }