Inheritance: IP.Core.IPUserService.US_Object
 public void display_4_update(US_DM_PHU_CAP ip_us)
 {
     this.Text = "F107 - Sửa loại phụ cấp";
     m_lbl_header.Text = "SỬA LOẠI PHỤ CẤP";
     m_e_form_mode = DataEntryFormMode.UpdateDataState;
     m_id_dm_phu_cap_4_update = ip_us.dcID;
     m_search_lookup_edit_loai_phu_cap.EditValue = ip_us.dcID_LOAI_PHU_CAP;
     m_txt_doi_tuong_huong.Text = ip_us.strDOI_TUONG_HUONG_PHU_CAP;
     m_txt_ti_le.Text = ip_us.dcTI_LE.ToString();
     this.CenterToScreen();
     this.ShowDialog();
 }
        private void focus_new_row_created(decimal ip_dc_id_dm_dv)
        {
            int v_row_index = 0;
            decimal v_id_qd_moi_lap = 0;
            US_DM_PHU_CAP v_us = new US_DM_PHU_CAP();
            DS_DM_PHU_CAP v_ds = new DS_DM_PHU_CAP();

            v_id_qd_moi_lap = ip_dc_id_dm_dv;
            v_us.FillDataset(v_ds);

            for (v_row_index = 0; v_row_index < v_ds.Tables[0].Rows.Count; v_row_index++)
            {
                var v_id_gd_qd = CIPConvert.ToDecimal(m_grv_dm_phu_cap.GetDataRow(v_row_index)["ID"].ToString());

                if (v_id_gd_qd == v_id_qd_moi_lap)
                {
                    break;
                }
            }
            m_grv_dm_phu_cap.FocusedRowHandle = v_row_index;
        }
        private void save_data()
        {
            US_DM_PHU_CAP v_us_dm_phu_cap = new US_DM_PHU_CAP();
            form_2_us_obj(v_us_dm_phu_cap);

            try
            {
                switch (m_e_form_mode)
                {
                    case DataEntryFormMode.InsertDataState:
                        v_us_dm_phu_cap.BeginTransaction();
                        v_us_dm_phu_cap.Insert();
                        v_us_dm_phu_cap.CommitTransaction();
                        m_id_dm_phu_cap_moi_tao = v_us_dm_phu_cap.dcID;
                        break;
                    case DataEntryFormMode.UpdateDataState:
                        v_us_dm_phu_cap.dcID = m_id_dm_phu_cap_4_update;
                        v_us_dm_phu_cap.BeginTransaction();
                        v_us_dm_phu_cap.Update();
                        v_us_dm_phu_cap.CommitTransaction();
                        break;
                    default:
                        break;
                }
                CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_DU_LIEU_DA_DUOC_CAP_NHAT);
                this.Close();
            }
            catch (Exception v_e)
            {
                throw v_e;
            }
        }
 //save data
 private void form_2_us_obj(US_DM_PHU_CAP ip_us)
 {
     ip_us.dcID_LOAI_PHU_CAP = CIPConvert.ToDecimal(m_search_lookup_edit_loai_phu_cap.EditValue.ToString()) ;
     ip_us.strDOI_TUONG_HUONG_PHU_CAP = m_txt_doi_tuong_huong.Text.Trim();
     ip_us.dcTI_LE = CIPConvert.ToDecimal(m_txt_ti_le.Text.Trim());
 }
        void m_cmd_update_Click(object sender, EventArgs e)
        {
            try
            {
                decimal v_id_dm_phu_cap = CIPConvert.ToDecimal(m_grv_dm_phu_cap.GetRowCellValue(m_grv_dm_phu_cap.FocusedRowHandle, "ID"));

                if (v_id_dm_phu_cap > 0)
                {
                    US_DM_PHU_CAP v_us = new US_DM_PHU_CAP(v_id_dm_phu_cap);
                    F107_dm_phu_cap_de v_frm = new F107_dm_phu_cap_de();
                    v_frm.display_4_update(v_us);
                    load_data_2_grid();

                    focus_new_row_created(v_id_dm_phu_cap);
                }
                else
                {
                    CHRM_BaseMessages.MsgBox_Error(CONST_ID_MSGBOX.ERROR_CHUA_CHON_DONG_TREN_LUOI_DE_SUA);
                }
            }
            catch (Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);
            }
        }
 void m_cmd_delete_Click(object sender, EventArgs e)
 {
     try
     {
         if (CHRM_BaseMessages.MsgBox_Confirm(CONST_ID_MSGBOX.QUESTION_XAC_NHAN_XOA_DU_LIEU) == true)
         {
             DataRow v_dr = m_grv_dm_phu_cap.GetDataRow(m_grv_dm_phu_cap.FocusedRowHandle);
             decimal v_id_phu_cap = CIPConvert.ToDecimal(v_dr["ID"]);
             if (check_loai_pc_dang_su_dung(v_id_phu_cap))
             {
                 string v_str_error = " Không thể xóa loại phụ cấp đang được sử dụng!";
                 XtraMessageBox.Show(v_str_error, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             US_DM_PHU_CAP v_us = new US_DM_PHU_CAP(v_id_phu_cap);
             v_us.BeginTransaction();
             v_us.Delete();
             v_us.CommitTransaction();
             XtraMessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             load_data_2_grid();
         }
     }
     catch (Exception v_e)
     {
         CSystemLog_301.ExceptionHandle(v_e);
     }
 }
 private DS_DM_PHU_CAP load_data_2_ds_dm_phu_cap()
 {
     US_DM_PHU_CAP v_us = new US_DM_PHU_CAP();
     DS_DM_PHU_CAP v_ds = new DS_DM_PHU_CAP();
     v_us.FillDataset(v_ds);
     return v_ds;
 }