public void fill_data_by_search(decimal i_dc_id_mon_hoc
                                 , string i_str_online_yn
                                 , string i_str_offline_yn
                                 , string i_str_bt_gky_yn
                                 , string i_str_key_word
                                 , string i_str_bat_dau_tu
                                 , string i_str_bat_dau_den
                                 , string i_str_ket_thuc_tu
                                 , string i_str_ket_thuc_den
                                 , string i_str_thi_tu
                                 , string i_str_thi_den
                                 , DS_GD_LOP_MON i_ds)
 {
     try
     {
         CStoredProc v_object = new CStoredProc("pr_GD_LOP_MON_Fill_By_Search");
         v_object.addDecimalInputParam("@ip_id_mon_hoc", i_dc_id_mon_hoc);
         v_object.addNVarcharInputParam("@ip_online_yn", i_str_online_yn);
         v_object.addNVarcharInputParam("@ip_offline_yn", i_str_offline_yn);
         v_object.addNVarcharInputParam("@ip_bt_gky_yn", i_str_bt_gky_yn);
         v_object.addNVarcharInputParam("@ip_key_word", i_str_key_word);
         v_object.addDatetimeInputParam("@ip_ngay_bat_dau_tu", CIPConvert.ToDatetime(i_str_bat_dau_tu, "dd/MM/yyyy"));
         v_object.addDatetimeInputParam("@ip_ngay_bat_dau_den", CIPConvert.ToDatetime(i_str_bat_dau_den, "dd/MM/yyyy"));
         v_object.addDatetimeInputParam("@ip_ngay_ket_thuc_tu", CIPConvert.ToDatetime(i_str_ket_thuc_tu, "dd/MM/yyyy"));
         v_object.addDatetimeInputParam("@ip_ngay_ket_thuc_den", CIPConvert.ToDatetime(i_str_ket_thuc_den, "dd/MM/yyyy"));
         v_object.addDatetimeInputParam("@ip_ngay_thi_tu", CIPConvert.ToDatetime(i_str_thi_tu, "dd/MM/yyyy"));
         v_object.addDatetimeInputParam("@ip_ngay_thi_den", CIPConvert.ToDatetime(i_str_thi_den, "dd/MM/yyyy"));
         v_object.fillDataSetByCommand(this, i_ds);
     }
     catch (Exception v_e)
     {
         throw v_e;
     }
 }
 public US_GD_LOP_MON(decimal i_dbID)
 {
     pm_objDS = new DS_GD_LOP_MON();
     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 decimal get_id_lop_mon_by_ma_lop_mon(string ip_str_ma_lop_mon)
    {
        DS_GD_LOP_MON v_ds_lop_mon = new DS_GD_LOP_MON();
        US_GD_LOP_MON v_us_lop_mon = new US_GD_LOP_MON();

        v_us_lop_mon.FillDataset(v_ds_lop_mon, " WHERE MA_LOP_MON = N'" + ip_str_ma_lop_mon + "'");
        if (v_ds_lop_mon.GD_LOP_MON.Rows.Count == 0)
        {
            return(0);
        }
        return(CIPConvert.ToDecimal(v_ds_lop_mon.GD_LOP_MON.Rows[0][GD_LOP_MON.ID]));
    }
    //private bool check_hop_ly_so_tien()
    //{
    //    if()
    //    return false;
    //    return true;
    //}
    private bool check_exist_ma_mon(string ip_str_ma_lop_mon)
    {
        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_us_gd_lop_mon.FillDataset(v_ds_gd_lop_mon, " WHERE MA_LOP_MON='" + ip_str_ma_lop_mon + "'");
        if (v_ds_gd_lop_mon.GD_LOP_MON.Rows.Count == 0)
        {
            return(false); // Nghĩa là không tồn tại lớp môn đó
        }
        return(true);      // Nghĩa là tồn tại lớp môn đó
    }
        public US_GD_LOP_MON(decimal i_dbID)
        {
            pm_objDS        = new DS_GD_LOP_MON();
            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]);
        }
 public bool check_trung_ma_lop_mon(string i_str_ma_lop_mon)
 {
     try {
         DS_GD_LOP_MON  v_ds          = new DS_GD_LOP_MON();
         IMakeSelectCmd v_obj_mak_cmd = new CMakeAndSelectCmd(v_ds, v_ds.GD_LOP_MON.TableName);
         v_obj_mak_cmd.AddCondition("MA_LOP_MON", i_str_ma_lop_mon, eKieuDuLieu.KieuString, eKieuSoSanh.Bang);
         this.FillDatasetByCommand(v_ds, v_obj_mak_cmd.getSelectCmd());
         if (v_ds.GD_LOP_MON.Rows.Count > 0)
         {
             //this.DataRow2Me(v_ds.GD_LOP_MON.Rows[0]);
             return(true);
         }
         return(false);
     }
     catch (Exception v_e) {
         throw v_e;
     }
 }
    public string mapping_time_lop_mon(string ip_str_ma_lop_mon)
    {
        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_us_gd_lop_mon.FillDataset(v_ds_gd_lop_mon, " WHERE MA_LOP_MON=N'" + ip_str_ma_lop_mon + "'");
        if (v_ds_gd_lop_mon.GD_LOP_MON.Rows[0][GD_LOP_MON.NGAY_BAT_DAU].GetType() == typeof(DBNull))
        {
            if (v_ds_gd_lop_mon.GD_LOP_MON.Rows[0][GD_LOP_MON.NGAY_KET_THUC].GetType() == typeof(DBNull))
            {
                return("");
            }
            else
            {
                return(CIPConvert.ToStr(v_ds_gd_lop_mon.GD_LOP_MON.Rows[0][GD_LOP_MON.NGAY_KET_THUC], "dd/MM/yyyy"));
            }
        }
        else if (v_ds_gd_lop_mon.GD_LOP_MON.Rows[0][GD_LOP_MON.NGAY_KET_THUC].GetType() == typeof(DBNull))
        {
            return(CIPConvert.ToStr(v_ds_gd_lop_mon.GD_LOP_MON.Rows[0][GD_LOP_MON.NGAY_BAT_DAU], "dd/MM/yyyy"));
        }
        return(CIPConvert.ToStr(v_ds_gd_lop_mon.GD_LOP_MON.Rows[0][GD_LOP_MON.NGAY_BAT_DAU], "dd/MM/yyyy") + " - " + CIPConvert.ToStr(v_ds_gd_lop_mon.GD_LOP_MON.Rows[0][GD_LOP_MON.NGAY_KET_THUC], "dd/MM/yyyy"));
    }
 private DataRow get_id_lop_mon_tu_data_row(ref decimal v_id_gdlm, DataRow v_data_row, US_DUNG_CHUNG v_us_dc)
 {
     US_GD_LOP_MON v_us_gdlm = new US_GD_LOP_MON();
     DS_GD_LOP_MON v_ds_gdlm = new DS_GD_LOP_MON();
     v_us_dc.FillDatasetWithQuery(v_ds_gdlm, "Select * from gd_lop_mon where MA_LOP_HOC='" + v_data_row["MA_LOP"].ToString() + "'");
     var v_dt_r = v_ds_gdlm.Tables[0].Rows[0];
     v_id_gdlm = CIPConvert.ToDecimal(v_dt_r["ID"].ToString());
     return v_dt_r;
     //}
 }
Exemple #9
0
    private void load_data_2_grid()
    {
        m_ds_gd_lop_mon = new DS_GD_LOP_MON();
        try
        {
            #region Get value YN Field
            string v_str_online_yn  = "";
            string v_str_offline_yn = "";
            string v_str_bt_gky_yn  = "";
            if (m_rbt_online_yn.SelectedValue == "Y")
            {
                v_str_online_yn = "Y";
            }
            else if (m_rbt_online_yn.SelectedValue == "N")
            {
                v_str_online_yn = "N";
            }
            else if (m_rbt_online_yn.SelectedValue == "ALL")
            {
                v_str_online_yn = "ALL";
            }
            //
            if (m_rbt_offline_yn.SelectedValue == "Y")
            {
                v_str_offline_yn = "Y";
            }
            else if (m_rbt_offline_yn.SelectedValue == "N")
            {
                v_str_offline_yn = "N";
            }
            else if (m_rbt_offline_yn.SelectedValue == "ALL")
            {
                v_str_offline_yn = "ALL";
            }
            //
            if (m_rbt_bt_gky_yn.SelectedValue == "Y")
            {
                v_str_bt_gky_yn = "Y";
            }
            else if (m_rbt_bt_gky_yn.SelectedValue == "N")
            {
                v_str_bt_gky_yn = "N";
            }
            else if (m_rbt_bt_gky_yn.SelectedValue == "ALL")
            {
                v_str_bt_gky_yn = "ALL";
            }
            #endregion
            string v_str_ngay_bat_dau_tu = "01/01/1900", v_str_ngay_bat_dau_den = "01/01/1900", v_str_ngay_ket_thuc_tu = "01/01/1900",
                   v_str_ngay_ket_thuc_den = "01/01/1900", v_str_ngay_thi_tu = "01/01/1900", v_str_ngay_thi_den = "01/01/1900";
            if (m_dat_ngay_bat_dau_tu.SelectedDate != CIPConvert.ToDatetime("01/01/0001", "dd/MM/yyyy"))
            {
                v_str_ngay_bat_dau_tu = CIPConvert.ToStr(m_dat_ngay_bat_dau_tu.SelectedDate, "dd/MM/yyyy");
            }
            if (m_dat_ngay_bat_dau_den.SelectedDate != CIPConvert.ToDatetime("01/01/0001", "dd/MM/yyyy"))
            {
                v_str_ngay_bat_dau_den = CIPConvert.ToStr(m_dat_ngay_bat_dau_den.SelectedDate, "dd/MM/yyyy");
            }
            if (m_dat_ngay_ket_thuc_tu.SelectedDate != CIPConvert.ToDatetime("01/01/0001", "dd/MM/yyyy"))
            {
                v_str_ngay_ket_thuc_tu = CIPConvert.ToStr(m_dat_ngay_ket_thuc_tu.SelectedDate, "dd/MM/yyyy");
            }
            if (m_dat_ngay_ket_thuc_den.SelectedDate != CIPConvert.ToDatetime("01/01/0001", "dd/MM/yyyy"))
            {
                v_str_ngay_ket_thuc_den = CIPConvert.ToStr(m_dat_ngay_ket_thuc_den.SelectedDate, "dd/MM/yyyy");
            }
            if (m_dat_ngay_thi_tu.SelectedDate != CIPConvert.ToDatetime("01/01/0001", "dd/MM/yyyy"))
            {
                v_str_ngay_thi_tu = CIPConvert.ToStr(m_dat_ngay_thi_tu.SelectedDate, "dd/MM/yyyy");
            }
            if (m_dat_ngay_thi_den.SelectedDate != CIPConvert.ToDatetime("01/01/0001", "dd/MM/yyyy"))
            {
                v_str_ngay_thi_den = CIPConvert.ToStr(m_dat_ngay_thi_den.SelectedDate, "dd/MM/yyyy");
            }


            m_us_gd_lop_mon.fill_data_by_search(CIPConvert.ToDecimal(m_cbo_dm_mon_hoc.SelectedValue)
                                                , v_str_online_yn
                                                , v_str_offline_yn
                                                , v_str_bt_gky_yn
                                                , m_txt_tu_khoa_tim_kiem.Text
                                                , v_str_ngay_bat_dau_tu
                                                , v_str_ngay_bat_dau_den
                                                , v_str_ngay_ket_thuc_tu
                                                , v_str_ngay_ket_thuc_den
                                                , v_str_ngay_thi_tu
                                                , v_str_ngay_thi_den
                                                , m_ds_gd_lop_mon);
            m_grv.DataSource = m_ds_gd_lop_mon.GD_LOP_MON;
            m_grv.DataBind();
            m_lbl_ket_qua_loc.Text = "Kết quả lọc dữ liệu: " + m_ds_gd_lop_mon.GD_LOP_MON.Rows.Count + " bản ghi";
        }
        catch (Exception v_e)
        {
            throw 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();
         }
     }
 }
        private void m_cmd_assign_Click(object sender, EventArgs e)
        {
            var v_count = m_grv.SelectedRowsCount;
            if (v_count == 0)
            {
                MessageBox.Show("Vui lòng chọn nhân viên để thêm vào lớp học");

            }
            else
            {
                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 + ")");
                if (v_ds_gd_LOP_MON.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("Chưa có lớp học nào cho môn học này. Vui lòng thêm lớp học mới!");
                }
                else
                {
                    try
                    {
                        F301_Assign v_f = new F301_Assign();
                        if (m_dc_id_lop_mon == -1)
                        {
                            m_dc_id_mon_hoc = CIPConvert.ToDecimal(m_search_lookup_edit.EditValue.ToString());
                            v_f.Display(m_dc_id_mon_hoc, ref m_dc_id_lop_mon);
                        }
                        else
                        {
                            v_f.Display(m_dc_id_lop_mon, m_dc_id_mon_hoc);
                        }
                        if (v_f.DialogResult == System.Windows.Forms.DialogResult.OK)
                        {
                            List<decimal> v_lst_id_lop = new List<decimal>();
                            v_lst_id_lop.Add(m_dc_id_lop_mon);
                            assignHV(v_lst_id_lop, GetSelectedRows(m_grv).Count);
                            MessageBox.Show("Assign thành công học viên vào lớp môn.");
                            load_data_2_grid();
                        }
                    }
                    catch (Exception v_e)
                    {
                        CSystemLog_301.ExceptionHandle(v_e);
                    }
                }
            }
        }
 public US_GD_LOP_MON()
 {
     pm_objDS = new DS_GD_LOP_MON();
     pm_strTableName = c_TableName;
     pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow();
 }
 public US_GD_LOP_MON()
 {
     pm_objDS        = new DS_GD_LOP_MON();
     pm_strTableName = c_TableName;
     pm_objDR        = pm_objDS.Tables[pm_strTableName].NewRow();
 }