コード例 #1
0
ファイル: AssetBLL.cs プロジェクト: franknew/RiskMgr
        public List <Asset> Query(AssetQueryForm form)
        {
            AssetDao dao = new AssetDao();

            form.IsDeleted = 0;
            return(dao.Query(form));
        }
コード例 #2
0
ファイル: AssetBLL.cs プロジェクト: franknew/RiskMgr
        public Asset Save(Asset asset)
        {
            AssetDao dao = new AssetDao();
            Asset    a   = null;

            if (string.IsNullOrEmpty(asset.ID))
            {
                asset.Enabled   = 1;
                asset.IsDeleted = 0;
                dao.Add(asset);
                a = asset;
            }
            else
            {
                a = dao.Query(new AssetQueryForm
                {
                    ID = asset.ID,
                }).FirstOrDefault();
                if (a != null)
                {
                    dao.Update(new AssetUpdateForm
                    {
                        Entity = new Asset
                        {
                            Usage       = asset.Usage,
                            Address     = asset.Address,
                            Area        = asset.Area,
                            RegPrice    = asset.RegPrice,
                            LastUpdator = asset.LastUpdator,
                            Remark      = asset.Remark,
                        },
                        AssetQueryForm = new AssetQueryForm {
                            ID = a.ID, Enabled = 1
                        },
                    });
                }
                else
                {
                    asset.Enabled   = 1;
                    asset.IsDeleted = 0;
                    dao.Add(asset);
                    a = asset;
                }
            }
            return(a);
        }
コード例 #3
0
ファイル: AssetBLL.cs プロジェクト: franknew/RiskMgr
 public Asset Save(Asset asset)
 {
     AssetDao dao = new AssetDao();
     Asset a = null;
     if (string.IsNullOrEmpty(asset.ID))
     {
         asset.Enabled = 1;
         asset.IsDeleted = 0;
         dao.Add(asset);
         a = asset;
     }
     else
     {
         a = dao.Query(new AssetQueryForm
         {
             ID = asset.ID,
         }).FirstOrDefault();
         if (a != null)
         {
             dao.Update(new AssetUpdateForm
             {
                 Entity = new Asset
                 {
                     Usage = asset.Usage,
                     Address = asset.Address,
                     Area = asset.Area,
                     RegPrice = asset.RegPrice,
                     LastUpdator = asset.LastUpdator,
                     Remark = asset.Remark,
                 },
                 AssetQueryForm = new AssetQueryForm { ID = a.ID, Enabled = 1 },
             });
         }
         else
         {
             asset.Enabled = 1;
             asset.IsDeleted = 0;
             dao.Add(asset);
             a = asset;
         }
     }
     return a;
 }
コード例 #4
0
ファイル: AssetBLL.cs プロジェクト: franknew/RiskMgr
 public List<Asset> Query(AssetQueryForm form)
 {
     AssetDao dao = new AssetDao();
     form.IsDeleted = 0;
     return dao.Query(form);
 }