/// <summary>
 /// Deprecated Method for adding a new object to the T_ATTAINS_ASSESS EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToT_ATTAINS_ASSESS(T_ATTAINS_ASSESS t_ATTAINS_ASSESS)
 {
     base.AddObject("T_ATTAINS_ASSESS", t_ATTAINS_ASSESS);
 }
 /// <summary>
 /// Create a new T_ATTAINS_ASSESS object.
 /// </summary>
 /// <param name="aTTAINS_ASSESS_IDX">Initial value of the ATTAINS_ASSESS_IDX property.</param>
 /// <param name="rEPORTING_CYCLE">Initial value of the REPORTING_CYCLE property.</param>
 /// <param name="rEPORT_STATUS">Initial value of the REPORT_STATUS property.</param>
 /// <param name="aTTAINS_ASSESS_UNIT_IDX">Initial value of the ATTAINS_ASSESS_UNIT_IDX property.</param>
 public static T_ATTAINS_ASSESS CreateT_ATTAINS_ASSESS(global::System.Int32 aTTAINS_ASSESS_IDX, global::System.String rEPORTING_CYCLE, global::System.String rEPORT_STATUS, global::System.Int32 aTTAINS_ASSESS_UNIT_IDX)
 {
     T_ATTAINS_ASSESS t_ATTAINS_ASSESS = new T_ATTAINS_ASSESS();
     t_ATTAINS_ASSESS.ATTAINS_ASSESS_IDX = aTTAINS_ASSESS_IDX;
     t_ATTAINS_ASSESS.REPORTING_CYCLE = rEPORTING_CYCLE;
     t_ATTAINS_ASSESS.REPORT_STATUS = rEPORT_STATUS;
     t_ATTAINS_ASSESS.ATTAINS_ASSESS_UNIT_IDX = aTTAINS_ASSESS_UNIT_IDX;
     return t_ATTAINS_ASSESS;
 }
Пример #3
0
        public static int InsertOrUpdateATTAINS_ASSESS(int? aTTAINS_ASSESS_IDX, string rEPORTING_CYCLE, string rEPORT_STATUS, int aTTAINS_ASSESS_UNIT_IDX,
            string aGENCY_CODE, string cYCLE_LAST_ASSESSED, string cYCLE_LAST_MONITORED, string tROPHIC_STATUS_CODE, String cREATE_USER = "******")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    if (aTTAINS_ASSESS_IDX == -1) aTTAINS_ASSESS_IDX = null;

                    T_ATTAINS_ASSESS a = null;

                    if (aTTAINS_ASSESS_IDX != null)
                        a = (from c in ctx.T_ATTAINS_ASSESS
                             where c.ATTAINS_ASSESS_IDX == aTTAINS_ASSESS_IDX
                             select c).FirstOrDefault();

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

                    if (rEPORTING_CYCLE != null) a.REPORTING_CYCLE = rEPORTING_CYCLE;
                    if (rEPORT_STATUS != null) a.REPORT_STATUS = rEPORT_STATUS;
                    a.ATTAINS_ASSESS_UNIT_IDX = aTTAINS_ASSESS_UNIT_IDX;
                    if (aGENCY_CODE != null) a.AGENCY_CODE = aGENCY_CODE;
                    if (cYCLE_LAST_ASSESSED != null) a.CYCLE_LAST_ASSESSED = cYCLE_LAST_ASSESSED;
                    if (cYCLE_LAST_MONITORED != null) a.CYCLE_LAST_MONITORED = cYCLE_LAST_MONITORED;
                    if (tROPHIC_STATUS_CODE != null) a.TROPHIC_STATUS_CODE = tROPHIC_STATUS_CODE;

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

                    ctx.SaveChanges();

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