public OpResult SaveData(Entity.ProductDataSql obj, int productId)
        {
            if (obj.Id == 0)
            {
                if (ProductDataVerRepository.IsExists(o => o.ProductId == productId && o.Status == 0 && o.DataId != obj.DataId))
                {
                    return(OpResult.Fail("已存在未发布的版本"));
                }
                obj.DataId    = obj.DataId ?? CommonService.GUID;
                obj.CreateDT  = DateTime.Now;
                obj.CreateUID = CurrentUser.UID;
                obj.RunSort   = ProductDataSqlRepository.GetMaxInt(o => (int?)o.RunSort, whereLambda: o => o.DataId == obj.DataId);
                ProductDataSqlRepository.Add(obj, false);
            }
            else
            {
                var menu = ProductDataSqlRepository.Get(obj.Id);
                if (ProductDataSqlRepository.IsExists(o => o.MenuId == obj.MenuId && o.DataId == menu.DataId && o.Id != obj.Id))
                {
                    return(OpResult.Fail("该菜单模块已存在"));
                }
                menu.RunSql = obj.RunSql;
                obj.DataId  = menu.DataId;
            }
            var model = ProductDataVerRepository.Find(o => o.DataId == obj.DataId);

            if (model != null)
            {
                model.UpdateDT  = DateTime.Now;
                model.UpdateUID = CurrentUser.UID;
            }
            else
            {
                ProductDataVerRepository.Add(new Entity.ProductDataVer()
                {
                    DataId    = obj.DataId,
                    ProductId = productId,
                    ModuleId  = System.Web.HttpContext.Current.Request["modelId"],
                    CreateDT  = obj.CreateDT,
                    UpdateDT  = obj.CreateDT,
                    UpdateUID = obj.CreateUID,
                    CreateUID = obj.CreateUID,
                }, false);
            }
            ProductDataSqlRepository.SaveChanges();
            return(OpResult.Success());
        }
 public OpResult SaveOrUpdate(Entity.ProductDataVer obj)
 {
     if (obj.Id == 0)
     {
         obj.DataId    = CommonService.GUID;
         obj.CreateDT  = DateTime.Now;
         obj.UpdateDT  = obj.CreateDT;
         obj.UpdateUID = CurrentUser.UID;
         obj.CreateUID = obj.UpdateUID;
         ProductDataVerRepository.Add(obj, false);
     }
     else
     {
         var product = ProductDataVerRepository.Find(o => o.Id == obj.Id);
         product.UpdateUID = CurrentUser.UID;
         product.UpdateDT  = DateTime.Now;
     }
     ProductDataVerRepository.SaveChanges();
     return(OpResult.Success());
 }