コード例 #1
0
ファイル: SelectionItemCtl.cs プロジェクト: Jusharra/RMS
        private void dgvSelectionItem_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                if (e.ColumnIndex == 7)
                {
                    Int32 itemID = Convert.ToInt32("0" + dgvSelectionItem.Rows[e.RowIndex].Cells[0].Value);

                    UpdateSelectionItemCtl objSelection = new UpdateSelectionItemCtl(itemID);
                    objSelection.Parent = this.ParentForm;
                    UserControlManager.UserControls.Push(this);
                    Panel pnl = (Panel)this.ParentForm.Controls["pnlContext"];

                    string s = pnl.Name;

                    objSelection.ParentForm.Controls[s].Controls.Clear();
                    objSelection.ParentForm.Controls[s].Controls.Add(objSelection);
                }

                else if (e.ColumnIndex == 8)
                {
                    if (MessageBox.Show("Are you sure you want to delete the selected food type?", RMSGlobal.MessageBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int selectItemCatId = 0;

                        bool bTempBool = Int32.TryParse(dgvSelectionItem.Rows[e.RowIndex].Cells[0].Value.ToString(), out selectItemCatId);

                        if (bTempBool)
                        {
                            CCategory4 objSelectItem = new CCategory4();

                            objSelectItem.Category4ID = selectItemCatId;
                            CCategoryManager oManager = new CCategoryManager();

                            CResult oResult = oManager.DeleteCat4(objSelectItem);

                            if (oResult.IsSuccess)
                            {
                                dgvSelectionItem.Rows.RemoveAt(e.RowIndex);
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
コード例 #2
0
ファイル: SelectionItemCtl.cs プロジェクト: Jusharra/RMS
        private void dgvSelectionItem_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                if (e.ColumnIndex == 7)
                {
                    Int32 itemID = Convert.ToInt32("0" + dgvSelectionItem.Rows[e.RowIndex].Cells[0].Value);

                    UpdateSelectionItemCtl objSelection = new UpdateSelectionItemCtl(itemID);
                    objSelection.Parent = this.ParentForm;
                    UserControlManager.UserControls.Push(this);
                    Panel pnl = (Panel)this.ParentForm.Controls["pnlContext"];

                    string s = pnl.Name;

                    objSelection.ParentForm.Controls[s].Controls.Clear();
                    objSelection.ParentForm.Controls[s].Controls.Add(objSelection);
                }

                else if (e.ColumnIndex == 8)
                {
                    if (MessageBox.Show("Are you sure you want to delete the selected food type?", RMSGlobal.MessageBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int selectItemCatId = 0;

                        bool bTempBool = Int32.TryParse(dgvSelectionItem.Rows[e.RowIndex].Cells[0].Value.ToString(), out selectItemCatId);

                        if (bTempBool)
                        {
                            CCategory4 objSelectItem = new CCategory4();

                            objSelectItem.Category4ID = selectItemCatId;
                            CCategoryManager oManager = new CCategoryManager();

                            CResult oResult = oManager.DeleteCat4(objSelectItem);

                            if (oResult.IsSuccess)
                            {
                                dgvSelectionItem.Rows.RemoveAt(e.RowIndex);
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }