/// <summary> /// 得到新增EquipmentFrock /// </summary> public string GetEquipmentFrock_AddSQL(EquipmentFrock EquipmentFrock) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [EquipmentFrock]("); strSql.Append("EquipmentFrockGuID,EquipmentGuID,ProductClass,WorkEfficiency,EquipmentStuff,EquipmentFormal,FrockSource"); strSql.Append(")"); strSql.Append(" values ("); strSql.Append("'" + EquipmentFrock.EquipmentFrockGuID + "',"); strSql.Append("'" + EquipmentFrock.EquipmentGuID + "',"); strSql.Append("'" + EquipmentFrock.ProductClass + "',"); strSql.Append("'" + EquipmentFrock.WorkEfficiency + "',"); strSql.Append("'" + EquipmentFrock.EquipmentStuff + "',"); strSql.Append("'" + EquipmentFrock.EquipmentFormal + "',"); strSql.Append("'" + EquipmentFrock.FrockSource + "'"); strSql.Append(")"); return(strSql.ToString()); }
///<summary> /// 保存数据 /// </summary> /// <param name="pObj">信息集实体类</param> /// <returns>返回保存成功(true)或失败(false)</returns> public void SaveBill(Equipment Equipment, EquipmentDie EquipmentDie, EquipmentFrock EquipmentFrock, EquipmentGage EquipmentGage, EquipmentOffice EquipmentOffice, EquipmentInformation EquipmentInformation) { CommonInterface pComm = CommonFactory.CreateInstance(CommonData.sql); try { pComm.BeginTrans(); //保存单据主表数据 //先删除主表数据 string strDeleteSql = "Delete from Equipment where EquipmentGuid='" + Equipment.EquipmentGuID + "'"; pComm.Execute(strDeleteSql); //插入Equipment数据 string strInsertSql = GetEquipment_AddSQL(Equipment); pComm.Execute(strInsertSql); switch (Equipment.EquipmentType) { case "1": //删除EquipmentDie表 strDeleteSql = "Delete from EquipmentDie where EquipmentGuid='" + Equipment.EquipmentGuID + "'"; pComm.Execute(strDeleteSql); //插入EquipmentDie数据 strInsertSql = GetEquipmentDie_AddSQL(EquipmentDie); pComm.Execute(strInsertSql); break; case "2": //删除EquipmentGage表 strDeleteSql = "Delete from EquipmentGage where EquipmentGuid='" + Equipment.EquipmentGuID + "'"; pComm.Execute(strDeleteSql); //插入EquipmentGage数据 strInsertSql = GetEquipmentGage_AddSQL(EquipmentGage); pComm.Execute(strInsertSql); break; case "3": //删除EquipmentInformation表 strDeleteSql = "Delete from EquipmentInformation where EquipmentGuid='" + Equipment.EquipmentGuID + "'"; pComm.Execute(strDeleteSql); //插入EquipmentInformation数据 strInsertSql = GetEquipmentInformation_AddSQL(EquipmentInformation); pComm.Execute(strInsertSql); break; case "4": //删除EquipmentOffice表 strDeleteSql = "Delete from EquipmentOffice where EquipmentGuid='" + Equipment.EquipmentGuID + "'"; pComm.Execute(strDeleteSql); //插入EquipmentOffice数据 strInsertSql = GetEquipmentOffice_AddSQL(EquipmentOffice); pComm.Execute(strInsertSql); break; case "5": //删除EquipmentFrock表 strDeleteSql = "Delete from EquipmentFrock where EquipmentGuid='" + Equipment.EquipmentGuID + "'"; pComm.Execute(strDeleteSql); //插入EquipmentFrock数据 strInsertSql = GetEquipmentFrock_AddSQL(EquipmentFrock); pComm.Execute(strInsertSql); break; } pComm.CommitTrans(); } catch (Exception e) { pComm.RollbackTrans(); pComm.Close(); throw e; } }