private static string GetFieldValue(T_WQX_IMPORT_TEMPLATE_DTL FieldType, string[] parts) { try { return (FieldType == null ? null : (FieldType.COL_NUM == 0 ? FieldType.CHAR_NAME : parts[FieldType.COL_NUM.ConvertOrDefault<int>() - 1])); } catch { return null; } }
/// <summary> /// Deprecated Method for adding a new object to the T_WQX_IMPORT_TEMPLATE_DTL EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToT_WQX_IMPORT_TEMPLATE_DTL(T_WQX_IMPORT_TEMPLATE_DTL t_WQX_IMPORT_TEMPLATE_DTL) { base.AddObject("T_WQX_IMPORT_TEMPLATE_DTL", t_WQX_IMPORT_TEMPLATE_DTL); }
/// <summary> /// Create a new T_WQX_IMPORT_TEMPLATE_DTL object. /// </summary> /// <param name="tEMPLATE_DTL_ID">Initial value of the TEMPLATE_DTL_ID property.</param> /// <param name="tEMPLATE_ID">Initial value of the TEMPLATE_ID property.</param> /// <param name="cOL_NUM">Initial value of the COL_NUM property.</param> public static T_WQX_IMPORT_TEMPLATE_DTL CreateT_WQX_IMPORT_TEMPLATE_DTL(global::System.Int32 tEMPLATE_DTL_ID, global::System.Int32 tEMPLATE_ID, global::System.Int32 cOL_NUM) { T_WQX_IMPORT_TEMPLATE_DTL t_WQX_IMPORT_TEMPLATE_DTL = new T_WQX_IMPORT_TEMPLATE_DTL(); t_WQX_IMPORT_TEMPLATE_DTL.TEMPLATE_DTL_ID = tEMPLATE_DTL_ID; t_WQX_IMPORT_TEMPLATE_DTL.TEMPLATE_ID = tEMPLATE_ID; t_WQX_IMPORT_TEMPLATE_DTL.COL_NUM = cOL_NUM; return t_WQX_IMPORT_TEMPLATE_DTL; }
public static int InsertOrUpdateWQX_IMPORT_TEMPLATE_DTL(global::System.Int32? tEMPLATE_DTL_ID, global::System.Int32? tEMPLATE_ID, global::System.Int32? cOL_NUM, global::System.String fIELD_MAP, string cHAR_NAME, string cHAR_DEFAULT_UNIT, String cREATE_USER = "******", string cHAR_DEFAULT_SAMP_FRACTION = null) { using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities()) { Boolean insInd = false; try { T_WQX_IMPORT_TEMPLATE_DTL a = new T_WQX_IMPORT_TEMPLATE_DTL(); if (tEMPLATE_ID != null) a = (from c in ctx.T_WQX_IMPORT_TEMPLATE_DTL where c.TEMPLATE_DTL_ID == tEMPLATE_DTL_ID select c).FirstOrDefault(); if (a == null) //insert case { insInd = true; a = new T_WQX_IMPORT_TEMPLATE_DTL(); } if (tEMPLATE_ID != null) a.TEMPLATE_ID = tEMPLATE_ID.ConvertOrDefault<int>(); if (cOL_NUM != null) a.COL_NUM = cOL_NUM.ConvertOrDefault<int>(); if (fIELD_MAP != null) a.FIELD_MAP = fIELD_MAP; if (cHAR_NAME != null) a.CHAR_NAME = cHAR_NAME; if (cHAR_DEFAULT_UNIT != null) a.CHAR_DEFAULT_UNIT = cHAR_DEFAULT_UNIT; if (cHAR_DEFAULT_SAMP_FRACTION != null) a.CHAR_DEFAULT_SAMP_FRACTION = cHAR_DEFAULT_SAMP_FRACTION; if (insInd) //insert case { a.CREATE_DT = System.DateTime.Now; a.CREATE_USERID = cREATE_USER; ctx.AddToT_WQX_IMPORT_TEMPLATE_DTL(a); } ctx.SaveChanges(); return a.TEMPLATE_DTL_ID; } catch (Exception ex) { return 0; } } }