Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         LoadDDLs();
         if (CurrentStudentActive != 0)
         {
             //BindData();
             DBLayer db = new DBLayer();
             DataSet ds = new DataSet();
             ds = db.GetFeesByStudentIDAndSchoolYear(CurrentStudentActive,Convert.ToInt32(uiDropDownListSchoolYear.SelectedValue));
             if (ds.Tables[0].Rows.Count > 0)
             {
                 uiTextBoxRemainingFees.Text = ds.Tables[0].Rows[0]["RemainingFeesLastYear"].ToString();
                 uiTextBoxBooksFees.Text = ds.Tables[0].Rows[0]["BooksFees"].ToString();
                 uiTextBoxBusFees.Text = ds.Tables[0].Rows[0]["BusFees"].ToString();
                 uiTextBoxUniformFees.Text = ds.Tables[0].Rows[0]["UniformFees"].ToString();
                 uiTextBoxActFees.Text = ds.Tables[0].Rows[0]["ActivitiesFees"].ToString();
                 uiTextBoxOtherFees.Text = ds.Tables[0].Rows[0]["OtherFees"].ToString();
             }
             uiPanelCurrentFees.Visible = false;
             uiPanelCurrent.Visible = true;
         }
         else
         {
             uiPanelCurrentFees.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();
        }