private void add_item() { if (!ControlUtility.ValidateControlEmpty(m_sle_mat_hang, m_txt_barcode, m_txt_gia_nhap, m_txt_gia_xuat_de_xuat, m_txt_thoi_gian_bao_hanh)) { XtraMessageBox.Show("Hoàn thiện dữ liệu trước", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (is_exist_barcode_in_csdl(m_txt_barcode.Text)) { XtraMessageBox.Show("Barcode đã tồn tại trong CSDL", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (is_exist_barcode_in_qua_trinh_nhap(m_txt_barcode.Text)) { XtraMessageBox.Show("Barcode đã tồn tại trong việc nhập vừa rồi", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DM_MAT_HANG obj_selected = (DM_MAT_HANG)m_sle_mat_hang.Properties.View.GetRow(m_sle_mat_hang.Properties.GetIndexByKeyValue(m_sle_mat_hang.EditValue)); BO_HANG item = new BO_HANG() { ID = 0, TEN_MAT_HANG = obj_selected.TEN_MAT_HANG, GIA_NHAP = (decimal)m_txt_gia_nhap.EditValue, GIA_XUAT_DE_XUAT = (decimal)m_txt_gia_xuat_de_xuat.EditValue, THOI_GIAN_BAO_HANH = (int)m_txt_thoi_gian_bao_hanh.EditValue, BARCODE = m_txt_barcode.Text.Trim(), ID_MAT_HANG = obj_selected.ID, NGAY_NHAP_HANG = m_dat_ngay_nhap_kho.DateTime, ID_KHO = (long)m_le_nhap_vao_kho.EditValue }; m_lst_hang.Add(item); fill_data_to_grid_hang(); reset_nhap_hang(); }
private void fill_data_suggest(DM_MAT_HANG ip_obj) { m_txt_gia_nhap.EditValue = ip_obj.GIA_NHAP_DE_XUAT; m_txt_gia_xuat_de_xuat.EditValue = ip_obj.GIA_XUAT_DE_XUAT; m_txt_thoi_gian_bao_hanh.EditValue = ip_obj.THOI_GIAN_BAO_HANH_DE_XUAT; }