public US_GD_DIEM_DANH(decimal i_dbID)
 {
     pm_objDS = new DS_GD_DIEM_DANH();
     pm_strTableName = c_TableName;
     IMakeSelectCmd v_objMkCmd = new CMakeAndSelectCmd(pm_objDS, c_TableName);
     v_objMkCmd.AddCondition("ID", i_dbID, eKieuDuLieu.KieuNumber, eKieuSoSanh.Bang);
     SqlCommand v_cmdSQL;
     v_cmdSQL = v_objMkCmd.getSelectCmd();
     this.FillDatasetByCommand(pm_objDS, v_cmdSQL);
     pm_objDR = getRowClone(pm_objDS.Tables[pm_strTableName].Rows[0]);
 }
        private void diem_danh_lop_mon()
        {
            for (int i = m_fg.Rows.Fixed; i < m_fg.Rows.Count; i++)
            {
                DS_GD_DIEM_DANH v_ds_diem_danh = new DS_GD_DIEM_DANH();
                US_GD_DIEM_DANH v_us_diem_danh = new US_GD_DIEM_DANH();

                US_V_DM_HOC_SINH v_us_dm_hs = new US_V_DM_HOC_SINH();
                decimal op_dc_id_gd_diem_danh = 0;

                if ((m_fg.GetCellCheck(i, 5) == CheckEnum.Checked) && (v_us_diem_danh.check_diem_danh_hs(
                                                                            CIPConvert.ToDecimal(m_fg.Rows[i][(int)e_col_Number.ID_HOC_SINH])
                                                                            , CIPConvert.ToDecimal(m_cbo_lop_mon.SelectedValue)
                                                                            , CIPConvert.ToDecimal(m_cbo_nguoi_diem_danh.SelectedValue)
                                                                            , m_dat_tai_ngay.Value.Date
                                                                            , ref op_dc_id_gd_diem_danh)))
                {
                    continue;
                }
                else if ((m_fg.GetCellCheck(i, 5) == CheckEnum.Checked) && (!v_us_diem_danh.check_diem_danh_hs(
                                                                            CIPConvert.ToDecimal(m_fg.Rows[i][(int)e_col_Number.ID_HOC_SINH])
                                                                            , CIPConvert.ToDecimal(m_cbo_lop_mon.SelectedValue)
                                                                            , CIPConvert.ToDecimal(m_cbo_nguoi_diem_danh.SelectedValue)
                                                                            , m_dat_tai_ngay.Value.Date
                                                                            , ref op_dc_id_gd_diem_danh)))
                {
                    v_us_diem_danh.dcID_HOC_SINH = CIPConvert.ToDecimal(m_fg.Rows[i][(int)e_col_Number.ID_HOC_SINH]);
                    v_us_diem_danh.dcID_LOP_MON = CIPConvert.ToDecimal(m_cbo_lop_mon.SelectedValue);
                    v_us_diem_danh.dcID_NGUOI_NHAP = CIPConvert.ToDecimal(m_cbo_nguoi_diem_danh.SelectedValue);
                    v_us_diem_danh.dcID_NGUOI_DIEM_DANH = CIPConvert.ToDecimal(m_cbo_nguoi_diem_danh.SelectedValue);
                    v_us_diem_danh.datNGAY_HOC = m_dat_tai_ngay.Value.Date;
                    v_us_diem_danh.dcID_CA_HOC = CIPConvert.ToDecimal(m_cbo_ca_hoc.SelectedValue);
                    v_us_diem_danh.Insert();
                }
                else if ((m_fg.GetCellCheck(i, 5) == CheckEnum.Unchecked) && (v_us_diem_danh.check_diem_danh_hs(
                                                                            CIPConvert.ToDecimal(m_fg.Rows[i][(int)e_col_Number.ID_HOC_SINH])
                                                                            , CIPConvert.ToDecimal(m_cbo_lop_mon.SelectedValue)
                                                                            , CIPConvert.ToDecimal(m_cbo_nguoi_diem_danh.SelectedValue)
                                                                            , m_dat_tai_ngay.Value.Date
                                                                            , ref op_dc_id_gd_diem_danh)))
                {
                    v_us_diem_danh.dcID = op_dc_id_gd_diem_danh;
                    v_us_diem_danh.Delete();
                }
                else
                {
                    continue;
                }
            }
            BaseMessages.MsgBox_Infor("Bạn đã điểm danh thành công!!!");
        }
 public US_GD_DIEM_DANH()
 {
     pm_objDS = new DS_GD_DIEM_DANH();
     pm_strTableName = c_TableName;
     pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow();
 }
        public bool check_diem_danh_hs(
            decimal ip_dc_id_hoc_sinh
            , decimal ip_dc_id_lop_mon
            , decimal ip_dc_id_nguoi_diem_danh
            , DateTime ip_dat_tai_ngay
            , ref decimal op_dc_id_gd_diem_danh)
        {
            DS_GD_DIEM_DANH op_ds_diem_danh = new DS_GD_DIEM_DANH();
            CStoredProc v_obj_spr = new CStoredProc("pr_kiem_tra_hoc_sinh_diem_danh");
            v_obj_spr.addDecimalInputParam("@ip_dc_id_hoc_sinh", ip_dc_id_hoc_sinh);
            v_obj_spr.addDecimalInputParam("@ip_dc_id_lop_mon", ip_dc_id_lop_mon);
            v_obj_spr.addDecimalInputParam("@ip_dc_id_nguoi_diem_danh", ip_dc_id_nguoi_diem_danh);
            v_obj_spr.addDatetimeInputParam("@ip_dat_tai_ngay", ip_dat_tai_ngay);
            SqlParameter v_id_gd_diem_danh = v_obj_spr.addDecimalOutputParam("@op_dc_id_gd_diem_danh", 0);

            v_obj_spr.ExecuteCommand(this);

            op_dc_id_gd_diem_danh = CIPConvert.ToDecimal(v_id_gd_diem_danh.Value);
            if (op_dc_id_gd_diem_danh == -1)
            {
                return false;
            }
            else
                return true;
        }