示例#1
0
        private void btnMoveRight_Click(object sender, EventArgs e)
        {
            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;
            }

            if (this.hocSinhRowBindingSourceDi.Current == null)
            {
                return;
            }

            DataRowView rowView = this.hocSinhRowBindingSourceDi.Current as DataRowView;

            QLMamNon.Dao.QLMamNonDs.HocSinhRow oldRow = rowView.Row as QLMamNon.Dao.QLMamNonDs.HocSinhRow;

            if (this.isHocSinhExisted(this.hocSinhRowBindingSourceDen, oldRow.HocSinhId))
            {
                return;
            }

            DataRowView newRowView = this.hocSinhRowBindingSourceDen.AddNew() as DataRowView;

            QLMamNon.Dao.QLMamNonDs.HocSinhRow newRow = newRowView.Row as QLMamNon.Dao.QLMamNonDs.HocSinhRow;
            copyHocSinhRow(oldRow, newRow);
            newRow.LopDangHoc = this.cmbLopHocDen.Text;
            newRow.NgayVaoLop = DateTime.Now;

            this.gvDen.ShowEditForm();
        }
示例#2
0
        private void btnMoveLeft_Click(object sender, EventArgs e)
        {
            if (this.hocSinhRowBindingSourceDen.Current == null)
            {
                return;
            }

            DataRowView rowView = this.hocSinhRowBindingSourceDen.Current as DataRowView;

            QLMamNon.Dao.QLMamNonDs.HocSinhRow oldRow = rowView.Row as QLMamNon.Dao.QLMamNonDs.HocSinhRow;

            if (this.isHocSinhExisted(this.hocSinhRowBindingSourceDi, oldRow.HocSinhId))
            {
                QLMamNon.Dao.QLMamNonDs.HocSinhDataTable hocSinhTable = this.hocSinhRowBindingSourceDi.DataSource as QLMamNon.Dao.QLMamNonDs.HocSinhDataTable;
                QLMamNon.Dao.QLMamNonDs.HocSinhRow[]     hocSinhRows  = hocSinhTable.Select(String.Format("HocSinhId={0}", oldRow.HocSinhId)) as QLMamNon.Dao.QLMamNonDs.HocSinhRow[];
                hocSinhRows[0].LopDangHoc = CommonConstant.EMPTY;
                this.gvDen.DeleteSelectedRows();

                return;
            }

            DataRowView newRowView = this.hocSinhRowBindingSourceDi.AddNew() as DataRowView;

            QLMamNon.Dao.QLMamNonDs.HocSinhRow newRow = newRowView.Row as QLMamNon.Dao.QLMamNonDs.HocSinhRow;
            copyHocSinhRow(oldRow, newRow);

            this.gvDen.DeleteSelectedRows();
        }
示例#3
0
        private static void copyHocSinhRow(QLMamNon.Dao.QLMamNonDs.HocSinhRow oldRow, QLMamNon.Dao.QLMamNonDs.HocSinhRow newRow)
        {
            newRow.HocSinhId = oldRow.HocSinhId;
            newRow.HoDem     = oldRow.HoDem;
            newRow.Ten       = oldRow.Ten;
            newRow.HoTen     = String.Format("{0} {1}", oldRow.HoDem, oldRow.Ten);
            newRow.GioiTinh  = oldRow.GioiTinh;
            newRow.ThoiHoc   = oldRow.ThoiHoc;

            if (!oldRow.IsNgaySinhNull())
            {
                newRow.NgaySinh = oldRow.NgaySinh;
            }
        }