/// <summary>
 /// Deprecated Method for adding a new object to the T_WQX_ORGANIZATION EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToT_WQX_ORGANIZATION(T_WQX_ORGANIZATION t_WQX_ORGANIZATION)
 {
     base.AddObject("T_WQX_ORGANIZATION", t_WQX_ORGANIZATION);
 }
 /// <summary>
 /// Create a new T_WQX_ORGANIZATION object.
 /// </summary>
 /// <param name="oRG_ID">Initial value of the ORG_ID property.</param>
 /// <param name="oRG_FORMAL_NAME">Initial value of the ORG_FORMAL_NAME property.</param>
 /// <param name="eLECTRONICADDRESS">Initial value of the ELECTRONICADDRESS property.</param>
 /// <param name="tELEPHONE_NUM">Initial value of the TELEPHONE_NUM property.</param>
 public static T_WQX_ORGANIZATION CreateT_WQX_ORGANIZATION(global::System.String oRG_ID, global::System.String oRG_FORMAL_NAME, global::System.String eLECTRONICADDRESS, global::System.String tELEPHONE_NUM)
 {
     T_WQX_ORGANIZATION t_WQX_ORGANIZATION = new T_WQX_ORGANIZATION();
     t_WQX_ORGANIZATION.ORG_ID = oRG_ID;
     t_WQX_ORGANIZATION.ORG_FORMAL_NAME = oRG_FORMAL_NAME;
     t_WQX_ORGANIZATION.ELECTRONICADDRESS = eLECTRONICADDRESS;
     t_WQX_ORGANIZATION.TELEPHONE_NUM = tELEPHONE_NUM;
     return t_WQX_ORGANIZATION;
 }
Exemplo n.º 3
0
        public static int InsertOrUpdateT_WQX_ORGANIZATION(string oRG_ID, string oRG_NAME, string oRG_DESC, string tRIBAL_CODE, string eLECTRONIC_ADDRESS, 
            string eLECTRONICADDRESSTYPE, string tELEPHONE_NUM, string tELEPHONE_NUM_TYPE, string TELEPHONE_EXT, string cDX_SUBMITTER_ID,
            string cDX_SUBMITTER_PWD, bool? cDX_SUBMIT_IND, string dEFAULT_TIMEZONE, string cREATE_USER = "******", string mAIL_ADDRESS = null,
            string mAIL_ADD_CITY = null, string mAIL_ADD_STATE = null, string mAIL_ADD_ZIP = null)
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    T_WQX_ORGANIZATION a = new T_WQX_ORGANIZATION();

                    if (oRG_ID != null)
                        a = (from c in ctx.T_WQX_ORGANIZATION
                             where c.ORG_ID == oRG_ID
                             select c).FirstOrDefault();

                    if (a == null) //insert case
                    {
                        a = new T_WQX_ORGANIZATION();
                        insInd = true;
                        a.ORG_ID = oRG_ID;
                    }

                    if (oRG_NAME != null) a.ORG_FORMAL_NAME = oRG_NAME;
                    if (oRG_DESC != null) a.ORG_DESC = oRG_DESC;
                    if (tRIBAL_CODE != null) a.TRIBAL_CODE = tRIBAL_CODE;
                    if (eLECTRONIC_ADDRESS != null) a.ELECTRONICADDRESS = eLECTRONIC_ADDRESS;
                    if (eLECTRONICADDRESSTYPE != null) a.ELECTRONICADDRESSTYPE = eLECTRONICADDRESSTYPE;
                    if (tELEPHONE_NUM != null) a.TELEPHONE_NUM = tELEPHONE_NUM;
                    if (tELEPHONE_NUM_TYPE != null) a.TELEPHONE_NUM_TYPE = tELEPHONE_NUM_TYPE;
                    if (TELEPHONE_EXT != null) a.TELEPHONE_EXT = TELEPHONE_EXT;
                    if (dEFAULT_TIMEZONE != null) a.DEFAULT_TIMEZONE = dEFAULT_TIMEZONE;
                    if (cDX_SUBMITTER_ID != null) a.CDX_SUBMITTER_ID = cDX_SUBMITTER_ID;
                    if (cDX_SUBMIT_IND != null) a.CDX_SUBMIT_IND = cDX_SUBMIT_IND;
                    if (cDX_SUBMITTER_PWD != null && cDX_SUBMITTER_PWD != "--------")
                    {
                        //encrypt CDX submitter password for increased security
                        string encryptOauth = new SimpleAES().Encrypt(cDX_SUBMITTER_PWD);
                        encryptOauth = System.Web.HttpUtility.UrlEncode(encryptOauth);
                        a.CDX_SUBMITTER_PWD_HASH = encryptOauth;
                    }
                    if (dEFAULT_TIMEZONE != null) a.DEFAULT_TIMEZONE = dEFAULT_TIMEZONE;
                    if (mAIL_ADDRESS != null) a.MAILING_ADDRESS = mAIL_ADDRESS;
                    if (mAIL_ADD_CITY != null) a.MAILING_ADD_CITY = mAIL_ADD_CITY;
                    if (mAIL_ADD_STATE != null) a.MAILING_ADD_STATE = mAIL_ADD_STATE;
                    if (mAIL_ADD_ZIP != null) a.MAILING_ADD_ZIP = mAIL_ADD_ZIP;

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

                    ctx.SaveChanges();

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