private void m_cbo_user_nhan_vien_dat_hang_SelectedValueChanged(object sender, EventArgs e) { if (m_cbo_user_nhan_vien_dat_hang.SelectedValue != null) { decimal ID_khach_hang = CIPConvert.ToDecimal(m_cbo_user_nhan_vien_dat_hang.SelectedValue.ToString()); if (ID_khach_hang <= 0) { m_txt_dien_thoai.Text = ""; m_txt_ho_ten_nguoi_dat_hang.Text = ""; m_cbo_dv_don_vi.SelectedIndex = 0; return; } US_DM_KHACH_HANG v_us = new US_DM_KHACH_HANG(ID_khach_hang); m_cbo_dv_don_vi.SelectedValue = CIPConvert.ToDecimal(v_us.dcDON_VI.ToString()); m_txt_ho_ten_nguoi_dat_hang.Text = v_us.strTEN_KHACH_HANG; m_txt_dien_thoai.Text = v_us.strDIEN_THOAI; load_data_2_grid_khach_hang_don_hang(); } }
private void insert_dm_khach_hang() { US_DUNG_CHUNG v_us = new US_DUNG_CHUNG(); DataSet v_ds = new DataSet(); v_ds.Tables.Add(new DataTable()); v_us.CheckEmailDanhMucKhachHang(v_ds, m_cbo_user_nhan_vien_dat_hang.Text); if (v_ds.Tables[0].Rows.Count > 0) { US_DM_KHACH_HANG v_us_dm_khach_hang = new US_DM_KHACH_HANG(CIPConvert.ToDecimal(m_cbo_user_nhan_vien_dat_hang.SelectedValue.ToString())); v_us_dm_khach_hang.dcDON_VI = CIPConvert.ToDecimal(m_cbo_dv_don_vi.SelectedValue.ToString()); v_us_dm_khach_hang.strDIEN_THOAI = m_txt_dien_thoai.Text; v_us_dm_khach_hang.strTEN_KHACH_HANG = m_txt_ho_ten_nguoi_dat_hang.Text; v_us_dm_khach_hang.Update(); } else { US_DM_KHACH_HANG v_us_dm_khach_hang = new US_DM_KHACH_HANG(); v_us_dm_khach_hang.dcDON_VI = CIPConvert.ToDecimal(m_cbo_dv_don_vi.SelectedValue.ToString()); v_us_dm_khach_hang.strDIEN_THOAI = m_txt_dien_thoai.Text; v_us_dm_khach_hang.strTEN_KHACH_HANG = m_txt_ho_ten_nguoi_dat_hang.Text; v_us_dm_khach_hang.strEMAIL = m_cbo_user_nhan_vien_dat_hang.Text; v_us_dm_khach_hang.Insert(); load_data_to_cbo_user_nv(); m_cbo_user_nhan_vien_dat_hang.SelectedValue = v_us_dm_khach_hang.dcID; } }