Esempio n. 1
0
        private void otherpurchaseStoredataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            try
            {
                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["Purchase"].Index) //when purchase
                {
                    OtherPurchaseForm aForm = new OtherPurchaseForm();
                    aForm.CategoryId         = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1].Value);
                    aForm.ItemId             = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value);
                    aForm.itemnamelabel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1 + 2].Value).ToString();
                    aForm.unitnameLebel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[2 + 2].Value).ToString();
                    aForm.ShowDialog();
                    LoadGridView();
                }

                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["Return"].Index) //when purchase
                {
                    OtherReturnForm aForm = new OtherReturnForm();
                    aForm.CategoryId         = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1].Value);
                    aForm.ItemId             = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value);
                    aForm.itemnamelabel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1 + 2].Value).ToString();
                    aForm.unitnameLebel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[2 + 2].Value).ToString();
                    aForm.ShowDialog();
                    LoadGridView();
                }

                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["StockOut"].Index) //when stockout
                {
                    OtherDamageOrStockOut aForm = new OtherDamageOrStockOut();
                    aForm.CategoryId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1].Value);
                    aForm.ItemId     = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value);
                    aForm.otheritemnamelabel.Text        = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1 + 2].Value).ToString();
                    aForm.otherunitnameLebel.Text        = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[2 + 2].Value).ToString();
                    aForm.othertransactiontypelebel.Text = "Stock Out";
                    aForm.ShowDialog();
                    LoadGridView();
                }
                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["Damage"].Index) //when damage
                {
                    OtherDamageOrStockOut aForm = new OtherDamageOrStockOut();
                    aForm.CategoryId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1].Value);
                    aForm.ItemId     = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value);
                    aForm.otheritemnamelabel.Text        = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1 + 2].Value).ToString();
                    aForm.otherunitnameLebel.Text        = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[2 + 2].Value).ToString();
                    aForm.othertransactiontypelebel.Text = "Damage";
                    aForm.ShowDialog();
                    LoadGridView();
                }

                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["Delete"].Index) //when delete
                {
                    DialogResult dialogResult = MessageBox.Show("Are you sure want to delete it?", "Alert!", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        StoreDAO aStoreDao = new StoreDAO();
                        string   sr        = aStoreDao.OtherDeleteItem(Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value));
                        MessageBox.Show(sr);
                        LoadGridView();
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        //do something else
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 2
0
        private void otherpurchaseStoredataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            try
            {

                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["Purchase"].Index) //when purchase
                {
                    OtherPurchaseForm aForm = new OtherPurchaseForm();
                    aForm.CategoryId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1].Value);
                    aForm.ItemId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value);
                    aForm.itemnamelabel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1+2].Value).ToString();
                    aForm.unitnameLebel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[2+2].Value).ToString();
                    aForm.ShowDialog();
                    LoadGridView();
                }

                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["Return"].Index) //when purchase
                {
                    OtherReturnForm aForm = new OtherReturnForm();
                    aForm.CategoryId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1].Value);
                    aForm.ItemId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value);
                    aForm.itemnamelabel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1 + 2].Value).ToString();
                    aForm.unitnameLebel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[2 + 2].Value).ToString();
                    aForm.ShowDialog();
                    LoadGridView();
                }

                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["StockOut"].Index) //when stockout
                {
                    OtherDamageOrStockOut aForm = new OtherDamageOrStockOut();
                    aForm.CategoryId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1].Value);
                    aForm.ItemId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value);
                    aForm.otheritemnamelabel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1+2].Value).ToString();
                    aForm.otherunitnameLebel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[2+2].Value).ToString();
                    aForm.othertransactiontypelebel.Text = "Stock Out";
                    aForm.ShowDialog();
                    LoadGridView();
                }
                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["Damage"].Index) //when damage
                {
                   OtherDamageOrStockOut aForm = new OtherDamageOrStockOut();
                   aForm.CategoryId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1].Value);
                    aForm.ItemId = Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value);
                    aForm.otheritemnamelabel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[1+2].Value).ToString();
                    aForm.otherunitnameLebel.Text = (otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[2+2].Value).ToString();
                    aForm.othertransactiontypelebel.Text = "Damage";
                    aForm.ShowDialog();
                    LoadGridView();
                }

                if (e.ColumnIndex == otherpurchaseStoredataGridView.Columns["Delete"].Index) //when delete
                {
                    DialogResult dialogResult = MessageBox.Show("Are you sure want to delete it?", "Alert!", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        StoreDAO aStoreDao = new StoreDAO();
                        string sr = aStoreDao.OtherDeleteItem(Convert.ToInt32("0" + otherpurchaseStoredataGridView.Rows[e.RowIndex].Cells[0].Value));
                        MessageBox.Show(sr);
                        LoadGridView();
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        //do something else
                    }
                }

            }
            catch (Exception)
            {

            }
        }