private void p_BtnUrgentClicked(object sender, EventArgs e) { LogPanel logPanel = sender as LogPanel; var log = db.DepartmentLog.FirstOrDefault(x => x.id == logPanel.id); if (MConvert <bool> .ToTypeOrDefault(log.done, false)) { if (BathClass.printAskMsg("事件已完成,加急将会把事件改成未完成状态,确定继续?") != DialogResult.Yes) { return; } log.done = false; logPanel.set_btnDone_text("已完成"); } if (!MConvert <bool> .ToTypeOrDefault(log.urgent, false)) { log.urgent = true; log.urgentDate = DateTime.Now; } else { log.urgent = false; } db.SubmitChanges(); bool done = MConvert <bool> .ToTypeOrDefault(log.done, false); bool urgent = MConvert <bool> .ToTypeOrDefault(log.urgent, false); logPanel.set_panel_status(done, urgent, log.doneDate, log.urgentDate, log.dueTime); }