// *************************** BIO INDICES****************************** // ********************************************************************* public static int InsertOrUpdateWQX_BIO_HABITAT_INDEX(global::System.Int32? bIO_HABITAT_INDEX_IDX, global::System.String oRG_ID, global::System.Int32? mONLOC_IDX, global::System.String iNDEX_ID, global::System.String iNDEX_TYPE_ID, global::System.String iNDEX_TYPE_ID_CONTEXT, global::System.String INDEX_TYPE_NAME, global::System.String rESOURCE_TITLE, global::System.String rESOURCE_CREATOR, global::System.String rESOURCE_SUBJECT, global::System.String rESOURCE_PUBLISHER, global::System.DateTime? rESOURCE_DATE, global::System.String rESOURCE_ID, global::System.String iNDEX_TYPE_SCALE, global::System.String iNDEX_SCORE, global::System.String iNDEX_QUAL_CD, global::System.String iNDEX_COMMENT, global::System.DateTime? iNDEX_CALC_DATE, Boolean? wQX_IND, global::System.String wQX_SUBMIT_STATUS, DateTime? WQX_UPDATE_DT, Boolean? aCT_IND, String cREATE_USER = "******") { using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities()) { Boolean insInd = false; try { T_WQX_BIO_HABITAT_INDEX a = new T_WQX_BIO_HABITAT_INDEX(); if (bIO_HABITAT_INDEX_IDX != null) a = (from c in ctx.T_WQX_BIO_HABITAT_INDEX where c.BIO_HABITAT_INDEX_IDX == bIO_HABITAT_INDEX_IDX select c).FirstOrDefault(); if (bIO_HABITAT_INDEX_IDX == null) //insert case { a = new T_WQX_BIO_HABITAT_INDEX(); insInd = true; } if (oRG_ID != null) a.ORG_ID = oRG_ID; if (mONLOC_IDX != null) a.MONLOC_IDX = mONLOC_IDX; if (iNDEX_ID != null) a.INDEX_ID = iNDEX_ID; if (iNDEX_TYPE_ID != null) a.INDEX_TYPE_ID = iNDEX_TYPE_ID; if (iNDEX_TYPE_ID_CONTEXT != null) a.INDEX_TYPE_ID_CONTEXT = iNDEX_TYPE_ID_CONTEXT; if (INDEX_TYPE_NAME != null) a.INDEX_TYPE_NAME = INDEX_TYPE_NAME; if (rESOURCE_TITLE != null) a.RESOURCE_TITLE = rESOURCE_TITLE; if (rESOURCE_CREATOR != null) a.RESOURCE_CREATOR = rESOURCE_CREATOR; if (rESOURCE_SUBJECT != null) a.RESOURCE_SUBJECT = rESOURCE_SUBJECT; if (rESOURCE_PUBLISHER != null) a.RESOURCE_PUBLISHER = rESOURCE_PUBLISHER; if (rESOURCE_DATE != null) a.RESOURCE_DATE = (DateTime)rESOURCE_DATE; if (rESOURCE_ID != null) a.RESOURCE_ID = rESOURCE_ID; if (iNDEX_TYPE_SCALE != null) a.INDEX_TYPE_SCALE = iNDEX_TYPE_SCALE; if (iNDEX_SCORE != null) a.INDEX_SCORE = iNDEX_SCORE; if (iNDEX_QUAL_CD != null) a.INDEX_QUAL_CD = iNDEX_QUAL_CD; if (iNDEX_COMMENT != null) a.INDEX_COMMENT = iNDEX_COMMENT; if (iNDEX_CALC_DATE != null) a.INDEX_CALC_DATE = iNDEX_CALC_DATE; if (wQX_SUBMIT_STATUS != null) a.WQX_SUBMIT_STATUS = wQX_SUBMIT_STATUS; if (aCT_IND != null) a.ACT_IND = aCT_IND; if (wQX_IND != null) a.WQX_IND = wQX_IND; if (insInd) //insert case { a.CREATE_USERID = cREATE_USER.ToUpper(); a.CREATE_DT = System.DateTime.Now; ctx.AddToT_WQX_BIO_HABITAT_INDEX(a); } else { a.UPDATE_USERID = cREATE_USER.ToUpper(); a.UPDATE_DT = System.DateTime.Now; } ctx.SaveChanges(); return a.BIO_HABITAT_INDEX_IDX; } catch (Exception ex) { return 0; } } }