コード例 #1
0
ファイル: mainForm.cs プロジェクト: Szafiarka/szafiarka
        private void delete_Click(object sender, EventArgs e)
        {
            PanelStart panel = Panels.getPanelByName(Panels.PanelsName.PSTART) as PanelStart;
            var        row   = panel.getGridViewItemRow();

            if (panel.Visible == true && panel.getGridViewName() == DataGridViewNew.DGVMainDataNames.items.ToString() &&
                row != null)
            {
                string messageBoxText = String.Format("Czy na pewno chcesz usunąć {0}?",
                                                      row.Cells["name"].Value.ToString());
                string            caption = "Usuwanie";
                MessageBoxButtons button  = MessageBoxButtons.YesNo;
                DialogResult      res     = MessageBox.Show(messageBoxText, caption, button);
                if (res == DialogResult.Yes)
                {
                    var itemId = Int32.Parse(row.Cells[0].Value.ToString());
                    queries.changeItemDeletedById(itemId, true);
                    Panels.refreshPanelStartGrid();
                }
            }
            else
            {
                MessageBox.Show(Utils.GetEnumDescription(Messages.warnings.DELETE), "Warrning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #2
0
ファイル: mainForm.cs プロジェクト: Szafiarka/szafiarka
        private void edit_Click(object sender, EventArgs e)
        {
            PanelStart panel = Panels.getPanelByName(Panels.PanelsName.PSTART) as PanelStart;
            var        row   = panel.getGridViewItemRow();

            if (panel.Visible == true && panel.getGridViewName() == DataGridViewNew.DGVMainDataNames.items.ToString() &&
                row != null)
            {
                var itemId = Int32.Parse(row.Cells[0].Value.ToString());
                var form   = new ItemForm(itemId);
                form.Show();
            }
            else
            {
                MessageBox.Show(Utils.GetEnumDescription(Messages.warnings.EDIT), "Warrning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }