public static string PrepareCause(CauseObject_MCE_B_ASSETS_CHECK_TYPE cause, out OracleParameter[] parameters) { //平台自动生成代码 System.Text.StringBuilder strBuf = new System.Text.StringBuilder(); ArrayList paramList = new ArrayList(); OracleParameter param = null; #region Push Block if (!string.IsNullOrEmpty(cause.TYPE_ID)) { strBuf.Append(" And MCE_B_ASSETS_CHECK_TYPE.TYPE_ID ").Append((cause.TYPE_ID.StartsWith("%") || cause.TYPE_ID.EndsWith("%")) ? " like " : " = ").Append(" :C_TYPE_ID"); param = new OracleParameter(); param.ParameterName = ":C_TYPE_ID"; param.OracleType = System.Data.OracleClient.OracleType.Char; param.Size = 36; param.Value = cause.TYPE_ID; paramList.Add(param); } if (cause.HasINValue("TYPE_ID")) { strBuf.Append(cause.GetINSQL("MCE_B_ASSETS_CHECK_TYPE", "TYPE_ID")); } if (!string.IsNullOrEmpty(cause.BASE_ID)) { strBuf.Append(" And MCE_B_ASSETS_CHECK_TYPE.BASE_ID ").Append((cause.BASE_ID.StartsWith("%") || cause.BASE_ID.EndsWith("%")) ? " like " : " = ").Append(" :C_BASE_ID"); param = new OracleParameter(); param.ParameterName = ":C_BASE_ID"; param.OracleType = System.Data.OracleClient.OracleType.Char; param.Size = 36; param.Value = cause.BASE_ID; paramList.Add(param); } if (cause.HasINValue("BASE_ID")) { strBuf.Append(cause.GetINSQL("MCE_B_ASSETS_CHECK_TYPE", "BASE_ID")); } if (!string.IsNullOrEmpty(cause.ID)) { strBuf.Append(" And MCE_B_ASSETS_CHECK_TYPE.ID ").Append((cause.ID.StartsWith("%") || cause.ID.EndsWith("%")) ? " like " : " = ").Append(" :C_ID"); param = new OracleParameter(); param.ParameterName = ":C_ID"; param.OracleType = System.Data.OracleClient.OracleType.Char; param.Size = 36; param.Value = cause.ID; paramList.Add(param); } if (cause.HasINValue("ID")) { strBuf.Append(cause.GetINSQL("MCE_B_ASSETS_CHECK_TYPE", "ID")); } if (!string.IsNullOrEmpty(cause.GetCustomCondition())) { strBuf.Append(cause.GetCustomCondition()); } #endregion parameters = new OracleParameter[paramList.Count]; paramList.CopyTo(parameters); return(strBuf.ToString()); }
public static int Delete(CauseObject_MCE_B_ASSETS_CHECK_TYPE cause, IDbTransaction trans) { //平台自动生成代码 #region Parameters Block OracleParameter[] parameters = null; #endregion string sSql = "delete from MCE_B_ASSETS_CHECK_TYPE where (1=1)"; sSql += PrepareCause(cause, out parameters); 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 int DeleteByTrans2(CauseObject_MCE_B_ASSETS_CHECK_TYPE cause, IDbTransaction transaction) { if (LocalMode) { return(HelperObject_MCE_B_ASSETS_CHECK_TYPE.Delete(cause, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
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 DisplayObject_MCE_B_ASSETS_CHECK_TYPE[] Query(CauseObject_MCE_B_ASSETS_CHECK_TYPE cause, PagingParamter paging, OrderByParameter order) { if (LocalMode) { SystemLogic.Proxy.AuditQuery(cause); //平台自动生成代码 return(HelperObject_MCE_B_ASSETS_CHECK_TYPE.Query(cause, paging, order)); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_CHECK_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CHECK_TYPE>(ServiceUri)) { return(smgr.Service.Query(cause, paging, order)); } } }
public static DisplayObject_MCE_B_ASSETS_CHECK_TYPE[] Query(CauseObject_MCE_B_ASSETS_CHECK_TYPE cause) { //平台自动生成代码 #region Parameters Block OracleParameter[] parameters = null; #endregion string sSql = " select MCE_B_ASSETS_CHECK_TYPE.TYPE_ID, MCE_B_ASSETS_CHECK_TYPE.BASE_ID, MCE_B_ASSETS_CHECK_TYPE.ID, MCE_D_MCE_TYPE_TYPE_ID.NAME as TYPE_ID_NAME from MCE_B_ASSETS_CHECK_TYPE left join MCE_D_MCE_TYPE MCE_D_MCE_TYPE_TYPE_ID on MCE_B_ASSETS_CHECK_TYPE.TYPE_ID = MCE_D_MCE_TYPE_TYPE_ID.ID where (1=1)"; sSql += PrepareCause(cause, out parameters); if (cause.Recursion != null && !string.IsNullOrEmpty(cause.Recursion.RecursionFieldValue)) { sSql = "select t.* from (" + sSql + ") t,( select t." + cause.Recursion.TargetKeyFieldName + " from " + cause.Recursion.TargetDataObjectName + " t start with t." + cause.Recursion.TargetKeyFieldName + " = '" + cause.Recursion.RecursionFieldValue + "' connect by t." + cause.Recursion.TargetLevelFieldName + " = PRIOR t." + cause.Recursion.TargetKeyFieldName + " ) t1 where t." + cause.Recursion.RecursionFieldName + " = t1." + cause.Recursion.TargetKeyFieldName; } #region Push Block DisplayObject_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 DisplayObject_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); } if (!sqlReader.IsDBNull(3)) { dataObj.TYPE_ID_NAME = sqlReader.GetString(3); } objArray.Add(dataObj); } sqlReader.Close(); IDALProvider.IDAL.PushConnection(connection); #endregion DisplayObject_MCE_B_ASSETS_CHECK_TYPE[] objs = new DisplayObject_MCE_B_ASSETS_CHECK_TYPE[objArray.Count]; objArray.CopyTo(0, objs, 0, objs.Length); return(objs); }
public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_CHECK_TYPE cause) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { int amount = HelperObject_MCE_B_ASSETS_CHECK_TYPE.Delete(cause, 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_TYPE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CHECK_TYPE>(ServiceUri)) { return(smgr.Service.Delete(cause)); } } }
public static DisplayObject_MCE_B_ASSETS_CHECK_TYPE[] Query(CauseObject_MCE_B_ASSETS_CHECK_TYPE cause, PagingParamter paging, OrderByParameter order, IDbTransaction trans) { //平台自动生成代码 #region Parameters Block OracleParameter[] parameters = null; IDataReader sqlReader = null; #endregion string sSql = " select MCE_B_ASSETS_CHECK_TYPE.TYPE_ID, MCE_B_ASSETS_CHECK_TYPE.BASE_ID, MCE_B_ASSETS_CHECK_TYPE.ID, MCE_D_MCE_TYPE_TYPE_ID.NAME as TYPE_ID_NAME from MCE_B_ASSETS_CHECK_TYPE left join MCE_D_MCE_TYPE MCE_D_MCE_TYPE_TYPE_ID on MCE_B_ASSETS_CHECK_TYPE.TYPE_ID = MCE_D_MCE_TYPE_TYPE_ID.ID where (1=1)"; string sCauseSql = PrepareCause(cause, out parameters); sSql += sCauseSql; if (cause.Recursion != null && !string.IsNullOrEmpty(cause.Recursion.RecursionFieldValue)) { sSql = "select t.* from (" + sSql + ") t,( select t." + cause.Recursion.TargetKeyFieldName + " from " + cause.Recursion.TargetDataObjectName + " t start with t." + cause.Recursion.TargetKeyFieldName + " = '" + cause.Recursion.RecursionFieldValue + "' connect by t." + cause.Recursion.TargetLevelFieldName + " = PRIOR t." + cause.Recursion.TargetKeyFieldName + " ) t1 where t." + cause.Recursion.RecursionFieldName + " = t1." + cause.Recursion.TargetKeyFieldName; } #region Push Block if (paging != null) { string countSql = string.Empty; if (cause.Recursion != null && !string.IsNullOrEmpty(cause.Recursion.RecursionFieldValue)) { countSql = "Select Count(*) From (" + sSql + ") t"; } else { countSql = "Select Count(*) From (" + sSql + ") t"; } if (paging.TotalRecords == 0) { paging.TotalRecords = IDALProvider.IDAL.DatabaseType == Ipedf.Common.DatabaseType.SqlServer || IDALProvider.IDAL.DatabaseType == Ipedf.Common.DatabaseType.Db2? (int)IDALProvider.IDAL.ExecuteScalar(countSql, parameters, trans) : (int)(decimal)IDALProvider.IDAL.ExecuteScalar(countSql, parameters, trans); } sqlReader = IDALProvider.IDAL.ExecutePagingReader("MCE_B_ASSETS_CHECK_TYPE", paging, order, sSql, parameters, trans); } else if (order != null) { sSql += order.ToString(); sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, trans); } else { sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, trans); } DisplayObject_MCE_B_ASSETS_CHECK_TYPE dataObj = null; ArrayList objArray = new ArrayList(); while (sqlReader.Read()) { dataObj = new DisplayObject_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); } if (!sqlReader.IsDBNull(3)) { dataObj.TYPE_ID_NAME = sqlReader.GetString(3); } objArray.Add(dataObj); } sqlReader.Close(); #endregion DisplayObject_MCE_B_ASSETS_CHECK_TYPE[] objs = new DisplayObject_MCE_B_ASSETS_CHECK_TYPE[objArray.Count]; objArray.CopyTo(0, objs, 0, objs.Length); return(objs); }