示例#1
0
        private void layoutControlGroup3_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e)
        {
            if (e.Button.Properties.Caption == "Làm mới")
            {
                xpNHAPKHAU.Reload();
                alertControl1.Show(this, "Thông báo", "Đã làm mới");
            }
            if (e.Button.Properties.Caption == "Thêm")
            {
                var fr = new frmNhapKhauInfo(null);
                fr.ShowDialog();
                xpNHAPKHAU.Reload();
            }

            if (e.Button.Properties.Caption == "Sửa")
            {
                var k = gridView1.GetFocusedRow() as NHAPKHAU;
                if (k == null)
                {
                    return;
                }
                else
                {
                    var fr = new frmNhapKhauInfo(k);
                    fr.ShowDialog();
                    xpNHAPKHAU.Reload();
                }
            }
            if (e.Button.Properties.Caption == "Xoá")
            {
                if (XtraMessageBox.Show("Xóa?", "Xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    SplashScreenManager.ShowDefaultWaitForm("Đang xóa", "Vui lòng chờ");
                    gridView1.DeleteSelectedRows();
                    try
                    {
                        unitNHAPKHAU.CommitChanges();
                        alertControl1.Show(this, "Thông báo", "Xóa thành công");
                    }
                    catch (Exception)
                    {
                        alertControl1.Show(this, "Thông báo", "Không thể xóa");
                        return;
                    }
                    SplashScreenManager.CloseDefaultWaitForm();
                }
            }
            xpNHAPKHAU.Reload();
        }
示例#2
0
        private void SuaKB(object sender, EventArgs e)
        {
            var k = gridView1.GetFocusedRow() as NHAPKHAU;

            if (k == null)
            {
                return;
            }
            else
            {
                var fr = new frmNhapKhauInfo(k);
                fr.ShowDialog();
                xpNHAPKHAU.Reload();
            }
        }
示例#3
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            var k = gridView1.GetFocusedRow() as NHAPKHAU;

            if (k == null)
            {
                return;
            }
            else
            {
                GridHitInfo info = gridView1.CalcHitInfo(gridView1.GridControl.PointToClient(System.Windows.Forms.Control.MousePosition));
                if (info.InRow || info.InRowCell)
                {
                    var fr = new frmNhapKhauInfo(k);
                    fr.ShowDialog();
                    xpNHAPKHAU.Reload();
                }
            }
        }