Example #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);
        }
Example #2
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);
            }
        }
Example #3
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (this.onSavePhieuThu())
     {
         this.Close();
         FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedPhieuThuCaption);
     }
 }
Example #4
0
 private void btnLuuTao_Click(object sender, EventArgs e)
 {
     if (this.onSavePhieuThu())
     {
         this.resetForm();
         FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedAndAddingPhieuThuCaption);
         this.IsEditing = false;
     }
 }
Example #5
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);
        }
Example #6
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);
        }
Example #7
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);
        }
Example #8
0
        private void btnLuuTao_Click(object sender, EventArgs e)
        {
            if (!this.dxValidationProvider.Validate())
            {
                return;
            }

            this.luuPhieuChi();
            this.resetForm();
            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.AddedAndAddingPhieuChiCaption);
        }
Example #9
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);
        }
Example #10
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);
        }
Example #11
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);
            }
        }
Example #12
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);
        }
Example #13
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);
        }
Example #14
0
 protected virtual void onEditing()
 {
     this.GridViewMain.ShowPopupEditForm();
     FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
 }
Example #15
0
 protected void GridViewMain_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
 }
Example #16
0
 protected void GridViewMain_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
 {
     FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
 }
Example #17
0
 protected void GridViewMain_RowDeleting(object sender, DevExpress.Data.RowDeletingEventArgs e)
 {
     FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.ModifiedCaption);
 }