Ejemplo n.º 1
0
        public bool add_StudentData()
        {
            //Creating variable and objects
            bool status = false;
            SqlConnection sqlConn = null;
            SqlTransaction sqlTrn = null;
            dbConnection dbConn = null;
            studentDB stDB = null;

            try
            {
                //Inizing objects
                stDB = new studentDB();
                dbConn = new dbConnection();
                sqlConn = new SqlConnection();

                //Inizing Sql Connection
                sqlConn = dbConn.getConnection();

                //Connection Open
                sqlConn.Open();

                //Transaction Beging
                sqlTrn = sqlConn.BeginTransaction();

                //Assing the return valeu
                status = stDB.add_StudentData(sqlConn, sqlTrn);

            }
            catch (SqlException ex)
            {
                //throw exception to next layer
                throw ex;
            }
            finally
            {
                //disposing creating objects
                if (sqlConn != null)
                {
                    sqlConn.Close();
                }
                sqlTrn.Dispose();
            }
            //returning tha value
            return status;
        }
Ejemplo n.º 2
0
        public int getTemCount()
        {
            //Creating variable and objects
            int data_Count = 0;
            SqlConnection sqlConn = null;
            SqlTransaction sqlTrn = null;
            dbConnection dbConn = null;
            studentDB stDB = null;

            try
            {
                //Inizing objects
                stDB = new studentDB();
                dbConn = new dbConnection();
                sqlConn = new SqlConnection();

                //Inizing Sql Connection
                sqlConn = dbConn.getConnection();

                //Connection Open
                sqlConn.Open();
                //Transaction Beging
                sqlTrn = sqlConn.BeginTransaction();

                //Assing the return valeu
                data_Count = stDB.getTemCount(sqlConn, sqlTrn);

            }
            catch (SqlException ex)
            {
                //throw exception to next layer
                throw ex;
            }
            finally
            {
                //disposing creating objects
                if (sqlConn != null)
                {
                    sqlConn.Close();
                }
                sqlTrn.Dispose();
            }
            //returning the count
            return data_Count;
        }
Ejemplo n.º 3
0
        public int getLastStID()
        {
            //Creating variable and objects
            int stId = 0;
            SqlConnection sqlConn = null;
            SqlTransaction sqlTrn = null;
            dbConnection dbConn = null;
            studentDB stDB = null;

            try
            {
                //Inizing objects
                stDB = new studentDB ();
                dbConn = new dbConnection();
                sqlConn = new SqlConnection();

                //Inizing Sql Connection
                sqlConn = dbConn.getConnection();

                //Connection Open
                sqlConn.Open();
                //Transaction Beging
                sqlTrn = sqlConn.BeginTransaction();

                stId = stDB.getLastStID(sqlConn, sqlTrn);

            }
            catch (SqlException ex)
            {
                //throw exception to next layer
                throw ex;
            }
            finally
            {
                //disposing creating objects
                if (sqlConn != null)
                {
                    sqlConn.Close();
                }
                sqlTrn.Dispose();
            }
            //returning tha value
            return stId;
        }
Ejemplo n.º 4
0
        public DataSet getAllTepDataDorDataGride()
        {
            //Creating variable and objects
            DataSet ds = null;
            SqlConnection sqlConn = null;
            SqlTransaction sqlTrn = null;
            dbConnection dbConn = null;
            studentDB stDB = null;

            try
            {
                //Inizing objects
                stDB = new studentDB();
                dbConn = new dbConnection();
                sqlConn = new SqlConnection();
                ds = new DataSet();

                //Inizing Sql Connection
                sqlConn = dbConn.getConnection();

                //Connection Open
                sqlConn.Open();
                //Transaction Beging

                sqlTrn = sqlConn.BeginTransaction();

                //Assing the return valeu
                ds = stDB.getAllTepDataDorDataGride(sqlConn, sqlTrn);

            }
            catch (SqlException ex)
            {
                //throw exception to next layer
                throw ex;
            }
            finally
            {
                //disposing creating objects
                if (sqlConn != null)
                {
                    sqlConn.Close();
                }
                sqlTrn.Dispose();
            }
            //returning tha dataset
            return ds;
        }