示例#1
0
        public bool GetOldAssessmentProfile(string student_number)
        {
            bool hasrecord = false;

            if (DBCon.State == ConnectionState.Open)
            {
                dbClose();
            }

            dbOpen();
            MySqlCommand cmd = new MySqlCommand();

            cmd.Connection  = DBCon;
            cmd.CommandText = "get_assessment_old";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@sn", student_number);
            MySqlDataReader dbReader = cmd.ExecuteReader();

            if (dbReader.HasRows)
            {
                while (dbReader.Read())
                {
                    Fee f;

                    if (dbReader["feetypename"].ToString().Equals(FeeTypes.Tuition.ToString()))
                    {
                        f    = new TuitionFee();
                        f.Id = Convert.ToInt32(dbReader["idfee"]);
                    }
                    else if (dbReader["feetypename"].ToString().Equals(FeeTypes.Laboratory.ToString()))
                    {
                        f    = new LaboratoryFee();
                        f.Id = Convert.ToInt32(dbReader["idfee"]);
                    }
                    else if (dbReader["feetypename"].ToString().Equals(FeeTypes.Miscellaneous.ToString()))
                    {
                        f    = new NormalFee();
                        f.Id = Convert.ToInt32(dbReader["idfee"]);
                    }
                    else
                    {
                        f    = new OtherFee();
                        f.Id = Convert.ToInt32(dbReader["idfee"]);
                    }

                    FeeBreakdown.Add(f);
                    hasrecord = true;
                }
            }

            dbClose();
            return(hasrecord);
        }
示例#2
0
        public DataTable GetFeeGroup(int feegroupid)
        {
            if (DBCon.State == ConnectionState.Open)
            {
                dbClose();
            }

            dbOpen();
            MySqlCommand cmd = new MySqlCommand();

            cmd.Connection  = DBCon;
            cmd.CommandText = "get_fee_group_by_id";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@id", feegroupid);
            MySqlDataReader dbReader = cmd.ExecuteReader();
            DataTable       table    = new DataTable();

            table.Load(dbReader);

            foreach (DataRow row in table.Rows)
            {
                Id          = Convert.ToInt32(row["idgroup"]);
                FeesName    = row["groupname"].ToString();
                Description = row["description"].ToString();

                Fee f;
                if (row["feetypename"].ToString().Equals(FeeTypes.Miscellaneous.ToString()))
                {
                    f = new NormalFee(row["feename"].ToString(), Convert.ToDouble(row["amount"].ToString()));
                }
                else if (row["feetypename"].ToString().Equals(FeeTypes.Laboratory.ToString()))
                {
                    f = new LaboratoryFee(row["feename"].ToString(), Convert.ToDouble(row["amount"].ToString()));
                }
                else if (row["feetypename"].ToString().Equals(FeeTypes.Tuition.ToString()))
                {
                    f = new TuitionFee(row["feename"].ToString(), Convert.ToDouble(row["amount"].ToString()));
                }
                else
                {
                    f = new OtherFee(row["feename"].ToString(), Convert.ToDouble(row["amount"].ToString()));
                }

                f.Id = Convert.ToInt32(row["idfee"].ToString());
                Fees.Add(f);
            }

            dbClose();
            return(table);
        }
示例#3
0
        public bool GetAssessment(string student_number, int assessid)
        {
            bool hasrecord = false;

            if (DBCon.State == ConnectionState.Open)
            {
                dbClose();
            }

            dbOpen();
            MySqlCommand cmd = new MySqlCommand();

            cmd.Connection  = DBCon;
            cmd.CommandText = "get_assessment_2";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@sn", student_number);
            cmd.Parameters.AddWithValue("@assessid", assessid);
            MySqlDataReader dbReader = cmd.ExecuteReader();

            if (dbReader.HasRows)
            {
                while (dbReader.Read())
                {
                    Fee f;
                    StudentNumber = dbReader["student_number"].ToString();
                    Semester      = dbReader["semester"].ToString();
                    SY            = dbReader["school_year"].ToString();
                    Units         = Convert.ToInt16(dbReader["numberofunits"]);
                    SciLab        = Convert.ToInt16(dbReader["numberofregularlab"]);
                    ComLab        = Convert.ToInt16(dbReader["numberofcomputerlab"]);
                    Total         = Convert.ToDouble(dbReader["total"]);
                    this.Balance  = Convert.ToDouble(dbReader["balance"]);

                    if (dbReader["feetypename"].ToString().Equals(FeeTypes.Tuition.ToString()))
                    {
                        f      = new TuitionFee(dbReader["feename"].ToString(), Convert.ToDouble(dbReader["amount"]));
                        f.Type = new FeeType().GetFeeTypeByName(FeeTypes.Tuition.ToString());
                    }
                    else if (dbReader["feetypename"].ToString().Equals(FeeTypes.Laboratory.ToString()))
                    {
                        f      = new LaboratoryFee(dbReader["feename"].ToString(), Convert.ToDouble(dbReader["amount"]));
                        f.Type = new FeeType().GetFeeTypeByName(FeeTypes.Laboratory.ToString());
                    }
                    else if (dbReader["feetypename"].ToString().Equals(FeeTypes.Miscellaneous.ToString()))
                    {
                        f      = new NormalFee(dbReader["feename"].ToString(), Convert.ToDouble(dbReader["amount"]));
                        f.Type = new FeeType().GetFeeTypeByName(FeeTypes.Miscellaneous.ToString());
                    }
                    else
                    {
                        f      = new OtherFee(dbReader["feename"].ToString(), Convert.ToDouble(dbReader["amount"]));
                        f.Type = new FeeType().GetFeeTypeByName(FeeTypes.Other.ToString());
                    }
                    f.Id   = Convert.ToInt32(dbReader["idfee"]);
                    f.Paid = Convert.ToDouble(dbReader["amount_paid"]);
                    FeeBreakdown.Add(f);
                }
                hasrecord = true;
            }

            dbClose();
            return(hasrecord);
        }