示例#1
0
        void Button_Click(object sender, EventArgs e)
        {
            ABCSimpleButton button = sender as ABCSimpleButton;

            if (button.ButtonType == ABCSimpleButton.ABCButtonType.Save)
            {
                if (String.IsNullOrWhiteSpace(button.DataSource) == false && this.Screen.DataManager.DataObjectsList.ContainsKey(button.DataSource))
                {
                    DialogResult result = ABCHelper.ABCMessageBox.Show("Bạn có muốn lưu dữ liệu vào hệ thống ?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (result == DialogResult.Yes)
                    {
                        this.Screen.DataManager.DataObjectsList[button.DataSource].Save(true, true);
                        this.Screen.DataManager.DataObjectsList[button.DataSource].Refresh();
                    }
                }
            }
            else if (button.ButtonType == ABCSimpleButton.ABCButtonType.Delete)
            {
                if (String.IsNullOrWhiteSpace(button.DataSource) == false && this.Screen.DataManager.DataObjectsList.ContainsKey(button.DataSource))
                {
                    DialogResult result = ABCHelper.ABCMessageBox.Show("Bạn có thực sự muốn xóa dữ liệu ?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (result == DialogResult.Yes)
                    {
                        this.Screen.DataManager.DataObjectsList[button.DataSource].Delete();
                        this.Screen.DataManager.DataObjectsList[button.DataSource].Refresh();
                    }
                }
            }

            else if (button.ButtonType == ABCSimpleButton.ABCButtonType.Cancel)
            {
                this.Screen.UIManager.View.FindForm().Close();
            }
        }
        void OnScreenLoadedEvent( )
        {
            ABCSimpleButton btnRecalcInventory = this.UIManager["btnRecalcInventory"] as ABCSimpleButton;

            if (btnRecalcInventory != null)
            {
                btnRecalcInventory.Click += new EventHandler(btnRecalcInventory_Click);
            }
        }