Esempio n. 1
0
        public void RefreshDataBinding()
        {
            //Lấy tất cả ngày lễ
            listNgayLe = NgayLeBUS.LayTatCaNgayLe_List();

            txtNgayLe.Properties.Items.Clear();
            foreach (NgayLeDTO ngayLe in listNgayLe)
            {
                txtNgayLe.Properties.Items.Add(new MyComboBoxItem(ngayLe.NgayLe.ToString("dd - MM"), ngayLe.MaNgayLe));
            }

            spinThongBaoDatPhong.EditValue = ThamSoBUS.LayKhoangThoiGianChoDatPhong();

            spinHuyDatPhong.EditValue           = ThamSoBUS.LayKhoangThoiGianTuDongHuyDatPhong();
            spinHuyDatPhong.Properties.MaxValue = Convert.ToDecimal(spinThongBaoDatPhong.EditValue);

            txtNgayVao.EditValue      = ThamSoBUS.LayKhoangThoiGianToiThieuGiuaHaiLanThue();
            txtTienTraTruoc.EditValue = ThamSoBUS.QuyDoiDiem(1);

            if (ThamSoBUS.LayChuyenSangChoDonDepSauKhiThanhToan())
            {
                cbChoDonDep.SelectedIndex = 0;
            }
            else
            {
                cbChoDonDep.SelectedIndex = 1;
            }

            ThamSoBUS.GetSoTienLamTron(521234);
        }
Esempio n. 2
0
        private void wbntSuaphong_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e)
        {
            XtraInputBoxArgs args = new XtraInputBoxArgs();

            // set required Input Box options
            args.Caption            = "Thêm ngày lễ";
            args.Prompt             = "Ngày:";
            args.DefaultButtonIndex = 0;
            args.Showing           += Args_Showing;
            // initialize a DateEdit editor with custom settings
            DateEdit editor = new DateEdit();

            editor.Properties.CalendarView  = DevExpress.XtraEditors.Repository.CalendarView.TouchUI;
            editor.Properties.Mask.EditMask = "dd - MM";
            args.Editor = editor;

            switch (e.Button.Properties.Tag.ToString())
            {
            case "Thêm Ngày Lễ":
                args.DefaultResponse = DateTime.Now;
                if (XtraInputBox.Show(args) != null)
                {
                    DateTime dt = new DateTime(2000, editor.DateTime.Month, editor.DateTime.Day);

                    if (NgayLeBUS.KiemTraNgayLeTonTai(dt))
                    {
                        XtraMessageBox.Show("Ngày lễ đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }


                    NgayLeBUS.ThemNgayLe(new DTO.NgayLeDTO(NgayLeBUS.PhatSinhMaNgayLe(), editor.DateTime));
                    XtraMessageBox.Show("Thêm ngày lễ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefeshDataBinding();
                }
                break;

            case "Xóa Ngày Lễ":
                if (XtraMessageBox.Show("Xác nhận xóa ngày lễ '" + ((DateTime)dtNgayLe.Rows[gridView1.GetFocusedDataSourceRowIndex()]["NgayLe"]).ToString("dd - MM") + "'?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    NgayLeBUS.XoaNgayLe((int)dtNgayLe.Rows[gridView1.GetFocusedDataSourceRowIndex()]["MaNgayLe"]);
                    RefeshDataBinding();
                }
                break;

            case "Sửa Ngày Lễ":
                args.DefaultResponse = (DateTime)dtNgayLe.Rows[gridView1.GetFocusedDataSourceRowIndex()]["NgayLe"];
                if (XtraInputBox.Show(args) != null)
                {
                    DateTime dt = new DateTime(2000, editor.DateTime.Month, editor.DateTime.Day);

                    if (NgayLeBUS.KiemTraNgayLeTonTai(dt))
                    {
                        XtraMessageBox.Show("Ngày lễ đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }


                    NgayLeBUS.SuaNgayLe(new DTO.NgayLeDTO((int)dtNgayLe.Rows[gridView1.GetFocusedDataSourceRowIndex()]["MaNgayLe"], editor.DateTime));
                    XtraMessageBox.Show("Sửa ngày lễ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefeshDataBinding();
                }

                break;

            case "Trở Lại":
                actionBack();
                break;
            }
        }
Esempio n. 3
0
 public void RefeshDataBinding()
 {
     gridControl1.DataSource = dtNgayLe = NgayLeBUS.LayTatCaNgayLe_DataTable();
 }