/// <summary>
 /// Deprecated Method for adding a new object to the T_WQX_ACTIVITY EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToT_WQX_ACTIVITY(T_WQX_ACTIVITY t_WQX_ACTIVITY)
 {
     base.AddObject("T_WQX_ACTIVITY", t_WQX_ACTIVITY);
 }
 /// <summary>
 /// Create a new T_WQX_ACTIVITY object.
 /// </summary>
 /// <param name="aCTIVITY_IDX">Initial value of the ACTIVITY_IDX property.</param>
 /// <param name="oRG_ID">Initial value of the ORG_ID property.</param>
 /// <param name="pROJECT_IDX">Initial value of the PROJECT_IDX property.</param>
 /// <param name="aCTIVITY_ID">Initial value of the ACTIVITY_ID property.</param>
 /// <param name="aCT_TYPE">Initial value of the ACT_TYPE property.</param>
 /// <param name="aCT_MEDIA">Initial value of the ACT_MEDIA property.</param>
 /// <param name="aCT_START_DT">Initial value of the ACT_START_DT property.</param>
 public static T_WQX_ACTIVITY CreateT_WQX_ACTIVITY(global::System.Int32 aCTIVITY_IDX, global::System.String oRG_ID, global::System.Int32 pROJECT_IDX, global::System.String aCTIVITY_ID, global::System.String aCT_TYPE, global::System.String aCT_MEDIA, global::System.DateTime aCT_START_DT)
 {
     T_WQX_ACTIVITY t_WQX_ACTIVITY = new T_WQX_ACTIVITY();
     t_WQX_ACTIVITY.ACTIVITY_IDX = aCTIVITY_IDX;
     t_WQX_ACTIVITY.ORG_ID = oRG_ID;
     t_WQX_ACTIVITY.PROJECT_IDX = pROJECT_IDX;
     t_WQX_ACTIVITY.ACTIVITY_ID = aCTIVITY_ID;
     t_WQX_ACTIVITY.ACT_TYPE = aCT_TYPE;
     t_WQX_ACTIVITY.ACT_MEDIA = aCT_MEDIA;
     t_WQX_ACTIVITY.ACT_START_DT = aCT_START_DT;
     return t_WQX_ACTIVITY;
 }
Пример #3
0
        // *************************** ACTIVITY **********************************
        // *********************************************************************
        public static int InsertOrUpdateWQX_ACTIVITY(global::System.Int32? aCTIVITY_IDX, global::System.String oRG_ID, global::System.Int32? pROJECT_IDX, global::System.Int32? mONLOC_IDX, global::System.String aCTIVITY_ID, 
            global::System.String aCT_TYPE, global::System.String aCT_MEDIA, global::System.String aCT_SUBMEDIA, global::System.DateTime? aCT_START_DT, global::System.DateTime? aCT_END_DT,
            global::System.String aCT_TIME_ZONE, global::System.String rELATIVE_DEPTH_NAME, global::System.String aCT_DEPTHHEIGHT_MSR, global::System.String aCT_DEPTHHEIGHT_MSR_UNIT,
            global::System.String tOP_DEPTHHEIGHT_MSR, global::System.String tOP_DEPTHHEIGHT_MSR_UNIT, global::System.String bOT_DEPTHHEIGHT_MSR, global::System.String bOT_DEPTHHEIGHT_MSR_UNIT,
            global::System.String dEPTH_REF_POINT, global::System.String aCT_COMMENT, global::System.String bIO_ASSEMBLAGE_SAMPLED, global::System.String bIO_DURATION_MSR,
            global::System.String bIO_DURATION_MSR_UNIT, global::System.String bIO_SAMP_COMPONENT, int? bIO_SAMP_COMPONENT_SEQ, global::System.String bIO_REACH_LEN_MSR,
            global::System.String bIO_REACH_LEN_MSR_UNIT, global::System.String bIO_REACH_WID_MSR, global::System.String bIO_REACH_WID_MSR_UNIT, int? bIO_PASS_COUNT,
            global::System.String bIO_NET_TYPE, global::System.String bIO_NET_AREA_MSR, global::System.String bIO_NET_AREA_MSR_UNIT, global::System.String bIO_NET_MESHSIZE_MSR,
            global::System.String bIO_MESHSIZE_MSR_UNIT, global::System.String bIO_BOAT_SPEED_MSR, global::System.String bIO_BOAT_SPEED_MSR_UNIT, global::System.String bIO_CURR_SPEED_MSR,
            global::System.String bIO_CURR_SPEED_MSR_UNIT, global::System.String bIO_TOXICITY_TEST_TYPE, int? sAMP_COLL_METHOD_IDX, global::System.String sAMP_COLL_EQUIP, global::System.String sAMP_COLL_EQUIP_COMMENT,
            int? sAMP_PREP_IDX, global::System.String sAMP_PREP_CONT_TYPE, global::System.String sAMP_PREP_CONT_COLOR, global::System.String sAMP_PREP_CHEM_PRESERV, global::System.String sAMP_PREP_THERM_PRESERV,
            global::System.String sAMP_PREP_STORAGE_DESC, global::System.String wQX_SUBMIT_STATUS, Boolean? aCT_IND, Boolean? wQX_IND, String cREATE_USER = "******", string eNTRY_TYPE = "C")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    T_WQX_ACTIVITY a = new T_WQX_ACTIVITY();

                    if (aCTIVITY_IDX != null)
                        a = (from c in ctx.T_WQX_ACTIVITY
                             where c.ACTIVITY_IDX == aCTIVITY_IDX
                             select c).FirstOrDefault();
                    if (aCTIVITY_IDX == null) //insert case
                    {
                        a = new T_WQX_ACTIVITY();
                        insInd = true;
                    }

                    if (oRG_ID != null) a.ORG_ID = oRG_ID;
                    if (mONLOC_IDX != null) a.MONLOC_IDX = mONLOC_IDX;
                    if (pROJECT_IDX != null) a.PROJECT_IDX = (int)pROJECT_IDX;
                    if (aCTIVITY_ID != null) a.ACTIVITY_ID = aCTIVITY_ID;
                    if (aCT_TYPE != null) a.ACT_TYPE = aCT_TYPE;
                    if (aCT_MEDIA != null) a.ACT_MEDIA = aCT_MEDIA;
                    if (aCT_SUBMEDIA != null) a.ACT_SUBMEDIA = aCT_SUBMEDIA;
                    if (aCT_START_DT != null) a.ACT_START_DT = (DateTime)aCT_START_DT;
                    if (aCT_END_DT != null) a.ACT_END_DT = (DateTime)aCT_END_DT;
                    if (aCT_TIME_ZONE != null) a.ACT_TIME_ZONE = aCT_TIME_ZONE;
                    //put in Timezone if missing
                    if (a.ACT_TIME_ZONE == null)
                        a.ACT_TIME_ZONE = Utils.GetWQXTimeZoneByDate(a.ACT_START_DT);

                    if (rELATIVE_DEPTH_NAME != null) a.RELATIVE_DEPTH_NAME = rELATIVE_DEPTH_NAME;
                    if (aCT_DEPTHHEIGHT_MSR != null) a.ACT_DEPTHHEIGHT_MSR = aCT_DEPTHHEIGHT_MSR;
                    if (aCT_DEPTHHEIGHT_MSR_UNIT != null) a.ACT_DEPTHHEIGHT_MSR_UNIT = aCT_DEPTHHEIGHT_MSR_UNIT;
                    if (tOP_DEPTHHEIGHT_MSR != null) a.TOP_DEPTHHEIGHT_MSR = tOP_DEPTHHEIGHT_MSR;
                    if (tOP_DEPTHHEIGHT_MSR_UNIT != null) a.TOP_DEPTHHEIGHT_MSR_UNIT = tOP_DEPTHHEIGHT_MSR_UNIT;
                    if (bOT_DEPTHHEIGHT_MSR != null) a.BOT_DEPTHHEIGHT_MSR = bOT_DEPTHHEIGHT_MSR;
                    if (bOT_DEPTHHEIGHT_MSR_UNIT != null) a.BOT_DEPTHHEIGHT_MSR_UNIT = bOT_DEPTHHEIGHT_MSR_UNIT;
                    if (dEPTH_REF_POINT != null) a.DEPTH_REF_POINT = dEPTH_REF_POINT;
                    if (aCT_COMMENT != null) a.ACT_COMMENT = aCT_COMMENT;
                    if (bIO_ASSEMBLAGE_SAMPLED != null) a.BIO_ASSEMBLAGE_SAMPLED = bIO_ASSEMBLAGE_SAMPLED;
                    if (bIO_DURATION_MSR != null) a.BIO_DURATION_MSR = bIO_DURATION_MSR;
                    if (bIO_DURATION_MSR_UNIT != null) a.BIO_DURATION_MSR_UNIT = bIO_DURATION_MSR_UNIT;
                    if (bIO_SAMP_COMPONENT != null) a.BIO_SAMP_COMPONENT = bIO_SAMP_COMPONENT;
                    if (bIO_SAMP_COMPONENT_SEQ != null) a.BIO_SAMP_COMPONENT_SEQ = bIO_SAMP_COMPONENT_SEQ;
                    if (bIO_REACH_LEN_MSR != null) a.BIO_REACH_LEN_MSR = bIO_REACH_LEN_MSR;
                    if (bIO_REACH_LEN_MSR_UNIT != null) a.BIO_REACH_LEN_MSR_UNIT = bIO_REACH_LEN_MSR_UNIT;
                    if (bIO_REACH_WID_MSR != null) a.BIO_REACH_WID_MSR = bIO_REACH_WID_MSR;
                    if (bIO_REACH_WID_MSR_UNIT != null) a.BIO_REACH_WID_MSR_UNIT = bIO_REACH_WID_MSR_UNIT;
                    if (bIO_PASS_COUNT != null) a.BIO_PASS_COUNT = bIO_PASS_COUNT;
                    if (bIO_NET_TYPE != null) a.BIO_NET_TYPE = bIO_NET_TYPE;
                    if (bIO_NET_AREA_MSR != null) a.BIO_NET_AREA_MSR = bIO_NET_AREA_MSR;
                    if (bIO_NET_AREA_MSR_UNIT != null) a.BIO_NET_AREA_MSR_UNIT = bIO_NET_AREA_MSR_UNIT;
                    if (bIO_NET_MESHSIZE_MSR != null) a.BIO_NET_MESHSIZE_MSR = bIO_NET_MESHSIZE_MSR;
                    if (bIO_MESHSIZE_MSR_UNIT != null) a.BIO_MESHSIZE_MSR_UNIT = bIO_MESHSIZE_MSR_UNIT;
                    if (bIO_BOAT_SPEED_MSR != null) a.BIO_BOAT_SPEED_MSR = bIO_BOAT_SPEED_MSR;
                    if (bIO_BOAT_SPEED_MSR_UNIT != null) a.BIO_BOAT_SPEED_MSR_UNIT = bIO_BOAT_SPEED_MSR_UNIT;
                    if (bIO_CURR_SPEED_MSR != null) a.BIO_CURR_SPEED_MSR = bIO_CURR_SPEED_MSR;
                    if (bIO_CURR_SPEED_MSR_UNIT != null) a.BIO_CURR_SPEED_MSR_UNIT = bIO_CURR_SPEED_MSR_UNIT;
                    if (bIO_TOXICITY_TEST_TYPE != null) a.BIO_TOXICITY_TEST_TYPE = bIO_TOXICITY_TEST_TYPE;
                    if (sAMP_COLL_METHOD_IDX != null) a.SAMP_COLL_METHOD_IDX = sAMP_COLL_METHOD_IDX;
                    if (sAMP_COLL_EQUIP != null) a.SAMP_COLL_EQUIP = sAMP_COLL_EQUIP;
                    if (sAMP_COLL_EQUIP_COMMENT != null) a.SAMP_COLL_EQUIP_COMMENT = sAMP_COLL_EQUIP_COMMENT;
                    if (sAMP_PREP_IDX != null) a.SAMP_PREP_IDX = sAMP_PREP_IDX;
                    if (sAMP_PREP_CONT_TYPE != null) a.SAMP_PREP_CONT_TYPE = sAMP_PREP_CONT_TYPE;
                    if (sAMP_PREP_CONT_COLOR != null) a.SAMP_PREP_CONT_COLOR = sAMP_PREP_CONT_COLOR;
                    if (sAMP_PREP_CHEM_PRESERV != null) a.SAMP_PREP_CHEM_PRESERV = sAMP_PREP_CHEM_PRESERV;
                    if (sAMP_PREP_THERM_PRESERV != null) a.SAMP_PREP_THERM_PRESERV = sAMP_PREP_THERM_PRESERV;
                    if (sAMP_PREP_STORAGE_DESC != null) a.SAMP_PREP_STORAGE_DESC = sAMP_PREP_STORAGE_DESC;
                    if (wQX_SUBMIT_STATUS != null) a.WQX_SUBMIT_STATUS = wQX_SUBMIT_STATUS;
                    if (aCT_IND != null) a.ACT_IND = aCT_IND;
                    if (wQX_IND != null) a.WQX_IND = wQX_IND;
                    if (eNTRY_TYPE != null) a.ENTRY_TYPE = eNTRY_TYPE;

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

                    ctx.SaveChanges();

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