public Assetsetupdetail CreateAssetsetupdetail(Assetsetupdetail info) { try { Management.BeginTransaction(); Management.CreateAssetsetupdetail(info); Management.Commit(); } catch { Management.Rollback(); throw; } return info; }
public Assetsetupdetail CreateAssetsetupdetail(Assetsetupdetail info) { try { string sqlCommand = @"INSERT INTO ""ASSETSETUPDETAIL"" (""DETAILID"",""SETUPID"",""ASSETNO"",""PLANSETUPDATE"",""ACTUALSETUPDATE"",""SETUPCONTENT"") VALUES (:Detailid,:Setupid,:Assetno,:Plansetupdate,:Actualsetupdate,:Setupcontent)"; this.Database.AddInParameter(":Detailid", info.Detailid);//DBType:VARCHAR2 this.Database.AddInParameter(":Setupid", info.Setupid);//DBType:VARCHAR2 this.Database.AddInParameter(":Assetno", info.Assetno);//DBType:VARCHAR2 this.Database.AddInParameter(":Plansetupdate", info.Plansetupdate);//DBType:DATE this.Database.AddInParameter(":Actualsetupdate", info.Actualsetupdate);//DBType:DATE this.Database.AddInParameter(":Setupcontent", info.Setupcontent);//DBType:NVARCHAR2 this.Database.ExecuteNonQuery(sqlCommand); } finally { this.Database.ClearParameter(); } return info; }
public Assetsetupdetail UpdateAssetsetupdetailByDetailid(Assetsetupdetail info) { try { this.Database.AddInParameter(":Detailid", info.Detailid);//DBType:VARCHAR2 this.Database.AddInParameter(":Setupid", info.Setupid);//DBType:VARCHAR2 this.Database.AddInParameter(":Assetno", info.Assetno);//DBType:VARCHAR2 this.Database.AddInParameter(":Plansetupdate", info.Plansetupdate);//DBType:DATE this.Database.AddInParameter(":Actualsetupdate", info.Actualsetupdate);//DBType:DATE this.Database.AddInParameter(":Setupcontent", info.Setupcontent);//DBType:NVARCHAR2 string sqlCommand = @"UPDATE ""ASSETSETUPDETAIL"" SET ""SETUPID""=:Setupid , ""ASSETNO""=:Assetno , ""PLANSETUPDATE""=:Plansetupdate , ""ACTUALSETUPDATE""=:Actualsetupdate , ""SETUPCONTENT""=:Setupcontent WHERE ""DETAILID""=:Detailid"; 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 (SetupDetail.Where(p => p.Assetno == assetNo).Count() == 0) { assetNos.Add(assetNo); } } var assetInfos = AssetService.RetrieveAssetByAssetno(assetNos); if(assetInfos.Count>0) { foreach (var entity in assetInfos) { Assetsetupdetail data = new Assetsetupdetail(); 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;//合同明细编号 SetupDetail.Add(data); } BindDetails(); } } }