Exemplo n.º 1
0
        public static int Add(FeeTypes feetypes)
        {
            int retvalue = -1;

            try
            {
                db.cmd.CommandType = CommandType.StoredProcedure;
                db.cmd.CommandText = "procFeeTypes_FeeTypes";
                db.cmd.Parameters.AddWithValue("@FeeTypeName", feetypes.FeeTypeName);
                db.cmd.Parameters.Add("@Id", SqlDbType.Int);
                db.cmd.Parameters["@Id"].Direction = ParameterDirection.Output;
                db.con.Open();
                db.cmd.ExecuteNonQuery();
                retvalue = Convert.ToInt32(db.cmd.Parameters["@Id"].Value);
            }

            catch (SqlException sqlex)
            {
                SqlExceptionErrorHandling rh = new SqlExceptionErrorHandling();
                rh.GetError(sqlex);
            }
            finally
            {
                db.CloseDb(db.con, db.cmd);
            }

            return(retvalue);
        }
Exemplo n.º 2
0
        private static List <FeeTypes> _GetListOfFeeTypes()
        {
            List <FeeTypes> FeeTypes = new List <FeeTypes>();

            try
            {
                Command            = @"select * from tblFeeTypes";
                db.cmd.CommandText = Command;
                db.con.Open();

                SqlDataReader rdr = db.cmd.ExecuteReader();
                while (rdr.Read())
                {
                    FeeTypes singleFeeTypes = new FeeTypes();

                    singleFeeTypes.Id          = (int)rdr[0];
                    singleFeeTypes.FeeTypeName = rdr[1].ToString();



                    FeeTypes.Add(singleFeeTypes);
                }
            }
            catch (SqlException sqlex)
            {
                SqlExceptionErrorHandling rh = new SqlExceptionErrorHandling();
                rh.GetError(sqlex);
            }
            finally
            {
                db.con.Close();
            }

            return(FeeTypes);
        }
Exemplo n.º 3
0
        public static int Add(FeeSchedules feeSchedules, FeeTypes feeTypes)
        {
            int retvalue = -1;

            feeSchedules.FeeTypesId = FeeTypes.Add(feeTypes);
            retvalue = FeeSchedules.Add(feeSchedules);

            return(retvalue);
        }
Exemplo n.º 4
0
        private static List <FeeSchedules> _GetListOfFeeSchedules()
        {
            List <FeeSchedules> FeeSchedules = new List <FeeSchedules>();

            try
            {
                Command            = @"select * from tblFeeSchedules fees join tblGrades gds
on fees.Grade_ID=gds.Id join tblFeeTypes fts
on fees.FeeType_ID=fts.Id";
                db.cmd.CommandText = Command;
                db.con.Open();

                SqlDataReader rdr = db.cmd.ExecuteReader();
                while (rdr.Read())
                {
                    FeeSchedules singleFeeSchedules = new FeeSchedules();

                    singleFeeSchedules.Id         = (int)rdr[0];
                    singleFeeSchedules.Fee        = Convert.ToSingle(rdr[1]);
                    singleFeeSchedules.GradesId   = (int)rdr[2];
                    singleFeeSchedules.FeeTypesId = (int)rdr[3];

                    //
                    var grades = new Grades();
                    singleFeeSchedules.Grades = Grades.ListOfGrades.SingleOrDefault(gr => gr.Id == singleFeeSchedules.GradesId);
                    //

                    //singleFeeSchedules.Grades.Id = (int)rdr[4];
                    //singleFeeSchedules.Grades.GradeName = rdr[5].ToString();

                    //
                    var feetype = new FeeTypes();
                    singleFeeSchedules.FeeType = FeeTypes.ListOfFeeTypes.SingleOrDefault(ft => ft.Id == singleFeeSchedules.FeeTypesId);
                    //

                    //singleFeeSchedules.FeeType.Id = (int)rdr[6];
                    //singleFeeSchedules.FeeType.FeeTypeName = rdr[7].ToString();

                    FeeSchedules.Add(singleFeeSchedules);
                }
            }
            catch (SqlException sqlex)
            {
                SqlExceptionErrorHandling rh = new SqlExceptionErrorHandling();
                rh.GetError(sqlex);
            }
            finally
            {
                db.con.Close();
            }

            return(FeeSchedules);
        }
Exemplo n.º 5
0
        public static void Update(int id, FeeTypes feetypes)
        {
            try
            {
                db.cmd.CommandText = "update tblFeeTypes set FeeTypeName = @FeeTypeName where Id=@id";
                db.cmd.Parameters.AddWithValue("@FeeTypename", feetypes.FeeTypeName);
                db.cmd.Parameters.AddWithValue("@id", id);
                db.con.Open();
                db.cmd.ExecuteNonQuery();
            }

            catch (SqlException sqlex)
            {
                SqlExceptionErrorHandling rh = new SqlExceptionErrorHandling();
                rh.GetError(sqlex);
            }
            finally
            {
                db.CloseDb(db.con, db.cmd);
            }
        }
Exemplo n.º 6
0
 public FeeSchedules()
 {
     Grades  = new Grades();
     FeeType = new FeeTypes();
 }