Exemplo n.º 1
0
        private Boolean Insert(Database db)
        {
            BookType booktype = new BookType();

            try
            {
                db.Command.CommandType = CommandType.StoredProcedure;
                db.Command.CommandText = "tblBookTypeINSERT";
                base.Initialize(db.Command, Guid.Empty);
                db.Command.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = _ID;
                db.Command.Parameters.Add("@Type", SqlDbType.VarChar).Value        = _Type;
                db.ExecuteNonQueryWithTransaction();
                base.Initialize(db.Command);
                return(true);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public BookTypeList GetAll()
        {
            _list.Clear();
            Database db = new Database("Books");

            db.Command.CommandType = System.Data.CommandType.StoredProcedure;
            db.Command.CommandText = "tblBookTypeGETALL";
            DataTable dt = db.ExecuteQuery();

            //dgvStudent.DataSource = dt;
            foreach (DataRow dr in dt.Rows)
            {
                BookType s = new BookType();
                s.Initialize(dr);
                s.InitializeBusinessData(dr);
                s.IsDirty       = false;
                s.IsNew         = false;
                s.evtIsSavable += new IsSavableHandler(s_evtIsSavable);
                _list.Add(s);
            }

            return(this);
        }
Exemplo n.º 3
0
        private Boolean Insert(Database db)
        {
            BookType booktype = new BookType();

            try
            {
                db.Command.CommandType = CommandType.StoredProcedure;
                db.Command.CommandText = "tblBookTypeINSERT";
                base.Initialize(db.Command, Guid.Empty);
                db.Command.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = _ID;
                db.Command.Parameters.Add("@Type", SqlDbType.VarChar).Value = _Type;
                db.ExecuteNonQueryWithTransaction();
                base.Initialize(db.Command);
                return true;
            }
            catch (Exception ex)
            {
                throw;
            }
        }