public ConsumableChange(string stConsumableID, ConsumableDetail DetailDlg) { InitializeComponent(); m_stConsumableID = stConsumableID; m_DetailDlg = DetailDlg; IDtextBox.Enabled = false; NametextBox.Enabled = false; LifttimetextBox.Enabled = false; LastChangetimetextBox.Enabled = false; WorkingtimetextBox.Enabled = false; string EXEPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string dbPath = EXEPath + "Demo.db3"; SQLiteDBHelper db = new SQLiteDBHelper(dbPath); string sql3 = "select max(id),ConsumableName,Lifetime,WorkingTime,Changetime from ConsumableLog where ConsumableID = " + stConsumableID; using (SQLiteDataReader reader = db.ExecuteReader(sql3, null)) { while (reader.Read()) { m_stConsumableName = reader["ConsumableName"].ToString(); m_stLifetime = reader["Lifetime"].ToString(); m_stLifetime = (Convert.ToInt32(m_stLifetime) / 60).ToString() + "小时(" + m_stLifetime + "分钟)"; m_stWorkingTime = reader["WorkingTime"].ToString() + "分钟"; m_stChangetime = reader["Changetime"].ToString(); IDtextBox.Text = stConsumableID; NametextBox.Text = m_stConsumableName; LifttimetextBox.Text = m_stLifetime; LastChangetimetextBox.Text = m_stChangetime; WorkingtimetextBox.Text = m_stWorkingTime; } } if (DetailDlg == null) { this.Text = m_stConsumableName + "易损件工作时间已经超过使用寿命,请及时更换!"; } else { this.Text = m_stConsumableName + "易损件更换"; } }
private void ConsumablelistView_DoubleClick(object sender, EventArgs e) { string stConsumableID = ""; lock (locker) { if (ConsumablelistView.Items.Count > 0) { stConsumableID = ConsumablelistView.SelectedItems[0].Text; } if (!string.IsNullOrEmpty(stConsumableID)) { ConsumableDetail dlg = new ConsumableDetail(stConsumableID) { StartPosition = FormStartPosition.CenterParent }; dlg.ShowDialog(); dlg.Dispose(); } } }