public US_DM_LUONG_CHE_DO(decimal i_dbID)
 {
     pm_objDS = new DS_DM_LUONG_CHE_DO();
     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 bool check_ma_muc_da_ton_tai()
 {
     US_DM_LUONG_CHE_DO v_us = new US_DM_LUONG_CHE_DO();
     DS_DM_LUONG_CHE_DO v_ds = new DS_DM_LUONG_CHE_DO();
     decimal v_id_ma = CIPConvert.ToDecimal(m_sle_ma_lcd.EditValue);
     decimal v_id_muc = CIPConvert.ToDecimal(m_sle_muc_lcd.EditValue);
     v_us.FillDataset(v_ds, "where id_ma_lcd = " + v_id_ma + "and id_muc_lcd =" + v_id_muc);
     if ((m_us.dcID_MA_LCD != v_id_ma || m_us.dcID_MUC_LCD != v_id_muc) && v_ds.Tables[0].Rows.Count !=0)
     {
         return true;
     }
     return false;
 }
 private DataRow get_luong_cd_theo_ma_muc()
 {
     if (m_sle_ma_lcd.EditValue == null || m_sle_muc_lcd.EditValue == null)
         return null;
     else
     {
         US_DM_LUONG_CHE_DO v_us = new US_DM_LUONG_CHE_DO();
         DS_DM_LUONG_CHE_DO v_ds = new DS_DM_LUONG_CHE_DO();
         v_us.FillDatasetTheoIDMaMuc(v_ds, m_sle_ma_lcd.EditValue.ToString(), m_sle_muc_lcd.EditValue.ToString());
         if (v_ds.Tables[0].Rows.Count == 0)
             return null;
         else return v_ds.Tables[0].Rows[0];
     }
 }
        private decimal find_id_lcd_by_ma_lcd(string ma_lcd, string muc_lcd)
        {
            try
            {
                decimal id_ma_lcd = (from DataRow dr in m_dt_ma_lcd.Rows
                                     where (string)dr["MA_TU_DIEN"] == ma_lcd
                                     select (decimal)dr["ID"]).FirstOrDefault();
                decimal id_muc_lcd = (from DataRow dr in m_dt_muc_lcd.Rows
                                      where (string)dr["MA_TU_DIEN"] == muc_lcd
                                      select (decimal)dr["ID"]).FirstOrDefault();
                US_DM_LUONG_CHE_DO v_us = new US_DM_LUONG_CHE_DO();
                DS_DM_LUONG_CHE_DO v_ds = new DS_DM_LUONG_CHE_DO();
                v_us.FillDataset(v_ds);
                decimal id_lcd = (from DataRow dr in v_ds.Tables[0].Rows
                                  where (decimal)dr["ID_MA_LCD"] == id_ma_lcd & (decimal)dr["ID_MUC_LCD"] == id_muc_lcd
                                  select (decimal)dr["ID"]).FirstOrDefault();

                return id_lcd;
            }
            catch (Exception v_e)
            {
                throw v_e;
            }
        }
 public US_DM_LUONG_CHE_DO()
 {
     pm_objDS = new DS_DM_LUONG_CHE_DO();
     pm_strTableName = c_TableName;
     pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow();
 }
 public void FillDatasetTheoIDMaMuc(DS_DM_LUONG_CHE_DO v_ds, string id_ma_lcd, string id_muc_lcd)
 {
     CStoredProc v_cstore = new CStoredProc("pr_LCD_get_he_so_theo_ID_ma_muc");
     v_cstore.addDecimalInputParam("@id_ma_lcd", id_ma_lcd);
     v_cstore.addDecimalInputParam("@id_muc_lcd", id_muc_lcd);
     v_cstore.fillDataSetByCommand(this, v_ds);
 }
        private decimal find_so_tien_lcd(decimal ip_dc_id_ma_lcd, decimal ip_dc_id_muc_lcd)
        {
            try
            {
                US_DM_LUONG_CHE_DO v_us = new US_DM_LUONG_CHE_DO();
                DS_DM_LUONG_CHE_DO v_ds = new DS_DM_LUONG_CHE_DO();

                v_us.FillDataset(v_ds);

                string v_str_filter = "ID_MA_LCD = " + ip_dc_id_ma_lcd + " AND ID_MUC_LCD = " + ip_dc_id_muc_lcd;
                DataRow[] v_dr = v_ds.DM_LUONG_CHE_DO.Select(v_str_filter);

                if (v_dr.Count() == 0)
                {
                    return 0;
                }
                else
                {
                    return CIPConvert.ToDecimal(v_dr.First()["SO_TIEN"].ToString());
                }
            }
            catch (Exception v_e)
            {
                throw v_e;
            }
        }
        private decimal find_id_muc_lcd(decimal ip_dc_id_lcd)
        {
            US_DM_LUONG_CHE_DO v_us = new US_DM_LUONG_CHE_DO();
            DS_DM_LUONG_CHE_DO v_ds = new DS_DM_LUONG_CHE_DO();

            v_us.FillDataset(v_ds);

            string v_str_filter = "ID = " + ip_dc_id_lcd;
            DataRow[] v_dr = v_ds.DM_LUONG_CHE_DO.Select(v_str_filter);

            if (v_dr.Count() == 0)
            {
                return -1;
            }
            else
            {
                return CIPConvert.ToDecimal(v_dr.First()["ID_MUC_LCD"].ToString());
            }
        }
        private decimal find_lcd(decimal ip_dc_chuc_danh, decimal ip_dc_muc)
        {
            US_DM_LUONG_CHE_DO v_us = new US_DM_LUONG_CHE_DO();
            DS_DM_LUONG_CHE_DO v_ds = new DS_DM_LUONG_CHE_DO();

            v_us.FillDataset(v_ds);

            string v_str_filter = "ID_MA_LCD = " + ip_dc_chuc_danh + " AND ID_MUC_LCD = " + ip_dc_muc;
            DataRow[] v_dr = v_ds.DM_LUONG_CHE_DO.Select(v_str_filter);

            if (v_dr.Count() == 0)
            {
                return 0;
            }
            else
            {
                return CIPConvert.ToDecimal(v_dr.First()["SO_TIEN"].ToString());
            }
        }
        private DS_DM_LUONG_CHE_DO load_data_2_dm_loai_don_vi()
        {
            DS_DM_LUONG_CHE_DO v_ds = new DS_DM_LUONG_CHE_DO();
            DS_DM_LUONG_CHE_DO v_us = new DS_DM_LUONG_CHE_DO();

            v_us.FillDataset(v_ds);

            return v_ds;
        }