public static int Save(EntityObject_MCE_B_ASSETS_CHECK_TYPE obj, IDbTransaction trans) { //平台自动生成代码 obj.ID = Guid.NewGuid().ToString(); string sSql = "insert into MCE_B_ASSETS_CHECK_TYPE( TYPE_ID, BASE_ID, ID) values ( :TYPE_ID, :BASE_ID, :ID)"; #region Parameters Block OracleParameter[] parameters = new OracleParameter[3]; parameters[0] = new OracleParameter(); parameters[0].ParameterName = ":TYPE_ID"; parameters[0].Size = 36; parameters[0].OracleType = System.Data.OracleClient.OracleType.Char; parameters[0].Value = obj.TYPE_ID == null ? String.Empty:obj.TYPE_ID; parameters[1] = new OracleParameter(); parameters[1].ParameterName = ":BASE_ID"; parameters[1].Size = 36; parameters[1].OracleType = System.Data.OracleClient.OracleType.Char; parameters[1].Value = obj.BASE_ID == null ? String.Empty:obj.BASE_ID; parameters[2] = new OracleParameter(); parameters[2].ParameterName = ":ID"; parameters[2].Size = 36; parameters[2].OracleType = System.Data.OracleClient.OracleType.Char; parameters[2].Value = obj.ID == null ? String.Empty:obj.ID; #endregion return(IDALProvider.IDAL.ExecuteNonQuery(sSql, parameters, trans)); }
public static int Update(EntityObject_MCE_B_ASSETS_CHECK_TYPE obj, IDbTransaction trans) { //平台自动生成代码 #region Parameters Block OracleParameter[] parameters = null; #endregion string sSql = "update MCE_B_ASSETS_CHECK_TYPE set "; sSql += PrepareUpdate(obj, out parameters, true); sSql += " where ID = :U_ID "; return(IDALProvider.IDAL.ExecuteNonQuery(sSql, parameters, trans)); }
public BizLogicMsg Save_CheckType_Ext(string strBaseID, List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { CauseObject_MCE_B_ASSETS_CHECK_TYPE pDetail = new CauseObject_MCE_B_ASSETS_CHECK_TYPE(); pDetail.BASE_ID = strBaseID; HelperObject_MCE_B_ASSETS_CHECK_TYPE.Delete(pDetail, transaction); if (listID != null && listID.Count > 0) { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_CHECK_TYPE entity_D = new EntityObject_MCE_B_ASSETS_CHECK_TYPE(); entity_D.BASE_ID = strBaseID; entity_D.TYPE_ID = strID; HelperObject_MCE_B_ASSETS_CHECK_TYPE.Save(entity_D, transaction); } } transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_CHECK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CHECK>(ServiceUri)) { return(smgr.Service.Save_CheckType_Ext(strBaseID, listID)); } } }
public static int Delete(EntityObject_MCE_B_ASSETS_CHECK_TYPE obj, IDbTransaction trans) { //平台自动生成代码 string sSql = "delete from MCE_B_ASSETS_CHECK_TYPE where ID = :ID "; #region Parameters Block OracleParameter[] parameters = new OracleParameter[1]; parameters[0] = new OracleParameter(); parameters[0].ParameterName = ":ID"; parameters[0].Size = 36; parameters[0].OracleType = System.Data.OracleClient.OracleType.Char; parameters[0].Value = obj.ID; #endregion return(IDALProvider.IDAL.ExecuteNonQuery(sSql, parameters, trans)); }
public static int Update(EntityObject_MCE_B_ASSETS_CHECK_TYPE obj, CauseObject_MCE_B_ASSETS_CHECK_TYPE cause, IDbTransaction trans) { //平台自动生成代码 #region Parameters Block List <OracleParameter> list = new List <OracleParameter>(); OracleParameter[] parameters = null; #endregion string sSql = "update MCE_B_ASSETS_CHECK_TYPE set "; sSql += PrepareUpdate(obj, out parameters, false); list.AddRange(parameters); sSql += " where 1=1 "; sSql += PrepareCause(cause, out parameters); list.AddRange(parameters); parameters = list.ToArray(); return(IDALProvider.IDAL.ExecuteNonQuery(sSql, parameters, trans)); }
public static string PrepareUpdate(EntityObject_MCE_B_ASSETS_CHECK_TYPE obj, out OracleParameter[] parameters, bool appendpk) { //平台自动生成代码 List <string> strBuf = new List <string>(); ArrayList paramList = new ArrayList(); OracleParameter param = null; #region Push Block if (!obj.IsNotUpdate("TYPE_ID")) { strBuf.Add(" MCE_B_ASSETS_CHECK_TYPE.TYPE_ID = :U_TYPE_ID"); param = new OracleParameter(); param.ParameterName = ":U_TYPE_ID"; param.OracleType = System.Data.OracleClient.OracleType.Char; param.Size = 36; param.Value = string.IsNullOrEmpty(obj.TYPE_ID) ? string.Empty : obj.TYPE_ID; paramList.Add(param); } if (!obj.IsNotUpdate("BASE_ID")) { strBuf.Add(" MCE_B_ASSETS_CHECK_TYPE.BASE_ID = :U_BASE_ID"); param = new OracleParameter(); param.ParameterName = ":U_BASE_ID"; param.OracleType = System.Data.OracleClient.OracleType.Char; param.Size = 36; param.Value = string.IsNullOrEmpty(obj.BASE_ID) ? string.Empty : obj.BASE_ID; paramList.Add(param); } //pk here if (appendpk) { param = new OracleParameter(); param.ParameterName = ":U_ID"; param.OracleType = System.Data.OracleClient.OracleType.Char; param.Size = 36; param.Value = obj.ID; paramList.Add(param); } #endregion parameters = new OracleParameter[paramList.Count]; paramList.CopyTo(parameters); return(string.Join(", ", strBuf.ToArray())); }
public static EntityObject_MCE_B_ASSETS_CHECK_TYPE Get(EntityObject_MCE_B_ASSETS_CHECK_TYPE obj) { //平台自动生成代码 string sSql = "select TYPE_ID, BASE_ID, ID from MCE_B_ASSETS_CHECK_TYPE where ID = :ID "; #region Parameters Block OracleParameter[] parameters = new OracleParameter[1]; parameters[0] = new OracleParameter(); parameters[0].ParameterName = ":ID"; parameters[0].Size = 36; parameters[0].OracleType = System.Data.OracleClient.OracleType.Char; parameters[0].Value = obj.ID; #endregion #region Push Block EntityObject_MCE_B_ASSETS_CHECK_TYPE dataObj = null; ArrayList objArray = new ArrayList(); IDbConnection connection = IDALProvider.IDAL.PopConnection(); IDataReader sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, connection); while (sqlReader.Read()) { dataObj = new EntityObject_MCE_B_ASSETS_CHECK_TYPE(); if (!sqlReader.IsDBNull(0)) { dataObj.TYPE_ID = sqlReader.GetString(0); } if (!sqlReader.IsDBNull(1)) { dataObj.BASE_ID = sqlReader.GetString(1); } if (!sqlReader.IsDBNull(2)) { dataObj.ID = sqlReader.GetString(2); } objArray.Add(dataObj); } sqlReader.Close(); IDALProvider.IDAL.PushConnection(connection); #endregion EntityObject_MCE_B_ASSETS_CHECK_TYPE[] objs = new EntityObject_MCE_B_ASSETS_CHECK_TYPE[objArray.Count]; objArray.CopyTo(0, objs, 0, objs.Length); return(objs.Length == 0 ? null:objs[0]); }