Sha256: cb605ee8d1ee12b89c87d7133b9b41d92a7128d42a49e578885a6618ce6a97d1
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true require 'win32api' class MasterInputFormControllerEdit def initialize(parent_controller, item) @parent_controller = parent_controller @item = item @author_rep = MasterDBDataSource.new end def set_view(view) @view = view end def on_view_created # begin # @student_rep = StudentRepository.new(DBSourceAdapter.new) # rescue Mysql2::Error::ConnectionError # on_db_conn_error # end # @item = @author_rep.get(@item_id) # @view.make_readonly(:git, :telegram, :email, :phone) populate_fields(@item) end def populate_fields(item) @view.set_value(:first_name, item.first_name) @view.set_value(:last_name, item.last_name) @view.set_value(:father_name, item.father_name) end def process_fields(fields) begin item = Master.new(@item.master_id, *fields.values) item = @author_rep.change(item) @parent_controller.state_notifier.replace(@item, item) @view.close rescue ArgumentError => e api = Win32API.new('user32', 'MessageBox', ['L', 'P', 'P', 'L'], 'I') api.call(0, e.message, 'Error', 0) end end private def on_db_conn_error api = Win32API.new('user32', 'MessageBox', ['L', 'P', 'P', 'L'], 'I') api.call(0, "No connection to DB", "Error", 0) @view.close end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jewerly_system-1.0.0 | lib/source/master/controllers/master_input_form_controller_edit.rb |