private void NewTerminal() { TB_Terminal t = null; // 如果没有输入Sim卡号码则查询是否具有相同终端号码的记录 if (string.IsNullOrEmpty(txtSimcard.Value.Trim())) { t = TerminalInstance.Find(f => f.Number.Equals(txtNumber.Value.Trim()) && f.Delete == false); } else { // 如果有Sim卡号码输入则查询终端或Sim卡号码是否有相同记录存在 t = TerminalInstance.Find(f => (f.Number.Equals(txtNumber.Value.Trim()) || f.Sim.Equals(txtSimcard.Value.Trim())) && f.Delete == false); } if (null != t) { ShowNotification("./terminal_register.aspx", "Terminal exist: " + TerminalInstance.ToString(t), false); } else { t = TerminalInstance.GetObject(); BuildObject(t); TerminalInstance.Add(t); SaveHistory(new TB_AccountHistory { ActionId = ActionInstance.Find(f => f.Name.Equals("AddTerminal")).id, ObjectA = TerminalInstance.ToString(t) }); ShowNotification("./terminal_list.aspx", "You added a new terminal: " + TerminalInstance.ToString(t)); } }