/// <summary>
 /// Create a new T_WQX_REF_CHARACTERISTIC object.
 /// </summary>
 /// <param name="cHAR_NAME">Initial value of the CHAR_NAME property.</param>
 public static T_WQX_REF_CHARACTERISTIC CreateT_WQX_REF_CHARACTERISTIC(global::System.String cHAR_NAME)
 {
     T_WQX_REF_CHARACTERISTIC t_WQX_REF_CHARACTERISTIC = new T_WQX_REF_CHARACTERISTIC();
     t_WQX_REF_CHARACTERISTIC.CHAR_NAME = cHAR_NAME;
     return t_WQX_REF_CHARACTERISTIC;
 }
Ejemplo n.º 2
0
        //******************REF CHARACTERISTIC****************************************
        public static int InsertOrUpdateT_WQX_REF_CHARACTERISTIC(global::System.String cHAR_NAME, global::System.Decimal? dETECT_LIMIT, global::System.String dEFAULT_UNIT, global::System.Boolean? uSED_IND, 
            global::System.Boolean aCT_IND)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_CHARACTERISTIC a = new T_WQX_REF_CHARACTERISTIC();

                    if (ctx.T_WQX_REF_CHARACTERISTIC.Any(o => o.CHAR_NAME == cHAR_NAME))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_CHARACTERISTIC
                             where c.CHAR_NAME == cHAR_NAME
                             select c).FirstOrDefault();
                        insInd = false;
                    }

                    a.CHAR_NAME = cHAR_NAME;
                    if (dETECT_LIMIT != null) a.DEFAULT_DETECT_LIMIT = dETECT_LIMIT;
                    if (dEFAULT_UNIT != null) a.DEFAULT_UNIT = dEFAULT_UNIT;
                    if (uSED_IND != null) a.USED_IND = uSED_IND;

                    a.UPDATE_DT = System.DateTime.Now;
                    a.ACT_IND = true;

                    if (insInd) //insert case
                    {
                        a.USED_IND = false;
                        ctx.AddToT_WQX_REF_CHARACTERISTIC(a);
                    }
                    ctx.SaveChanges();
                    return 1;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the T_WQX_REF_CHARACTERISTIC EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToT_WQX_REF_CHARACTERISTIC(T_WQX_REF_CHARACTERISTIC t_WQX_REF_CHARACTERISTIC)
 {
     base.AddObject("T_WQX_REF_CHARACTERISTIC", t_WQX_REF_CHARACTERISTIC);
 }