Exemplo n.º 1
0
        public string calculation()
        {
            int    totalPaid = 0;
            string gradeId   = "";

            DsPSMS.ST_STUDENT_CASHDataTable stuCashDt = new DsPSMS.ST_STUDENT_CASHDataTable();
            DsPSMS.ST_GRADE_MSTDataTable    grdDt     = new DsPSMS.ST_GRADE_MSTDataTable();
            DsPSMS.ST_STUDENT_CASHRow       stuCashDr = new DsPSMS.ST_STUDENT_CASHDataTable().NewST_STUDENT_CASHRow();
            DsPSMS.ST_GRADE_MSTRow          grdDr     = new DsPSMS.ST_GRADE_MSTDataTable().NewST_GRADE_MSTRow();

            // select GRADE_ID and CASH_AMOUNT
            grdDr.GRADE_ID = CoboGrade.SelectedItem.Text;
            grdDt          = grdSubService.selectGradeByID(grdDr, out msg);

            //get cash data and calculate paid amount
            stuCashDr.STUDENT_ID = TxtStudID.Text;
            stuCashDr.EDU_YEAR   = CoboYear.Text;
            stuCashDt            = stuCashService.getCashData(stuCashDr, out msg);
            for (int i = 0; i < stuCashDt.Rows.Count; i++)
            {
                totalPaid += Convert.ToInt32(stuCashDt[i].AMOUNT);
            }
            gradeId = grdDt[0].GRADE_ID;
            // gradeId = CoboGrade.Text;
            LabMonVal.Text    = "10 months";
            LabKyatVal.Text   = grdDt[0].MONTHLY_FEE;
            LabPaidVal.Text   = Convert.ToString(totalPaid);
            LabRemainVal.Text = Convert.ToString((10 * Convert.ToInt32(LabKyatVal.Text)) - totalPaid);

            return(gradeId);
        }
Exemplo n.º 2
0
        protected void BtnPay_Click(object sender, EventArgs e)
        {
            DsPSMS.ST_STUDENT_CASHRow stuCashDr = new DsPSMS.ST_STUDENT_CASHDataTable().NewST_STUDENT_CASHRow();
            if (CoboYear.Text.Trim().Length != 0)
            {
                stuCashDr.EDU_YEAR = CoboYear.Text;
                if (TxtStudID.Text.Trim().Length != 0)
                {
                    stuCashDr.STUDENT_ID = TxtStudID.Text;
                    stuCashDr.CASH_TITLE = LabCashTypeVal.Text;
                    if (cashDate.Text.Trim().Length != 0)
                    {
                        stuCashDr.CASH_DATE = cashDate.Text;
                        if (txtAccNoVal.Text.Trim().Length != 0)
                        {
                            stuCashDr.ACCOUNT_NO = txtAccNoVal.Text;
                            if (TxtAmountVal.Text.Trim().Length != 0)
                            {
                                stuCashDr.AMOUNT      = Convert.ToInt64(TxtAmountVal.Text);
                                stuCashDr.CRT_DT_TM   = DateTime.Now;
                                stuCashDr.CRT_USER_ID = this.userId;
                                stuCashDr.UPD_DT_TM   = DateTime.Now;
                                stuCashDr.UPD_USER_ID = "";
                                stuCashDr.DEL_FLG     = 0;

                                stuCashService.SaveStudentCashInfo(stuCashDr, out msg);
                                // MessageBox.Show(msg);
                                calculation();
                            }
                            else
                            {
                                errAmt.Text = "Please enter your cash amount";
                            }
                        }
                        else
                        {
                            errAccNo.Text = "Please enter your cash count";
                        }
                    }
                    else
                    {
                        errDate.Text = "Please choose the cash date";
                    }
                }
                else
                {
                    errId.Text = "Plese enter the student Id";
                }
            }
            else
            {
                errYear.Text = "Plese choose the Year";
            }
            // Response.Write("<script>alert('login successful');</script>");
        }
        //select Cash Type from ST_STUDENT_DATA table
        public DataSet.DsPSMS.ST_STUDENT_DATARow selectCashType(DataSet.DsPSMS.ST_STUDENT_DATARow dr)
        {
            DsPSMS.ST_STUDENT_CASHDataTable stuCashDt = new DsPSMS.ST_STUDENT_CASHDataTable();
            Open();
            query = "SELECT* FROM ST_STUDENT_DATA WHERE STUDENT_ID='" + dr.STUDENT_ID + "' AND EDU_YEAR='" + dr.EDU_YEAR + "' AND STUDENT_NAME='" + dr.STUDENT_NAME + "'AND GRADE_ID='" + dr.GRADE_ID + "'";
            SqlCommand     cmd = new SqlCommand(query, conn);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            da.Fill(stuDt);
            Close();
            return(stuDt[0]);
        }
        //select Cash information from ST_STUDENT_CASH table
        public DataSet.DsPSMS.ST_STUDENT_CASHDataTable selectCashDataByIdYear(DataSet.DsPSMS.ST_STUDENT_CASHRow dr)
        {
            DsPSMS.ST_STUDENT_CASHDataTable stuCashDt = new DsPSMS.ST_STUDENT_CASHDataTable();
            Open();
            query = "SELECT* FROM ST_STUDENT_CASH WHERE STUDENT_ID='" + dr.STUDENT_ID + "' AND EDU_YEAR='" + dr.EDU_YEAR + "'";
            SqlCommand     cmd = new SqlCommand(query, conn);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            da.Fill(stuCashDt);
            Close();
            return(stuCashDt);
        }
        //select all cash information from ST_STUDENT_CASH table
        public DataSet.DsPSMS.ST_STUDENT_CASHDataTable selectCashAllData()
        {
            DsPSMS.ST_STUDENT_CASHDataTable stuCashDt = new DsPSMS.ST_STUDENT_CASHDataTable();
            Open();
            query = "SELECT* FROM ST_STUDENT_CASH ";
            SqlCommand     cmd = new SqlCommand(query, conn);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            da.Fill(stuCashDt);
            Close();
            return(stuCashDt);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     DsPSMS.ST_STUDENT_CASHDataTable stuCashDt = new DsPSMS.ST_STUDENT_CASHDataTable();
     stuCashDt = stuCashService.getCashAllData(out msg);
     if (stuCashDt != null && stuCashDt.Rows.Count != 0)
     {
         stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
         stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
         stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
         stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
         stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
         cashList.DataSource = stuCashDt;
         cashList.DataBind();
     }
 }
        protected void showOneCashData(DsPSMS.ST_STUDENT_CASHRow dr)
        {
            DsPSMS.ST_STUDENT_CASHDataTable stuCashDt = new DsPSMS.ST_STUDENT_CASHDataTable();

            stuCashDt = stuCashService.getCashData(dr, out msg);
            if (stuCashDt != null)
            {
                stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
                stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
                stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
                stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
                stuCashDt.Columns.Remove(stuCashDt.Columns[7]);
                cashList.DataSource = stuCashDt;
                cashList.DataBind();
            }
        }
        public DataSet.DsPSMS.ST_STUDENT_CASHDataTable getCashData(DataSet.DsPSMS.ST_STUDENT_CASHRow dr, out string msg)
        {
            DsPSMS.ST_STUDENT_CASHDataTable stuCashDt = new DsPSMS.ST_STUDENT_CASHDataTable();
            try
            {
                Open();
                stuCashDt = stuCashDb.selectCashDataByIdYear(dr);
                msg       = "Have data";
            }
            catch
            {
                msg = "error occurs when selecting cash data";
                return(null);
            }
            finally
            {
                Close();
            }

            return(stuCashDt);
        }
        protected void CoboSelect_Change(object sender, EventArgs e)
        {
            DsPSMS.ST_STUDENT_CASHRow stuCashDr = new DsPSMS.ST_STUDENT_CASHDataTable().NewST_STUDENT_CASHRow();
            DsPSMS.ST_STUDENT_DATARow stuDataDr = new DsPSMS.ST_STUDENT_DATADataTable().NewST_STUDENT_DATARow();

            if (TxtStudID.Text.Trim().Length != 0)
            {
                stuDataDr.STUDENT_ID = TxtStudID.Text;
                stuCashDr.STUDENT_ID = TxtStudID.Text;
                stuDataDr.EDU_YEAR   = CoboYear.Text;
                stuCashDr.EDU_YEAR   = CoboYear.Text;
                stuDataDr            = stuService.getStuName(stuDataDr, out msg);
                if (stuDataDr != null)
                {
                    LabStuNameVal.Text = stuDataDr.STUDENT_NAME;
                }
                else
                {
                    // MessageBox.Show(msg);
                    showOneCashData(stuCashDr);
                }
            }
        }
        protected void search_Click(object sender, EventArgs e)
        {
            DsPSMS.ST_STUDENT_CASHRow stuCashDr = new DsPSMS.ST_STUDENT_CASHDataTable().NewST_STUDENT_CASHRow();
            DsPSMS.ST_STUDENT_DATARow stuDataDr = new DsPSMS.ST_STUDENT_DATADataTable().NewST_STUDENT_DATARow();

            if (CoboYear.Text.Trim().Length != 0 && TxtStudID.Text.Trim().Length != 0)
            {
                stuDataDr.STUDENT_ID = TxtStudID.Text;
                stuCashDr.STUDENT_ID = TxtStudID.Text;
                stuDataDr.EDU_YEAR   = CoboYear.Text;
                stuCashDr.EDU_YEAR   = CoboYear.Text;
                stuDataDr            = stuService.getStuName(stuDataDr, out msg);
                if (stuDataDr != null)
                {
                    LabStuNameVal.Text = stuDataDr.STUDENT_NAME;
                    showOneCashData(stuCashDr);
                }
            }
            else
            {
                errSeach.Text = "Please Enter Student Id and Choose the Year";
            }
        }