private void txtMaterialCode_Leave(object sender, EventArgs e) { if (_originalMaterialCode != txtMaterialCode.Text) { Material entity = new Material(); entity.material_code = txtMaterialCode.Text; entity = ServiceProvider.MaterialService.FindByCode(entity, false); if (entity != null) { txtMaterialName.Text = entity.material_name; //txtLotNo.Text = this.GetLastLotNo().ToString(); UOM entityUOM = new UOM() { uom_id = entity.uom_id_receive.Value }; entityUOM = ServiceProvider.UOMService.FindByKeys(entityUOM, false); if (entityUOM != null) lblUOM.Text = entityUOM.uom_name; } else { txtMaterialName.Text = string.Empty; txtMaterialCode.Text = string.Empty; lblUOM.Text = string.Empty; } _originalMaterialCode = txtMaterialCode.Text; } }
private void btnLOV_Click(object sender, EventArgs e) { if (ddlPeriod.SelectedIndex != 0) { object result = base.OpenPopup<InMaterial>(); if (result != null) { Material entity = (Material)result; txtMaterialCode.Text = entity.material_code.ToString(); txtMaterialName.Text = entity.material_name.ToString(); baseAddEditMasterDetail.FormKeyCode = entity.material_id.ToString(); UOM entityUOM = new UOM() { uom_id = entity.uom_id_receive.Value }; entityUOM = ServiceProvider.UOMService.FindByKeys(entityUOM, false); if (entityUOM != null) lblUOM.Text = entityUOM.uom_name; } } else { //Error } }