Beispiel #1
0
        protected override void onSaving()
        {
            try
            {
                DataTable table = this.DataTable.GetChanges();

                if (table != null)
                {
                    UserPrivilegeTableAdapter userPrivilegeTableAdapter = (UserPrivilegeTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterUserPrivilege);
                    AuthenService             authenService             = new AuthenService();

                    foreach (DataRow row in table.Rows)
                    {
                        UserRow userRow = (UserRow)row;
                        authenService.UpdateUserPrivileges(userPrivilegeTableAdapter, userRow.UserId, (List <int>)userRow.UserPrivileges);
                    }

                    this.DataAdapter.Update(table);
                    this.DataTable.Merge(table);
                }

                this.DataTable.AcceptChanges();
            }
            catch (Exception ex)
            {
                this.onSavingError(ex);
            }

            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.SavedCaption);
        }
Beispiel #2
0
        private void btnXemBaoCao_Click(object sender, EventArgs e)
        {
            if (this.dateTuNgay.DateTime == null || this.dateDenNgay.DateTime == null)
            {
                MessageBox.Show("Xin vui lòng chọn ngày", "Chọn ngày", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            RptBaoCaoHoatDongTaiChinh rpt = new RptBaoCaoHoatDongTaiChinh();

            rpt.TuNgay.Value  = this.dateTuNgay.DateTime;
            rpt.DenNgay.Value = this.dateDenNgay.DateTime;

            List <int> phanLoaiChiIds = new List <int>();

            int[] selectedRowHandlers = this.gvMain.GetSelectedRows();

            if (ArrayUtil.IsEmpty(selectedRowHandlers))
            {
                MessageBox.Show("Xin vui lòng chọn Mã loại chi", "Chọn Mã loại chi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            foreach (int rowHandler in selectedRowHandlers)
            {
                int phanLoaiChiId = (int)this.gvMain.GetRowCellValue(rowHandler, "PhanLoaiChiId");
                phanLoaiChiIds.Add(phanLoaiChiId);
            }

            rpt.PhanLoaiChiIds.Value = StringUtil.Join(phanLoaiChiIds, ",");

            FormMainFacade.ShowReport(rpt);
        }
Beispiel #3
0
        protected override void onDeleting()
        {
            if (this.GridViewMain.FocusedRowHandle < 0)
            {
                return;
            }

            var confirmResult = System.Windows.Forms.MessageBox.Show(String.Format("Bạn có chắc muốn xóa {0} được chọn không?", this.DanhMuc), String.Format("Xóa {0}", this.DanhMuc),
                                                                     MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (confirmResult == DialogResult.Yes)
            {
                int      phieuChiId    = (int)this.GridViewMain.GetFocusedRowCellValue("PhieuChiId");
                string   maPhieu       = (string)this.GridViewMain.GetFocusedRowCellValue("MaPhieu");
                int      phanLoaiChiId = (int)this.GridViewMain.GetFocusedRowCellValue("PhanLoaiChiId");
                DateTime ngay          = (DateTime)this.GridViewMain.GetFocusedRowCellValue("Ngay");
                long     soTien        = (long)this.GridViewMain.GetFocusedRowCellValue("SoTien");
                double   soLuong       = (double)this.GridViewMain.GetFocusedRowCellValue("SoLuong");
                double   donGia        = (double)this.GridViewMain.GetFocusedRowCellValue("DonGia");
                DateTime createdDate   = (DateTime)this.GridViewMain.GetFocusedRowCellValue("CreatedDate");

                this.phieuChiTableAdapter.Delete(phieuChiId, maPhieu, soTien, phanLoaiChiId, soLuong, donGia, ngay, createdDate);
                this.loadPhieuChi();
                FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.DeletedCaption);
            }
        }
Beispiel #4
0
        private void btnIn_Click(object sender, EventArgs e)
        {
            RptThongTinHocSinh rpt = new RptThongTinHocSinh();

            this.fillReportHocSinh(rpt);
            FormMainFacade.ShowReport(rpt);
        }
        private void btnXemBaoCao_Click(object sender, EventArgs e)
        {
            if (this.dateTuNgay.DateTime == null || this.dateDenNgay.DateTime == null)
            {
                MessageBox.Show("Xin vui lòng chọn ngày", "Chọn ngày", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            SoThuTienService          soThuTienService = new SoThuTienService();
            RptBangKeTongHopThuTienHS rpt = new RptBangKeTongHopThuTienHS();
            DateTime fromDate             = DateTimeUtil.StartOfDate(dateTuNgay.DateTime);
            DateTime toDate = DateTimeUtil.EndOfDate(dateDenNgay.DateTime);

            rpt.FromDate.Value = fromDate;
            rpt.ToDate.Value   = toDate;

            List <BangKeThuTienItem> allBangKeThuTienItems       = soThuTienService.GetBangKeTongHopThuTien(toDate, (int?)cmLop.EditValue);
            List <BangKeThuTienItem> displayedBangKeThuTienItems = new List <BangKeThuTienItem>();
            int stt = 1;

            foreach (BangKeThuTienItem item in allBangKeThuTienItems)
            {
                if (item.NgayNop >= fromDate && item.NgayNop <= toDate)
                {
                    item.STT = stt++;
                    displayedBangKeThuTienItems.Add(item);
                }
            }

            rpt.viewBangThuTienRowbindingSource.DataSource = displayedBangKeThuTienItems;
            FormMainFacade.ShowReport(rpt);
        }
Beispiel #6
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (this.onSavePhieuThu())
     {
         this.Close();
         FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedPhieuThuCaption);
     }
 }
Beispiel #7
0
 private void btnLuuTao_Click(object sender, EventArgs e)
 {
     if (this.onSavePhieuThu())
     {
         this.resetForm();
         FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedAndAddingPhieuThuCaption);
         this.IsEditing = false;
     }
 }
Beispiel #8
0
 private void btnPrintGiayBaoNopTien_Click(object sender, EventArgs e)
 {
     if (this.isValidNgayTinhAndLop() && !this.isDataTableEmpty())
     {
         RptGiayBaoNopTien rpt = new RptGiayBaoNopTien();
         this.fillRptGiayBaoNopTien(rpt);
         FormMainFacade.ShowReport(rpt);
     }
 }
Beispiel #9
0
 private void btnPrint2_Click(object sender, EventArgs e)
 {
     if (this.isValidNgayTinhAndLop() && !this.isDataTableEmpty())
     {
         RptSoThuTienTrang2 rpt = new RptSoThuTienTrang2();
         this.fillRptSoThuTienTrang2(rpt);
         FormMainFacade.ShowReport(rpt);
     }
 }
Beispiel #10
0
        protected override void onAdding()
        {
            FrmTaoPhieuChi frm = (FrmTaoPhieuChi)FormMainFacade.GetForm(AppForms.FormTaoPhieuChi);

            frm.GridView  = this.GridViewMain;
            frm.IsEditing = false;

            FormMainFacade.ShowDialog(AppForms.FormTaoPhieuChi);
            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedCaption);
        }
Beispiel #11
0
        protected virtual void onAdding()
        {
            BindingSource bindingSource = this.GridViewMain.GridControl.DataSource as BindingSource;

            bindingSource.AddNew();
            this.GridViewMain.GridControl.DataSource = GridControl.NewItemRowHandle;
            this.GridViewMain.ShowEditForm();

            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedCaption);
        }
Beispiel #12
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (!this.dxValidationProvider.Validate())
            {
                return;
            }

            this.btnLuuTao_Click(sender, e);
            this.Close();
            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedPhieuChiCaption);
        }
Beispiel #13
0
        private void btnLuuTao_Click(object sender, EventArgs e)
        {
            if (!this.dxValidationProvider.Validate())
            {
                return;
            }

            this.luuPhieuChi();
            this.resetForm();
            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedAndAddingPhieuChiCaption);
        }
Beispiel #14
0
        protected override void onEditing()
        {
            FrmTaoPhieuChi frm = (FrmTaoPhieuChi)FormMainFacade.GetForm(AppForms.FormTaoPhieuChi);

            frm.GridView  = this.GridViewMain;
            frm.IsEditing = true;
            DataRowView rowView = this.phieuChiRowBindingSource.Current as DataRowView;

            frm.PhieuChiRow = rowView.Row as QLMamNon.Dao.QLMamNonDs.PhieuChiRow;

            FormMainFacade.ShowDialog(AppForms.FormTaoPhieuChi);
            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
        }
Beispiel #15
0
        private static void showCurrentForm()
        {
            String       form     = (String)StaticDataFacade.Get(StaticDataKeys.CurrentForm);
            FormShowType showType = (FormShowType)StaticDataFacade.Get(StaticDataKeys.CurrentFormShowType);

            if (FormShowType.Normal == showType)
            {
                FormMainFacade.ShowForm(form);
            }
            else
            {
                FormMainFacade.ShowDialog(form);
            }
        }
Beispiel #16
0
        protected virtual void onCanceling()
        {
            DataTable changedTable = this.DataTable.GetChanges();

            if (changedTable != null)
            {
                this.DataTable.RejectChanges();
                this.DataTable.AcceptChanges();
            }

            fillRelativeMainDataTable();

            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.CanceledCaption);
        }
        private void btnXemBaoCao_Click(object sender, EventArgs e)
        {
            if (this.dateTuNgay.DateTime == null || this.dateDenNgay.DateTime == null)
            {
                MessageBox.Show("Xin vui lòng chọn ngày", "Chọn ngày", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            RptBaoCaoChiTietHoatDongTaiChinh rpt = new RptBaoCaoChiTietHoatDongTaiChinh();

            rpt.TuNgay.Value  = this.dateTuNgay.DateTime;
            rpt.DenNgay.Value = this.dateDenNgay.DateTime;

            FormMainFacade.ShowReport(rpt);
        }
Beispiel #18
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            IChannelManager formChannelManager = new FormChannelManager();

            formChannelManager.InitSubscribers(this);

            IFormWorkFlow formWorkFlow = new FrmMainFlow();

            formWorkFlow.InitWorkFlow(this);

            FormMainFacade.InitFormMain(this);

            this.initStaticData();
            this.ribbon.Minimized = true;
        }
Beispiel #19
0
        protected virtual void onDeleting()
        {
            if (this.GridViewMain.FocusedRowHandle < 0)
            {
                return;
            }

            var confirmResult = MessageBox.Show(String.Format("Bạn có chắc muốn xóa {0} được chọn không?", this.DanhMuc), String.Format("Xóa {0}", this.DanhMuc),
                                                MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (confirmResult == DialogResult.Yes)
            {
                this.GridViewMain.DeleteSelectedRows();
                FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.DeletedCaption);
            }
        }
Beispiel #20
0
        protected override void onSaving()
        {
            if (ControlUtil.IsEditValueNull(this.cmbLopHocDen))
            {
                MessageBox.Show("Xin vui long chọn Lớp học", "Chọn lớp học", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            List <int> hocSinhIds = new List <int>();
            int        lop        = (int)cmbLopHocDen.EditValue;

            QLMamNon.Dao.QLMamNonDs.HocSinhDataTable hocSinhTable = this.hocSinhTableAdapter.GetHocSinhByParams(DateTime.Now, null, lop, null);

            foreach (DataRowView rowView in hocSinhRowBindingSourceDen)
            {
                HocSinhRow hocSinhRow = rowView.Row as QLMamNon.Dao.QLMamNonDs.HocSinhRow;
                int        hocSinh    = hocSinhRow.HocSinhId;
                hocSinhIds.Add(hocSinh);

                if (hocSinhRow.RowState == DataRowState.Modified || hocSinhRow.RowState == DataRowState.Added)
                {
                    this.hocSinhTableAdapter.InsertHocSinhToLop(hocSinh, lop, hocSinhRow.NgayVaoLop);
                }
            }

            ((QLMamNon.Dao.QLMamNonDs.HocSinhDataTable) this.hocSinhRowBindingSourceDen.DataSource).AcceptChanges();

            List <int> deletingHocSinhIds = new List <int>();

            foreach (QLMamNon.Dao.QLMamNonDs.HocSinhRow hsRow in hocSinhTable)
            {
                if (!hocSinhIds.Contains(hsRow.HocSinhId))
                {
                    deletingHocSinhIds.Add(hsRow.HocSinhId);
                }
            }

            if (!ListUtil.IsEmpty(deletingHocSinhIds))
            {
                this.hocSinhLopTableAdapter.DeleteHocSinhLopByHocSinhIds(StringUtil.Join(deletingHocSinhIds, ","), DateTime.Now.AddDays(-1));

                SoThuTienService soThuTienService = new SoThuTienService();
                soThuTienService.DeleteBangThuTienByHocSinhIdsAndDate(deletingHocSinhIds, DateTimeUtil.DateEndOfMonth(DateTime.Now));
            }

            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.SavedCaption);
        }
Beispiel #21
0
        protected virtual void onSaving()
        {
            try
            {
                DataTable table = this.DataTable.GetChanges();

                if (table != null)
                {
                    this.DataAdapter.Update(table);
                    this.DataTable.Merge(table);
                }

                this.DataTable.AcceptChanges();
            }
            catch (Exception ex)
            {
                this.onSavingError(ex);
            }

            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.SavedCaption);
        }
Beispiel #22
0
 protected virtual void onEditing()
 {
     this.GridViewMain.ShowPopupEditForm();
     FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
 }
Beispiel #23
0
 protected void GridViewMain_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
 {
     FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
 }
Beispiel #24
0
 protected void GridViewMain_RowDeleting(object sender, DevExpress.Data.RowDeletingEventArgs e)
 {
     FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
 }
Beispiel #25
0
 protected void GridViewMain_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
 }
Beispiel #26
0
 private void bbiTruongHoc_ItemClick(object sender, ItemClickEventArgs e)
 {
     FormMainFacade.ShowForm(AppForms.FormDanhMucTruongHoc);
 }
Beispiel #27
0
 protected void Form_FormClosed(object sender, FormClosedEventArgs e)
 {
     FormMainFacade.CloseForm(FormKey);
 }
Beispiel #28
0
        private void btnXemBaoCao_Click(object sender, EventArgs e)
        {
            if (ControlUtil.IsEditValueNull(this.cmbYear))
            {
                MessageBox.Show("Xin vui lòng chọn năm", "Chọn năm", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            RptSoTheoDoiTaiSan rpt = new RptSoTheoDoiTaiSan();

            QLMamNon.Dao.QLMamNonDs.ViewBanGiaoTaiSanDataTable table = this.viewBanGiaoTaiSanTableAdapter.GetDataByYear((int)cmbYear.EditValue);
            List <SoTheoDoiTaiSanItem> soTheoDoiTaiSan         = new List <SoTheoDoiTaiSanItem>();
            SoTheoDoiTaiSanItem        prevSoTheoDoiTaiSanItem = null;
            SoTheoDoiTaiSanItem        soTheoDoiTaiSanItem     = null;

            foreach (QLMamNon.Dao.QLMamNonDs.ViewBanGiaoTaiSanRow row in table)
            {
                row.LopName = StaticDataUtil.GetLopNameByLopId(row.LopId);

                if (prevSoTheoDoiTaiSanItem != null && prevSoTheoDoiTaiSanItem.TaiSanId == row.TaiSanId)
                {
                    soTheoDoiTaiSanItem = new SoTheoDoiTaiSanItem()
                    {
                        TaiSanId        = row.TaiSanId,
                        GhiChu          = CommonConstant.EMPTY,
                        LyDoGiam        = "Bàn giao",
                        NgayChungTuGiam = row.NgayChungTu,
                        SoChungTuGiam   = row.SoChungTu,
                        SoLuongBanGiao  = row.SoLuongBanGiao,
                        SoTienBanGiao   = row.DonGia * row.SoLuongBanGiao,
                    };
                }
                else
                {
                    soTheoDoiTaiSanItem = new SoTheoDoiTaiSanItem()
                    {
                        TaiSanId        = row.TaiSanId,
                        Ten             = row.Ten,
                        DonGia          = row.DonGia,
                        DonViTinh       = row.DonViTinh,
                        GhiChu          = CommonConstant.EMPTY,
                        LyDoGiam        = "Bàn giao",
                        NgayChungTu     = row.NgayChungTu,
                        NgayChungTuGiam = row.NgayChungTu,
                        SoChungTu       = row.SoChungTu,
                        SoChungTuGiam   = row.SoChungTu,
                        SoLuong         = row.SoLuong,
                        SoLuongBanGiao  = row.SoLuongBanGiao,
                        SoTienBanGiao   = row.DonGia * row.SoLuongBanGiao,
                        ThanhTien       = row.SoLuong * row.DonGia
                    };
                }

                soTheoDoiTaiSan.Add(soTheoDoiTaiSanItem);
                prevSoTheoDoiTaiSanItem = soTheoDoiTaiSanItem;
            }

            rpt.bindingSource.DataSource = soTheoDoiTaiSan;
            rpt.Year.Value = this.cmbYear.EditValue;
            FormMainFacade.ShowReport(rpt);
        }
Beispiel #29
0
 protected void Form_Activated(object sender, EventArgs e)
 {
     FormMainFacade.SetFormCaption(this.FormKey);
 }
Beispiel #30
0
 private void bbtnHocSinhXepLop_ItemClick(object sender, ItemClickEventArgs e)
 {
     FormMainFacade.ShowForm(AppForms.FormXepLop);
 }