/// <summary>
 /// Deprecated Method for adding a new object to the T_ATTAINS_REPORT_LOG EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToT_ATTAINS_REPORT_LOG(T_ATTAINS_REPORT_LOG t_ATTAINS_REPORT_LOG)
 {
     base.AddObject("T_ATTAINS_REPORT_LOG", t_ATTAINS_REPORT_LOG);
 }
 /// <summary>
 /// Create a new T_ATTAINS_REPORT_LOG object.
 /// </summary>
 /// <param name="aTTAINS_LOG_IDX">Initial value of the ATTAINS_LOG_IDX property.</param>
 /// <param name="aTTAINS_REPORT_IDX">Initial value of the ATTAINS_REPORT_IDX property.</param>
 /// <param name="sUBMIT_DT">Initial value of the SUBMIT_DT property.</param>
 public static T_ATTAINS_REPORT_LOG CreateT_ATTAINS_REPORT_LOG(global::System.Int32 aTTAINS_LOG_IDX, global::System.Int32 aTTAINS_REPORT_IDX, global::System.DateTime sUBMIT_DT)
 {
     T_ATTAINS_REPORT_LOG t_ATTAINS_REPORT_LOG = new T_ATTAINS_REPORT_LOG();
     t_ATTAINS_REPORT_LOG.ATTAINS_LOG_IDX = aTTAINS_LOG_IDX;
     t_ATTAINS_REPORT_LOG.ATTAINS_REPORT_IDX = aTTAINS_REPORT_IDX;
     t_ATTAINS_REPORT_LOG.SUBMIT_DT = sUBMIT_DT;
     return t_ATTAINS_REPORT_LOG;
 }
        //***************************** ATTAINS_REPORT_LOG **************************************************
        public static int InsertOrUpdateATTAINS_REPORT_LOG(int? aTTAINS_LOG_IDX, int? aTTAINS_REPORT_IDX,  DateTime? sUBMIT_DT, 
            string sUBMIT_FILE, byte[] rESPONSE_FILE, string rESPONSE_TXT, string cDX_SUBMIT_TRANSID, string cDX_SUBMIT_STATUS, string cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    T_ATTAINS_REPORT_LOG a = new T_ATTAINS_REPORT_LOG();

                    if (aTTAINS_LOG_IDX != null)
                        a = (from c in ctx.T_ATTAINS_REPORT_LOG
                             where c.ATTAINS_LOG_IDX == aTTAINS_LOG_IDX
                             select c).FirstOrDefault();

                    if (aTTAINS_REPORT_IDX == null) //insert case
                    {
                        insInd = true;
                    }

                    if (aTTAINS_REPORT_IDX != null) a.ATTAINS_REPORT_IDX = aTTAINS_REPORT_IDX.ConvertOrDefault<int>();
                    if (sUBMIT_DT != null) a.SUBMIT_DT = sUBMIT_DT.ConvertOrDefault<DateTime>();
                    if (sUBMIT_FILE != null) a.SUBMIT_FILE = sUBMIT_FILE;
                    if (rESPONSE_FILE != null) a.RESPONSE_FILE = rESPONSE_FILE;
                    if (rESPONSE_TXT != null) a.RESPONSE_TXT = rESPONSE_TXT;
                    if (cDX_SUBMIT_TRANSID != null) a.CDX_SUBMIT_TRANSID = cDX_SUBMIT_TRANSID;
                    if (cDX_SUBMIT_STATUS != null) a.CDX_SUBMIT_STATUS = cDX_SUBMIT_STATUS;

                    if (insInd) //insert case
                    {
                        ctx.AddToT_ATTAINS_REPORT_LOG(a);
                    }

                    ctx.SaveChanges();

                    return a.ATTAINS_LOG_IDX ;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }