コード例 #1
0
        private void xoa_lop_mon(decimal v_count)
        {
            for (int i = 0; i < v_count; i++)
            {
                var v_data_row = m_grv.GetDataRow(m_grv.GetSelectedRows()[i]);
                US_GD_LOP_MON v_us_gd_lop_mon = new US_GD_LOP_MON(CIPConvert.ToDecimal(v_data_row["ID"].ToString()));
                decimal v_dc_id_lop_mon = CIPConvert.ToDecimal(v_us_gd_lop_mon.dcID.ToString());
                DataSet v_ds = new DataSet();
                v_ds.Tables.Add(new DataTable());
                US_DUNG_CHUNG v_us_dc = new US_DUNG_CHUNG();
                v_us_dc.FillDatasetWithQuery(v_ds, "Select * from gd_diem where id_lop_mon=" + v_dc_id_lop_mon.ToString());
                if (v_ds.Tables[0].Rows.Count > 0)
                {
                    for (int j = 0; j < v_ds.Tables[0].Rows.Count; j++)
                    {

                        var v_id_gdd = CIPConvert.ToDecimal(v_ds.Tables[0].Rows[j]["ID"].ToString());
                        var v_us_gdd= new US_GD_DIEM(v_id_gdd);
                         var v_ds_gdd = new DataSet();
                         v_ds_gdd.Tables.Add(new DataTable());
                         v_us_dc.FillDatasetWithQuery(v_ds_gdd, "Select * from gd_chung_chi where id_gd_diem=" + v_id_gdd.ToString());
                         if (v_ds_gdd.Tables[0].Rows.Count > 0)
                        {
                            var v_dtr_gdcc = v_ds_gdd.Tables[0].Rows[0];
                            var v_us_gdcc = new US_GD_CHUNG_CHI(CIPConvert.ToDecimal(v_dtr_gdcc["ID"].ToString()));
                            v_us_gdcc.strDA_XOA = "Y";
                            v_us_gdcc.Update();
                        }
                        v_us_gdd.strDA_XOA = "Y";
                        v_us_gdd.Update();
                    }
                }

                v_us_gd_lop_mon.strDA_XOA = "Y";
                v_us_gd_lop_mon.Update();
            }
        }
コード例 #2
0
 private void m_cmd_delete_Click(object sender, EventArgs e)
 {
     try
     {
          decimal v_count =CIPConvert.ToDecimal(m_grv.SelectedRowsCount.ToString());
          if (v_count == 0)
          {
              MessageBox.Show("Bạn phải chọn lớp môn để thực hiện tác vụ này!");
          }
          else
          {
              DialogResult dialogResult = MessageBox.Show("Bạn có chắc chắn muốn xóa bản ghi này không?", "Cảnh báo", MessageBoxButtons.YesNo);
              if (dialogResult == DialogResult.Yes)
              {
                  for (int i = 0; i < m_grv.SelectedRowsCount; i++)
                  {
                      var v_dr = m_grv.GetDataRow(m_grv.GetSelectedRows()[i]);
                      US_GD_DIEM v_us = new US_GD_DIEM(CIPConvert.ToDecimal(v_dr["ID"].ToString()));
                      v_us.strDA_XOA = "Y";
                      v_us.Update();
                  }
                  MessageBox.Show("Đã xóa " + m_grv.SelectedRowsCount.ToString() + " học viên.");
                  load_data_2_grid();
              }
          }
     }
     catch (Exception v_e)
     {
         CSystemLog_301.ExceptionHandle(v_e);
     }
 }
 private void updateNhanVienMonHoc(decimal ip_dc_id_nhan_vien)
 {
     US_GD_LOP_MON v_us_gd_LOP_MON = new US_GD_LOP_MON();
     DS_GD_LOP_MON v_ds_gd_LOP_MON = new DS_GD_LOP_MON();
     v_ds_gd_LOP_MON.EnforceConstraints = false;
     v_us_gd_LOP_MON.FillDataset(v_ds_gd_LOP_MON, " WHERE ID_VERSION_MON_HOC IN (SELECT ID FROM DM_VERSION_MON_HOC WHERE ID_MON_HOC = " + m_search_lookup_edit.EditValue + ")");
     for (int i = 0; i < v_ds_gd_LOP_MON.Tables[0].Rows.Count; i++)
     {
         US_GD_DIEM v_us = new US_GD_DIEM();
         DS_GD_DIEM v_ds = new DS_GD_DIEM();
         DataRow v_dr = v_ds_gd_LOP_MON.Tables[0].Rows[i];
         v_us.FillDataset(v_ds, " where id_nhan_vien = " + ip_dc_id_nhan_vien.ToString() + " and id_lop_mon = " + v_dr[GD_LOP_MON.ID]);
         for (int j = 0; j < v_ds.Tables[0].Rows.Count; j++)
         {
             DataRow v_dr_diem = v_ds.Tables[0].Rows[j];
             decimal v_id_gd_diem = CIPConvert.ToDecimal(v_dr_diem[GD_DIEM.ID].ToString());
             v_us = new US_GD_DIEM(v_id_gd_diem);
             v_us.strDA_XOA = "Y";
             v_us.Update();
         }
     }
 }
コード例 #4
0
        private void get_id_gd_diem(US_DUNG_CHUNG v_us_dc, decimal v_id_ns, decimal v_id_gdlm, DataRow v_dt_r, ref int v_int_khong_nhap_duoc, DataRow v_data_row, ref decimal v_count)
        {
            DataSet v_ds = new DataSet();
            v_ds.Tables.Add(new DataTable());
            v_us_dc.FillDatasetWithQuery(v_ds, "SELECT * FROM GD_DIEM WHERE ID_NHAN_VIEN=" + v_id_ns.ToString() + " AND ID_LOP_MON=" + v_id_gdlm.ToString());
            if (v_ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("Nhân viên này chưa có tên trong lớp môn này");

            }
            v_dt_r = v_ds.Tables[0].Rows[0];

            decimal v_id_gdd = CIPConvert.ToDecimal(v_dt_r["ID"].ToString());
            US_GD_DIEM v_us_gdd = new US_GD_DIEM(v_id_gdd);
            if (v_us_gdd.dcDIEM_CHUYEN_CAN.ToString() == "")
            {
                v_us_gdd.IsDIEM_CHUYEN_CANNull();
            }
            else
            {
                v_us_gdd.dcDIEM_CHUYEN_CAN = CIPConvert.ToDecimal(v_data_row["DIEM_CHUYEN_CAN"].ToString());
            }
            if (v_us_gdd.dcDIEM_THI.ToString() == "")
            {
                v_us_gdd.IsDIEM_THINull();
            }
            else
            {
                v_us_gdd.dcDIEM_THI = CIPConvert.ToDecimal(v_data_row["DIEM_KIEM_TRA"].ToString());
            }
            if (v_us_gdd.dcDIEM_KIEM_TRA.ToString()=="")
            {
                v_us_gdd.IsDIEM_KIEM_TRANull();
            }
            else
            {
                v_us_gdd.dcDIEM_KIEM_TRA = CIPConvert.ToDecimal(v_data_row["DIEM_THI"].ToString());
            }

            v_us_gdd.strQUA_MON = v_data_row["KET_QUA"].ToString();
            v_us_gdd.datNGAY_SUA = DateTime.Now.Date;
            v_us_gdd.strHOC_XONG_YN = "Y";
            v_us_gdd.Update();
            try
            {
                v_us_gdd.Update();
                v_data_row.Delete();

                v_count++;
            }
            catch (Exception)
            {

                MessageBox.Show("Lỗi!");
                v_int_khong_nhap_duoc++;
            }
        }