private void NewType() { var t = TypeInstance.GetObject(); BuildType(t); var check = TypeInstance.Find(f => f.Name.Equals(t.Name)); if (null != check) { ShowNotification("./equipment_type.aspx", "Cannot add new Equipment type, The name of \"" + t.Name + "(" + t.Code + ")\" is exist.", false); return; } else { TypeInstance.Add(t); // 保存历史记录 SaveHistory(new TB_AccountHistory { ActionId = ActionInstance.Find(f => f.Name.Equals("AddEquipmentType")).id, ObjectA = "[id=" + t.id + "] " + t.Name + ", " + t.Code }); ShowNotification("./equipment_type.aspx", "You have added a new Equipment type: " + t.Name + "(" + t.Code + ")."); } }
private void ShowEdit() { var t = TypeInstance.Find(f => f.id == ParseInt(Utility.Decrypt(hidID.Value))); if (null != t) { txtCode.Value = t.Code; txtName.Value = t.Name; imgImage.Src = t.Image; hidImage.Value = t.Image; cbNormalVehicle.Checked = t.IsVehicle == true; } else { ShowNotification("./equipment_type.aspx", "Error: Cannot edit null object of <a>Equipment Type</a>.", false); } }
private void EditType() { var t = TypeInstance.Find(f => f.id == ParseInt(Utility.Decrypt(hidID.Value))); if (null != t) { BuildType(t); Update(t); // 保存历史记录 SaveHistory(new TB_AccountHistory() { ActionId = ActionInstance.Find(f => f.Name.Equals("EditEquipmentType")).id, ObjectA = "[id=" + t.id + "] " + t.Name + ", " + t.Code }); ShowNotification("./equipment_type.aspx", "You changed the equipment type."); } else { ShowNotification("./equipment_type.aspx", "Error: paramenter error, cannot edit null object(equipment type).", false); } }