Exemple #1
0
        //clicking on sc return or item name for descript method
        private void scGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string clickedColName = scGridView.Columns[e.ColumnIndex].Name;

            if (e.RowIndex < 0)
            {
                return;
            }
            else if (clickedColName == "scItemNameCol")
            {
                //build strings for the item details pop up

                ItemDetails ItemDetailsPop = new ItemDetails();
                ItemDetailsPop.itemnametext.Text    = scGridView.Rows[e.RowIndex].Cells["scItemNameCol"].Value.ToString();
                ItemDetailsPop.itemtypetext.Text    = scGridView.Rows[e.RowIndex].Cells["scTypeCol"].Value.ToString();
                ItemDetailsPop.itemraritytext.Text  = scGridView.Rows[e.RowIndex].Cells["scRarityCol"].Value.ToString();
                ItemDetailsPop.itemweighttext.Text  = scGridView.Rows[e.RowIndex].Cells["scWeightCol"].Value.ToString();
                ItemDetailsPop.itempricetext.Text   = scGridView.Rows[e.RowIndex].Cells["scPriceCol"].Value.ToString();
                ItemDetailsPop.itemreftext.Text     = scGridView.Rows[e.RowIndex].Cells["scRefCol"].Value.ToString();
                ItemDetailsPop.itemdescriptext.Text = scGridView.Rows[e.RowIndex].Cells["scDescriptionCol"].Value.ToString();
                ItemDetailsPop.ShowDialog();
            }
            else if (clickedColName == "scReturnCol")
            {
                ReturnItemToStore(e.RowIndex);
            }

            else
            {
                return;
            }
        }
Exemple #2
0
        //clicking on store button or item name for descript method
        private void storeGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            //check if clicking on the proper column for item name, if not, don't do anything
            string clickedColName = storeGridView.Columns[e.ColumnIndex].Name;

            if (clickedColName == "storeItemNameCol")
            {
                ItemDetails ItemDetailsPop = new ItemDetails();
                ItemDetailsPop.itemnametext.Text    = storeGridView.Rows[e.RowIndex].Cells["storeItemNameCol"].Value.ToString();
                ItemDetailsPop.itemtypetext.Text    = storeGridView.Rows[e.RowIndex].Cells["storeTypeCol"].Value.ToString();
                ItemDetailsPop.itemraritytext.Text  = storeGridView.Rows[e.RowIndex].Cells["storeRarityCol"].Value.ToString();
                ItemDetailsPop.itemweighttext.Text  = storeGridView.Rows[e.RowIndex].Cells["storeWeightCol"].Value.ToString();
                ItemDetailsPop.itempricetext.Text   = storeGridView.Rows[e.RowIndex].Cells["storePriceCol"].Value.ToString();
                ItemDetailsPop.itemreftext.Text     = storeGridView.Rows[e.RowIndex].Cells["storeRefCol"].Value.ToString();
                ItemDetailsPop.itemdescriptext.Text = storeGridView.Rows[e.RowIndex].Cells["storeDescriptionCol"].Value.ToString();
                ItemDetailsPop.ShowDialog();
            }
            if (clickedColName == "storeBuyCol")
            {
                int storeItemRowNum = storeGridView.CurrentCell.RowIndex;
                BuyItemFromStore(storeItemRowNum);
            }

            else
            {
                return;
            }
        }