public Assetmaintaindetail CreateAssetmaintaindetail(Assetmaintaindetail info)
 {
     try
     {
         Management.BeginTransaction();
         Management.CreateAssetmaintaindetail(info);
         Management.Commit();
     }
     catch
     {
         Management.Rollback();
         throw;
     }
     return info;
 }
        public Assetmaintaindetail CreateAssetmaintaindetail(Assetmaintaindetail info)
        {
            try
            {
                string sqlCommand = @"INSERT INTO ""ASSETMAINTAINDETAIL"" (""DETAILID"",""ASSETMAINTAINID"",""ASSETNO"",""PLANDATE"",""ACTUALDATE"",""MAINTAINCONTENT"") VALUES (:Detailid,:Assetmaintainid,:Assetno,:Plandate,:Actualdate,:Maintaincontent)";
                this.Database.AddInParameter(":Detailid", info.Detailid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Assetmaintainid", info.Assetmaintainid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Assetno", info.Assetno);//DBType:VARCHAR2
                this.Database.AddInParameter(":Plandate", info.Plandate);//DBType:DATE
                this.Database.AddInParameter(":Actualdate", info.Actualdate);//DBType:DATE
                this.Database.AddInParameter(":Maintaincontent", info.Maintaincontent);//DBType:NVARCHAR2
                this.Database.ExecuteNonQuery(sqlCommand);

            }
            finally
            {
                this.Database.ClearParameter();
            }
            return info;
        }
 protected void ucSelectedMultiAssets_SelectAssetChange(object sender, EventArgs e)
 {
     if (ucSelectedMultiAssets.AssetIds.Count > 0)
     {
         //更新设备列表
         var assetNos = new List<string>();
         foreach (var assetNo in ucSelectedMultiAssets.AssetIds)
         {
             if (Details.Where(p => p.Assetno == assetNo).Count() == 0) { assetNos.Add(assetNo); }
         }
         var assetInfos = AssetService.RetrieveAssetByAssetno(assetNos);
         if (assetInfos.Count > 0)
         {
             foreach (var entity in assetInfos)
             {
                 var data = new Assetmaintaindetail();
                 data.Detailid = Guid.NewGuid().ToString("N");
                 data.Assetno = entity.Assetno;//设备编号
                 data.Assetcategoryid = entity.Assetcategoryid;//设备类别
                 data.Assetname = entity.Assetname;//设备名称
                 //data.Storage = entity.Storage;//存放地点
                 data.State = entity.State;//设备状态
                 //data.Depreciationyear = entity.Depreciationyear;//折旧年限
                 data.Unitprice = entity.Unitprice;//单价
                 data.Brand = entity.Brand;//品牌
                 //data.Managemode = entity.Managemode;//管理模式,托管:0自管:1
                 data.Financecategory = entity.Financecategory;//财务类别(A帐:0B帐:1)
                 //data.Supplierid = entity.Supplierid;//供应商
                 data.Purchasedate = entity.Purchasedate;//购入日期
                 //data.Expireddate = entity.Expireddate;//折旧到期日期
                 //data.Assetspecification = entity.Assetspecification;//设备规格
                 //data.Storageflag = entity.Storageflag;//存放地点标识来源
                 //data.Subcompany = entity.Subcompany;//分公司
                 //data.Contractid = entity.Contractid;//合同编号
                 //data.Contractdetailid = entity.Contractdetailid;//合同明细编号
                 Details.Add(data);
             }
             LoadDetailList();
         }
     }
 }
 public Assetmaintaindetail UpdateAssetmaintaindetailByDetailid(Assetmaintaindetail info)
 {
     try
     {
         this.Database.AddInParameter(":Detailid", info.Detailid);//DBType:VARCHAR2
         this.Database.AddInParameter(":Assetmaintainid", info.Assetmaintainid);//DBType:VARCHAR2
         this.Database.AddInParameter(":Assetno", info.Assetno);//DBType:VARCHAR2
         this.Database.AddInParameter(":Plandate", info.Plandate);//DBType:DATE
         this.Database.AddInParameter(":Actualdate", info.Actualdate);//DBType:DATE
         this.Database.AddInParameter(":Maintaincontent", info.Maintaincontent);//DBType:NVARCHAR2
         string sqlCommand = @"UPDATE ""ASSETMAINTAINDETAIL"" SET  ""ASSETMAINTAINID""=:Assetmaintainid , ""ASSETNO""=:Assetno , ""PLANDATE""=:Plandate , ""ACTUALDATE""=:Actualdate , ""MAINTAINCONTENT""=:Maintaincontent WHERE  ""DETAILID""=:Detailid";
         this.Database.ExecuteNonQuery(sqlCommand);
     }
     finally
     {
         this.Database.ClearParameter();
     }
     return info;
 }