예제 #1
0
        public void GenerateSoThuTienByHocSinhAndLopAndNgayTinh(int hocSinhId, int lopId, DateTime ngayTinh, int stt, ViewBangThuTienRow preMonthViewBangThuTien)
        {
            BangThuTienTableAdapter bangThuTienTableAdapter = (BangThuTienTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterBangThuTien);
            LopKhoiTableAdapter     lopKhoiTableAdapter     = (LopKhoiTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterLopKhoi);

            int    sXThangTruoc           = 0;
            long   soTienSXThangTruoc     = 0;
            int    anSangThangTruoc       = 0;
            long   soTienAnSangThangTruoc = 0;
            long   soTienAnSangThangNay   = 0;
            int    anToiThangTruoc        = 0;
            long   soTienAnToiThangTruoc  = 0;
            long   soTienAnToiThangNay    = 0;
            long   soTienNangKhieu        = 0;
            long   soTienTruyThu          = 0;
            long   soTienDieuHoa          = 0;
            long   soTienDoDung           = 0;
            String ghiChu = "";

            bangThuTienTableAdapter.Insert(hocSinhId, lopId, sXThangTruoc, soTienSXThangTruoc, anSangThangTruoc, soTienAnSangThangTruoc, soTienAnSangThangNay, soTienAnToiThangTruoc, anToiThangTruoc, soTienAnToiThangNay, soTienDoDung, soTienNangKhieu, soTienTruyThu, soTienDieuHoa, ngayTinh, stt, 0, DateTime.Now, ghiChu);
            int bangThuTienId = (int)bangThuTienTableAdapter.Adapter.InsertCommand.LastInsertedId;
            int khoiId        = StaticDataUtil.GetKhoiIdByLopId(lopKhoiTableAdapter, lopId).Value;

            this.generateBangThuTienKhoanThu(bangThuTienId, khoiId, ngayTinh, preMonthViewBangThuTien);
        }
예제 #2
0
        protected override void onSaving()
        {
            if (this.DataTable != null)
            {
                List <DataRow> deletedRow  = new List <DataRow>();
                List <DataRow> addedRow    = new List <DataRow>();
                List <DataRow> modifiedRow = new List <DataRow>();

                foreach (DataRow row in this.DataTable.Rows)
                {
                    if (row.RowState == DataRowState.Deleted)
                    {
                        deletedRow.Add(row);
                    }
                    else if (row.RowState == DataRowState.Added)
                    {
                        addedRow.Add(row);
                    }
                    if (row.RowState == DataRowState.Modified)
                    {
                        modifiedRow.Add(row);
                    }
                }

                base.onSaving();

                foreach (DataRow row in deletedRow)
                {
                    QLMamNon.Dao.QLMamNonDs.LopRow lopRow = row as QLMamNon.Dao.QLMamNonDs.LopRow;
                    this.lopKhoiTableAdapter.DeleteLopKhoiByLopId(lopRow.LopId);
                }

                foreach (DataRow row in modifiedRow)
                {
                    QLMamNon.Dao.QLMamNonDs.LopRow lopRow = row as QLMamNon.Dao.QLMamNonDs.LopRow;
                    int?khoiId = StaticDataUtil.GetKhoiIdByLopId(this.lopKhoiTableAdapter, lopRow.LopId);

                    if (khoiId != null)
                    {
                        this.lopKhoiTableAdapter.DeleteLopKhoiByLopId(lopRow.LopId);
                    }

                    if (!lopRow.IsKhoiIdNull())
                    {
                        this.lopKhoiTableAdapter.Insert(lopRow.LopId, lopRow.KhoiId);
                    }
                }

                foreach (DataRow row in addedRow)
                {
                    QLMamNon.Dao.QLMamNonDs.LopRow lopRow = row as QLMamNon.Dao.QLMamNonDs.LopRow;

                    if (!lopRow.IsKhoiIdNull())
                    {
                        this.lopKhoiTableAdapter.Insert(lopRow.LopId, lopRow.KhoiId);
                    }
                }
            }
        }
예제 #3
0
        private void UCEditFormLopHoc_Enter(object sender, EventArgs e)
        {
            QLMamNon.Dao.QLMamNonDs.LopRow row = this.GridView.GetFocusedDataRow() as QLMamNon.Dao.QLMamNonDs.LopRow;

            if (row != null)
            {
                this.cmbKhoi.EditValue = StaticDataUtil.GetKhoiIdByLopId(this.lopKhoiTableAdapter, row.LopId);
            }
        }
예제 #4
0
        private void loadLopData()
        {
            QLMamNon.Dao.QLMamNonDs.LopDataTable dataTable = this.lopTableAdapter.GetData();

            foreach (QLMamNon.Dao.QLMamNonDs.LopRow row in dataTable)
            {
                int?khoiId = StaticDataUtil.GetKhoiIdByLopId(this.lopKhoiTableAdapter, row.LopId);
                if (khoiId.HasValue)
                {
                    row.KhoiId = khoiId.Value;
                }
            }

            this.lopRowBindingSource.DataSource = dataTable;
        }