Example #1
0
        /// <summary>验证并修补数据,通过抛出异常的方式提示验证失败。</summary>
        /// <param name="isNew">是否插入</param>
        public override void Valid(Boolean isNew)
        {
            // 如果没有脏数据,则不需要进行任何处理
            if (!HasDirty)
            {
                return;
            }

            var app = App;

            if (app != null)
            {
                if (Name.IsNullOrEmpty())
                {
                    Name = app.DisplayName ?? app.Name;
                }
                if (!app.Category.IsNullOrEmpty())
                {
                    Category = app.Category;
                }
            }

            if (!isNew)
            {
                Nodes = AppDeployNode.FindAllByDeployId(Id).Count;
            }
        }
Example #2
0
        /// <summary>修正数据</summary>
        /// <returns></returns>
        public Int32 Fix()
        {
            var rs = 0;

            var list = AppDeployNode.FindAllByDeployId(Id);

            Nodes = list.Count;

            rs += Update();

            return(rs);
        }
Example #3
0
        /// <summary>刷新</summary>
        public void Refresh()
        {
            var list = AppDeployNode.FindAllByAppId(Id);

            Nodes = list.Count(e => e.Enable);

            if (Version.IsNullOrEmpty())
            {
                var list2 = AppDeployVersion.FindAllByAppId(Id, 100);
                list2 = list2.Where(e => e.Enable).ToList();
                if (list2.Count == 0)
                {
                    list2 = AppDeployVersion.Search(Id, null, true, DateTime.MinValue, DateTime.MinValue, null, null);
                }
                if (list2.Count > 0)
                {
                    Version = list2[0].Version;
                }
            }
        }