예제 #1
0
        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 + ").");
            }
        }