//******************REF DATA**************************************** public static int InsertOrUpdateT_WQX_REF_DATA(global::System.String tABLE, global::System.String vALUE, global::System.String tEXT, global::System.Boolean? UsedInd) { using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities()) { try { Boolean insInd = true; T_WQX_REF_DATA a = new T_WQX_REF_DATA(); if (ctx.T_WQX_REF_DATA.Any(o => o.VALUE == vALUE && o.TABLE == tABLE)) { //update case a = (from c in ctx.T_WQX_REF_DATA where c.VALUE == vALUE && c.TABLE == tABLE select c).FirstOrDefault(); insInd = false; } a.TABLE = tABLE; a.VALUE = vALUE; a.TEXT = Utils.SubStringPlus(tEXT, 0,200); if (UsedInd != null) a.USED_IND = UsedInd; a.UPDATE_DT = System.DateTime.Now; a.ACT_IND = true; if (insInd) //insert case { if (UsedInd == null) a.USED_IND = true; ctx.AddToT_WQX_REF_DATA(a); } ctx.SaveChanges(); return 1; } catch (Exception ex) { return 0; } } }
/// <summary> /// Create a new T_WQX_REF_DATA object. /// </summary> /// <param name="rEF_DATA_IDX">Initial value of the REF_DATA_IDX property.</param> /// <param name="tABLE">Initial value of the TABLE property.</param> /// <param name="tEXT">Initial value of the TEXT property.</param> public static T_WQX_REF_DATA CreateT_WQX_REF_DATA(global::System.Int32 rEF_DATA_IDX, global::System.String tABLE, global::System.String tEXT) { T_WQX_REF_DATA t_WQX_REF_DATA = new T_WQX_REF_DATA(); t_WQX_REF_DATA.REF_DATA_IDX = rEF_DATA_IDX; t_WQX_REF_DATA.TABLE = tABLE; t_WQX_REF_DATA.TEXT = tEXT; return t_WQX_REF_DATA; }
public static int UpdateT_WQX_REF_DATAByIDX(global::System.Int32 IDX, global::System.String vALUE, global::System.String tEXT, Boolean ActInd) { using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities()) { try { T_WQX_REF_DATA a = new T_WQX_REF_DATA(); a = (from c in ctx.T_WQX_REF_DATA where c.REF_DATA_IDX == IDX select c).FirstOrDefault(); if (vALUE != null) a.VALUE = vALUE; if (tEXT != null) a.TEXT = Utils.SubStringPlus(tEXT, 0, 200); a.UPDATE_DT = System.DateTime.Now; a.ACT_IND = ActInd; ctx.SaveChanges(); return 1; } catch (Exception ex) { return 0; } } }
/// <summary> /// Deprecated Method for adding a new object to the T_WQX_REF_DATA EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToT_WQX_REF_DATA(T_WQX_REF_DATA t_WQX_REF_DATA) { base.AddObject("T_WQX_REF_DATA", t_WQX_REF_DATA); }