public void display_4_update(US_DM_THAM_SO ip_us) { this.Text = "F108 - Sửa loại tham số"; m_lbl_header.Text = "SỬA LOẠI THAM SỐ"; m_e_form_mode = DataEntryFormMode.UpdateDataState; m_id_dm_tham_so_4_update = ip_us.dcID; m_txt_ten_tham_so.Text = ip_us.strLOAI; m_txt_gia_tri_tham_so.Text = ip_us.dcSO_TIEN.ToString(); CHRMCommon.format_text_2_money(m_txt_gia_tri_tham_so); 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_THAM_SO v_us = new US_DM_THAM_SO(); DS_DM_THAM_SO v_ds = new DS_DM_THAM_SO(); 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_tham_so.GetDataRow(v_row_index)["ID"].ToString()); if (v_id_gd_qd == v_id_qd_moi_lap) { break; } } m_grv_tham_so.FocusedRowHandle = v_row_index; }
private void save_data() { US_DM_THAM_SO v_us_dm_tham_so = new US_DM_THAM_SO(); form_2_us_obj(v_us_dm_tham_so); try { switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: v_us_dm_tham_so.BeginTransaction(); v_us_dm_tham_so.Insert(); v_us_dm_tham_so.CommitTransaction(); m_id_dm_tham_so_moi_tao = v_us_dm_tham_so.dcID; if (CHRM_BaseMessages.MsgBox_Confirm(CONST_ID_MSGBOX.QUESTION_INSER_DM_THAM_SO_THANH_CONG_TIEP_TUC_INSERT_YN) == true) { refresh_form(); } else { this.Close(); } break; case DataEntryFormMode.UpdateDataState: v_us_dm_tham_so.dcID = m_id_dm_tham_so_4_update; v_us_dm_tham_so.BeginTransaction(); v_us_dm_tham_so.Update(); v_us_dm_tham_so.CommitTransaction(); CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_DU_LIEU_DA_DUOC_CAP_NHAT); this.Close(); break; default: break; } } catch (Exception v_e) { throw v_e; } }
//save data private void form_2_us_obj(US_DM_THAM_SO ip_us) { ip_us.strLOAI = m_txt_ten_tham_so.Text.Trim(); ip_us.dcSO_TIEN = CIPConvert.ToDecimal(m_txt_gia_tri_tham_so.Text.Trim()); }
private void load_data_2_grid() { CHRMCommon.make_stt(m_grv_tham_so); //US_DUNG_CHUNG v_us = new US_DUNG_CHUNG(); //DataSet v_ds = new DataSet(); //v_ds.Tables.Add(new DataTable()); //throw new Exception("Sua lai khong dung FillDataSetWithTableName nua nhe"); //v_us.FillDatasetWithTableName(v_ds, "DM_THAM_SO US_DM_THAM_SO v_us = new US_DM_THAM_SO(); DS_DM_THAM_SO v_ds = new DS_DM_THAM_SO(); v_us.FillDataset(v_ds); m_grc_tham_so.DataSource = v_ds.Tables[0]; }
void m_cmd_update_Click(object sender, EventArgs e) { try { decimal v_id_dm_tham_so = CIPConvert.ToDecimal(m_grv_tham_so.GetRowCellValue(m_grv_tham_so.FocusedRowHandle, "ID")); if (v_id_dm_tham_so > 0) { US_DM_THAM_SO v_us = new US_DM_THAM_SO(v_id_dm_tham_so); f108_dm_tham_so_de v_frm = new f108_dm_tham_so_de(); v_frm.display_4_update(v_us); load_data_2_grid(); focus_new_row_created(v_id_dm_tham_so); } 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); } }