private void button_Load_Click(object sender, EventArgs e) { DateTime bufferTime = Convert.ToDateTime(comboBox_Dates.SelectedItem); if (!Saved) { Form_Save_Attention FSA = new Form_Save_Attention(); FSA.StartPosition = FormStartPosition.CenterParent; FSA.ShowDialog(); if (FSA.DialogResult == DialogResult.Yes) { button_Save_Click(null, null); } else { Saved = true; BufferContainer = new InventorySystemContainer(); BufferContainer = null; BufferDate = DateTime.MinValue; } } else if (Saved && BufferContainer != null) { BufferContainer = new InventorySystemContainer(); BufferContainer = null; BufferDate = DateTime.MinValue; } ChosenDate = bufferTime; comboBox_Dates.SelectedItem = bufferTime; Set_dataGridView_List(); }
private void InventorySystemGUI_FormClosing(Object sender, FormClosingEventArgs e) { if (!Saved) { Form_Save_Attention FSA = new Form_Save_Attention(); FSA.StartPosition = FormStartPosition.CenterParent; FSA.ShowDialog(); if (FSA.DialogResult == DialogResult.Yes) { button_Save_Click(null, null); } else { Saved = true; BufferContainer = new InventorySystemContainer(); BufferContainer = null; BufferDate = DateTime.MinValue; } } }