//***************************** ATTAINS_ASSESS_UNITS_MLOC **************************************
        public static int InsertOrUpdateATTAINS_ASSESS_UNITS_MLOC(int aSSESS_UNIT_IDX, int mONLOC_IDX, String cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    T_ATTAINS_ASSESS_UNITS_MLOC a = (from c in ctx.T_ATTAINS_ASSESS_UNITS_MLOC
                         where c.ATTAINS_ASSESS_UNIT_IDX == aSSESS_UNIT_IDX
                         && c.MONLOC_IDX == mONLOC_IDX
                         select c).FirstOrDefault();

                    if (a == null)
                    {
                        a = new T_ATTAINS_ASSESS_UNITS_MLOC();
                        insInd = true;
                    }

                    a.ATTAINS_ASSESS_UNIT_IDX = aSSESS_UNIT_IDX;
                    a.MONLOC_IDX = mONLOC_IDX;

                    if (insInd) //insert case
                    {
                        a.CREATE_USERID = cREATE_USER.ToUpper();
                        a.CREATE_DT = System.DateTime.Now;
                        ctx.AddToT_ATTAINS_ASSESS_UNITS_MLOC(a);
                    }

                    ctx.SaveChanges();

                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }