Esempio n. 1
0
 private void _btnAdd_Click(object sender, EventArgs e)
 {
     using (var dlg = new AddProductForm())
     {
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             Query();
         }
     }
 }
Esempio n. 2
0
        private void _riOperation_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Index == 0)
            {
                MdiService.JumpTo <ProduceDetailView>();
            }
            else if (e.Button.Index == 1)
            {
                var product = GetFocusedProduct();
                if (product == null)
                {
                    MessageBoxHelper.Warn("没有找到产品。");
                    return;
                }

                using (var dlg = new AddProductForm(product.Id))
                {
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        Query();
                    }
                }
            }
            else if (e.Button.Index == 2)
            {
                var product = GetFocusedProduct();
                if (product == null)
                {
                    MessageBoxHelper.Warn("没有找到产品。");
                    return;
                }

                if (MessageBoxHelper.Question(string.Format("您确定要删除产品“{0}”吗?", product.GetDisplayText())))
                {
                    _service.DeleteProduct(product.Id);
                }
            }
        }