Example #1
0
        void PopulateArray(clsDataConnection DB)
        {
            Int32 Index = 0;
            Int32 RecordCount;

            RecordCount = DB.Count;
            mStockList  = new List <clsStock>();
            while (Index < RecordCount)
            {
                clsStock AStock = new clsStock();
                AStock.BookID          = Convert.ToInt32(DB.DataTable.Rows[Index]["BookID"]);
                AStock.BookName        = Convert.ToString(DB.DataTable.Rows[Index]["BookName"]);
                AStock.NumberAvailable = Convert.ToInt32(DB.DataTable.Rows[Index]["NumberAvailable"]);
                AStock.ReleaseDate     = Convert.ToDateTime(DB.DataTable.Rows[Index]["ReleaseDate"]);
                AStock.InStock         = Convert.ToBoolean(DB.DataTable.Rows[Index]["InStock"]);
                mStockList.Add(AStock);
                Index++;
            }
        }
Example #2
0
        void PopulateArray(clsDataConnection DB)
        {
            Int32 Index       = 0;
            Int32 RecordCount = 0;

            RecordCount = DB.Count;
            mStockList  = new List <clsStock>();
            while (Index < RecordCount)
            {
                clsStock AStock = new clsStock();
                AStock.ProductID          = Convert.ToInt32(DB.DataTable.Rows[Index]["ProductID"]);
                AStock.ProductDescription = Convert.ToString(DB.DataTable.Rows[Index]["ProductDescription"]);
                AStock.StockQuantity      = Convert.ToInt32(DB.DataTable.Rows[Index]["StockQuantity"]);
                AStock.DateListed         = Convert.ToDateTime(DB.DataTable.Rows[Index]["DateListed"]);
                AStock.InStock            = Convert.ToBoolean(DB.DataTable.Rows[Index]["InStock"]);
                AStock.Price = Convert.ToDecimal(DB.DataTable.Rows[Index]["Price"]);
                mStockList.Add(AStock);
                Index++;
            }
        }
Example #3
0
        void PopulateArray(clsDataConnection DB)
        {
            Int32 Index = 0;
            Int32 RecordCount;

            RecordCount = DB.Count;
            mStockList  = new List <clsStock>();
            while (Index < RecordCount)
            {
                clsStock AnStock = new clsStock();
                AnStock.Available          = Convert.ToBoolean(DB.DataTable.Rows[Index]["Available"]);
                AnStock.ClothesNo          = Convert.ToInt32(DB.DataTable.Rows[Index]["ClothesNo"]);
                AnStock.ClothesDescription = Convert.ToString(DB.DataTable.Rows[Index]["ClothesDescription"]);
                AnStock.Price         = Convert.ToInt32(DB.DataTable.Rows[Index]["Price"]);
                AnStock.ClothesColour = Convert.ToString(DB.DataTable.Rows[Index]["ClothesColour"]);
                AnStock.DateAdded     = Convert.ToDateTime(DB.DataTable.Rows[Index]["DateAdded"]);
                mStockList.Add(AnStock);

                Index++;
            }
        }
Example #4
0
        void PopulateArray(clsDataConnection DB)
        {
            Int32 Index = 0;
            Int32 RecordCount;

            RecordCount = DB.Count;
            mStockList  = new List <clsStock>();

            while (Index < RecordCount)
            {
                clsStock AStock = new clsStock();
                AStock.Available   = Convert.ToBoolean(DB.DataTable.Rows[Index]["Available"]);
                AStock.ProductID   = Convert.ToInt32(DB.DataTable.Rows[Index]["ProductID"]);
                AStock.BookName    = Convert.ToString(DB.DataTable.Rows[Index]["BookName"]);
                AStock.AuthorName  = Convert.ToString(DB.DataTable.Rows[Index]["AuthorName"]);
                AStock.Price       = Convert.ToDouble(DB.DataTable.Rows[Index]["Price"]);
                AStock.PublishDate = Convert.ToDateTime(DB.DataTable.Rows[Index]["PublishDate"]);
                mStockList.Add(AStock);
                Index++;
            }
        }
Example #5
0
        //constructor for the class
        public clsStockCollection()
        {
            Int32             Index       = 0;
            Int32             RecordCount = 0;
            clsDataConnection DB          = new clsDataConnection();

            DB.Execute("sproc_tblStock_SelectAll");
            RecordCount = DB.Count;
            while (Index < RecordCount)
            {
                clsStock AStock = new clsStock();
                AStock.BookID          = Convert.ToInt32(DB.DataTable.Rows[Index]["BookID"]);
                AStock.BookName        = Convert.ToString(DB.DataTable.Rows[Index]["BookName"]);
                AStock.NumberAvailable = Convert.ToInt32(DB.DataTable.Rows[Index]["NumberAvailable"]);
                AStock.ReleaseDate     = Convert.ToDateTime(DB.DataTable.Rows[Index]["ReleaseDate"]);
                AStock.InStock         = Convert.ToBoolean(DB.DataTable.Rows[Index]["InStock"]);

                mStockList.Add(AStock);
                Index++;
            }
        }
        void PopulateArray(clsDataConnection DB)
        {
            Int32 Index = 0;
            Int32 RecordCount;

            RecordCount = DB.Count;
            mStockList  = new List <clsStock>();

            while (Index < RecordCount)
            {
                clsStock AnStock = new clsStock();
                AnStock.StockID          = Convert.ToInt32(DB.DataTable.Rows[Index]["StockID"]);
                AnStock.ItemName         = Convert.ToString(DB.DataTable.Rows[Index]["ItemName"]);
                AnStock.StockDescription = Convert.ToString(DB.DataTable.Rows[Index]["StockDescription"]);
                AnStock.StockLevel       = Convert.ToInt32(DB.DataTable.Rows[Index]["StockLevel"]);
                AnStock.StockPrice       = Convert.ToInt32(DB.DataTable.Rows[Index]["StockPrice"]);

                mStockList.Add(AnStock);

                Index++;
            }
        }
Example #7
0
        void PopulateArray(clsDataConnection DB)
        {
            Int32 Index = 0;
            Int32 RecordCount;

            RecordCount = DB.Count;
            mStockList  = new List <clsStock>();
            while (Index < RecordCount)
            {
                clsStock AnStock = new clsStock();

                AnStock.Availability = Convert.ToBoolean(DB.DataTable.Rows[Index]["Availability"]);
                AnStock.gameID       = Convert.ToInt32(DB.DataTable.Rows[Index]["gameID"]);
                AnStock.gameName     = Convert.ToString(DB.DataTable.Rows[Index]["gameName"]);
                AnStock.ReleaseDate  = Convert.ToDateTime(DB.DataTable.Rows[Index]["releaseDate"]);
                AnStock.Price        = Convert.ToDecimal(DB.DataTable.Rows[Index]["Price"]);
                AnStock.AgeRating    = Convert.ToInt32(DB.DataTable.Rows[Index]["ageRating"]);

                mStockList.Add(AnStock);
                Index++;
            }
        }
        void PopulateArray(clsDataConnection DB)
        {
            //ppopulates array based on the data table in parameter DB
            //index
            Int32 Index = 0;
            //store record count
            Int32 RecordCount;

            //get count of records
            RecordCount = DB.Count;
            //clear private array list
            mStockList = new List <clsStock>();
            //while there are records to process
            while (Index < RecordCount)
            {
                //create blank item
                clsStock AnItem = new clsStock();
                //read in fields from current record
                AnItem.ItemId   = Convert.ToInt32(DB.DataTable.Rows[Index]["ItemId"]);
                AnItem.ItemName = Convert.ToString(DB.DataTable.Rows[Index]["ItemName"]);
                AnItem.Price    = Convert.ToDecimal(DB.DataTable.Rows[Index]["Price"]);
                AnItem.Material = Convert.ToString(DB.DataTable.Rows[Index]["Material"]);
                if (AnItem.LastPurchased == null)
                {
                    AnItem.LastPurchased = null;
                }
                else
                {
                    AnItem.LastPurchased = Convert.ToDateTime(DB.DataTable.Rows[Index]["LastPurchased"]);
                }
                AnItem.Quantity = Convert.ToInt32(DB.DataTable.Rows[Index]["Quantity"]);
                AnItem.InStock  = Convert.ToBoolean(DB.DataTable.Rows[Index]["InStock"]);
                //add record to private data member
                mStockList.Add(AnItem);
                //point at next record
                Index++;
            }
        }
Example #9
0
        void PopulateArray(clsDataConnection DB)
        {
            int Index       = 0;
            int RecordCount = 0;

            RecordCount   = DB.Count;
            mProductsList = new List <clsStock>();

            while (Index < RecordCount)
            {
                clsStock AProduct = new clsStock();

                DB.AddParameter("@ProductId", mThisProduct.ProductId);
                DB.AddParameter("@ProductName", mThisProduct.ProductName);
                DB.AddParameter("@ReleaseDate", mThisProduct.ReleaseDate);
                DB.AddParameter("@Price", mThisProduct.Price);
                DB.AddParameter("@InStock", mThisProduct.InStock);
                DB.AddParameter("@ProductDescription", mThisProduct.ProductDescription);

                mProductsList.Add(AProduct);
                Index++;
            }
        }
Example #10
0
        void PopulateArray(clsDataConnection Db)
        {
            Int32 Index = 0;
            Int32 RecordCount;

            mStockList = new List <clsStock>();

            RecordCount = Db.Count;

            while (Index < RecordCount)
            {
                clsStock AnStock = new clsStock();
                AnStock.Name         = Convert.ToString(Db.DataTable.Rows[Index]["Name"]);
                AnStock.Category     = Convert.ToString(Db.DataTable.Rows[Index]["Category"]);
                AnStock.Quantity     = Convert.ToInt32(Db.DataTable.Rows[Index]["Quantity"]);
                AnStock.ProductId    = Convert.ToInt32(Db.DataTable.Rows[Index]["ProductId"]);
                AnStock.NextDelivery = Convert.ToDateTime(Db.DataTable.Rows[Index]["NextDelivery"]);
                AnStock.Sale_Ready   = Convert.ToBoolean(Db.DataTable.Rows[Index]["Sale_Ready"]);

                mStockList.Add(AnStock);
                Index++;
            }
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            //Create a new instance of clsStock
            clsStock SomeStock = new clsStock();

            //Capture the gender
            SomeStock.Gender = txtGender.Text;
            //Capture the size
            SomeStock.Size = txtSize.Text;
            //Capture the description
            SomeStock.Description = txtDescription.Text;
            //Capture the Price
            SomeStock.Price = txtPrice.Text;
            //Capture the stock
            SomeStock.InStock = chkInStock.Text;
            //Capture the date arrived
            SomeStock.DateArrived = Convert.ToDateTime(txtDateArrived.Text);
            //Variable to store any error message
            string Error = "";

            //Validate the data
            Error = SomeStock.Valid(Gender, Size, Description, Price, InStock, DataArrived);
            if (Error == "")
            {
                //capture Active
                SomeStock.Active = chkActive.Checked;
                //Capture gender
                SomeStock.Gender = Gender;
                //capture size
                SomeStock.Size = Size;
                //Capture description
                SomeStock.Description = Description;
                //capture price
                SomeStock.Price = Price;
                //Capture inStock
                SomeStock.InStock = chkInStock.Checked;
                //Capture DateArrived
                SomeStock.DateArrived = Convert.ToDateTime(DateArrived);
                //Create a new instance of the stock collection
                clsStockCollection StockList = new clsStockCollection();

                //if this is a new record i.e. Price = -1 then add the data
                if (Price == -1)
                {
                    //set the ThisStock property
                    StockList.ThisStock = SomeStock;
                    //add the new record
                    StockList.Add();
                }
                //Otherwise it must update
                else
                {
                    //find the record to update
                    StockList.ThisStock.Find(Price);
                    //set the ThisStock property
                    StockList.ThisStock = SomeStock;
                    //update the record
                    StockList.Update();
                }
                //redirect back to the listpage
                Response.Redirect("StockList.aspx");
            }
            else
            {
                //display the error message
                lblError.Text = Error;
            }
            //Some more code that is changed totally

            /*
             * {
             *  //Store the stock in the session object
             *  Session["SomeStock"] = SomeStock;
             *  //redirect to the viewer page
             *  Response.Redirect("StockViewer.aspx");
             * }
             * else
             * {
             *  //display the error message
             *  lblError.Text = Error;
             * }
             */
        }