示例#1
0
        private void tsmiDeleteProduct_Click(object sender, EventArgs e)
        {
            if ((this.lbxProducts.SelectedItem != null) &&
                 !System.Convert.IsDBNull(this.lbxProducts.SelectedValue))
            {
                System.Data.DataRow product = this.products.Rows[this.lbxProducts.SelectedIndex];
                DeleteProductForm frm = new DeleteProductForm(this.cConnection, product);
                DialogResult dr = frm.ShowDialog();
                if ( dr == DialogResult.OK)
                {
                    MessageBox.Show("������� ������� �����!", "����������", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (dr == DialogResult.Ignore)
                {
                    MessageBox.Show("������� ������� �����!", "����������", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (dr == DialogResult.Cancel)
                {
                    MessageBox.Show("�������� �������� �������������", "����������", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (dr == DialogResult.Abort)
                {
                    MessageBox.Show("�������� �������� ��-�� ������", "������", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }
            }
        }
示例#2
0
 private void tsmiDeleteProduct_Click(object sender, EventArgs e)
 {
     if ((this.lbxProducts.SelectedItem != null) &&
          !System.Convert.IsDBNull(this.lbxProducts.SelectedValue))
     {
         System.Data.DataRow product = this.products.Rows[this.lbxProducts.SelectedIndex];
         DeleteProductForm frm = new DeleteProductForm(this.cConnection, product);
         DialogResult dr = frm.ShowDialog();
         string message = "";
         string caption = "";
         MessageBoxIcon ico = MessageBoxIcon.Information;
         if ( dr == DialogResult.OK)
         {
             message = this.manager.GetString("Product.Deleted");
             caption = this.manager.GetString("Product.Information");
             ico = MessageBoxIcon.Information;
         }
         else if (dr == DialogResult.Ignore)
         {
             message = this.manager.GetString("Product.Deleted");
             caption = this.manager.GetString("Product.Information");
             ico = MessageBoxIcon.Information;
         }
         else if (dr == DialogResult.Cancel)
         {
             message = this.manager.GetString("Product.Canceled");
             caption = this.manager.GetString("Product.Information");
             ico = MessageBoxIcon.Information;
         }
         else if (dr == DialogResult.Abort)
         {
             message = this.manager.GetString("Product.DeletionError");
             caption = this.manager.GetString("Product.Error");
             ico = MessageBoxIcon.Error;
         }
         MessageBox.Show(message, caption, MessageBoxButtons.OK, ico);
     }
 }