/// <summary>
 /// Create a new T_WQX_REF_COUNTY object.
 /// </summary>
 /// <param name="sTATE_CODE">Initial value of the STATE_CODE property.</param>
 /// <param name="cOUNTY_CODE">Initial value of the COUNTY_CODE property.</param>
 /// <param name="cOUNTY_NAME">Initial value of the COUNTY_NAME property.</param>
 public static T_WQX_REF_COUNTY CreateT_WQX_REF_COUNTY(global::System.String sTATE_CODE, global::System.String cOUNTY_CODE, global::System.String cOUNTY_NAME)
 {
     T_WQX_REF_COUNTY t_WQX_REF_COUNTY = new T_WQX_REF_COUNTY();
     t_WQX_REF_COUNTY.STATE_CODE = sTATE_CODE;
     t_WQX_REF_COUNTY.COUNTY_CODE = cOUNTY_CODE;
     t_WQX_REF_COUNTY.COUNTY_NAME = cOUNTY_NAME;
     return t_WQX_REF_COUNTY;
 }
Esempio n. 2
0
        //******************REF COUNTY ****************************************
        public static int InsertOrUpdateT_WQX_REF_COUNTY(global::System.String sTATE_CODE, global::System.String cOUNTY_CODE, global::System.String cOUNTY_NAME, global::System.Boolean? UsedInd)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                try
                {
                    Boolean insInd = true;
                    T_WQX_REF_COUNTY a = new T_WQX_REF_COUNTY();

                    if (ctx.T_WQX_REF_COUNTY.Any(o => o.STATE_CODE == sTATE_CODE && o.COUNTY_CODE == cOUNTY_CODE))
                    {
                        //update case
                        a = (from c in ctx.T_WQX_REF_COUNTY
                             where c.STATE_CODE == sTATE_CODE
                             && c.COUNTY_CODE == cOUNTY_CODE
                             select c).FirstOrDefault();
                        insInd = false;
                    }

                    a.STATE_CODE = sTATE_CODE;
                    a.COUNTY_CODE = cOUNTY_CODE;
                    a.COUNTY_NAME = cOUNTY_NAME;

                    if (UsedInd != null) a.USED_IND = UsedInd;

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

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