//*****************SYS_EMAIL_LOG********************************** public static int InsertT_OE_SYS_EMAIL_LOG(string from, string _to, string cc, string subj, string msg, string email_type) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_SYS_EMAIL_LOG e = new T_OE_SYS_EMAIL_LOG(); e.LOG_DT = System.DateTime.Now; e.LOG_FROM = from; e.LOG_TO = _to; e.LOG_CC = cc; e.LOG_SUBJ = subj; e.LOG_MSG = msg.SubStringPlus(0, 2000); e.EMAIL_TYPE = email_type; ctx.T_OE_SYS_EMAIL_LOG.Add(e); ctx.SaveChanges(); return(e.EMAIL_LOG_ID); } catch (Exception ex) { throw ex; } } }
public static int InsertT_OE_ORGANIZATION_TAGS(Guid oRG_IDX, string aTTRIBUTE, string oRG_TAG, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_ORGANIZATION_TAGS e = new T_OE_ORGANIZATION_TAGS(); e.ORG_IDX = oRG_IDX; e.ORG_ATTRIBUTE = aTTRIBUTE; e.ORG_TAG = oRG_TAG; e.CREATE_DT = System.DateTime.Now; e.CREATE_USERIDX = cREATE_USER; ctx.T_OE_ORGANIZATION_TAGS.Add(e); ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
//*****************USERS ********************************** public static int CreateT_OE_USERS(string uSER_ID, string pWD_HASH, string pWD_SALT, string fNAME, string lNAME, string eMAIL, bool aCT_IND, bool iNITAL_PWD_FLAG, DateTime?lASTLOGIN_DT, string pHONE, string pHONE_EXT, int?cREATE_USERIDX) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS u = new T_OE_USERS(); u.USER_ID = uSER_ID; u.PWD_HASH = pWD_HASH; u.PWD_SALT = pWD_SALT; u.FNAME = fNAME; u.LNAME = lNAME; u.EMAIL = eMAIL; u.ACT_IND = aCT_IND; u.INITAL_PWD_FLAG = iNITAL_PWD_FLAG; u.EFFECTIVE_DT = System.DateTime.Now; u.LASTLOGIN_DT = lASTLOGIN_DT; u.PHONE = pHONE; u.PHONE_EXT = pHONE_EXT; u.CREATE_DT = System.DateTime.Now; u.CREATE_USERIDX = cREATE_USERIDX; ctx.T_OE_USERS.Add(u); ctx.SaveChanges(); return(u.USER_IDX); } catch (Exception ex) { db_Ref.LogEFException(ex); throw ex; } } }
public static int InsertT_OE_PROJECT_TAGS(Guid pROJECT_IDX, string aTTRIBUTE, string pROJECT_TAG_NAME, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_PROJECT_TAGS e = new T_OE_PROJECT_TAGS(); e.PROJECT_IDX = pROJECT_IDX; e.PROJECT_ATTRIBUTE = aTTRIBUTE; e.PROJECT_TAG_NAME = pROJECT_TAG_NAME; e.CREATE_DT = System.DateTime.Now; e.CREATE_USERIDX = cREATE_USER; ctx.T_OE_PROJECT_TAGS.Add(e); ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int InsertUpdatetT_OE_REF_TAGS(int?tAG_IDX, string tAG_NAME, string tAG_DESC, string tAG_CAT_NAME, bool?pROMOTE_IND, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { Boolean insInd = false; T_OE_REF_TAGS e = (from c in ctx.T_OE_REF_TAGS where c.TAG_IDX == tAG_IDX select c).FirstOrDefault(); if (e == null) { insInd = true; e = new T_OE_REF_TAGS(); e.CREATE_DT = System.DateTime.Now; e.CREATE_USERIDX = cREATE_USER; } if (tAG_NAME != null) { e.TAG_NAME = tAG_NAME; } if (tAG_DESC != null) { e.TAG_DESC = tAG_DESC; } if (tAG_CAT_NAME != null) { e.TAG_CAT_NAME = tAG_CAT_NAME; } if (pROMOTE_IND != null) { e.PROMOTE_IND = pROMOTE_IND ?? false; } if (insInd) { ctx.T_OE_REF_TAGS.Add(e); } ctx.SaveChanges(); return(e.TAG_IDX); } catch (Exception ex) { LogEFException(ex); return(0); } } }
public static int InsertUpdateT_OE_APP_SETTING(int?sETTING_IDX, string sETTING_NAME, string sETTING_VALUE, bool?eNCRYPT_IND, string sETTING_VALUE_SALT, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { Boolean insInd = false; T_OE_APP_SETTINGS e = (from c in ctx.T_OE_APP_SETTINGS where c.SETTING_IDX == sETTING_IDX select c).FirstOrDefault(); if (e == null) { e = (from c in ctx.T_OE_APP_SETTINGS where c.SETTING_NAME == sETTING_NAME select c).FirstOrDefault(); } if (e == null) { insInd = true; e = new T_OE_APP_SETTINGS(); if (sETTING_NAME != null) { e.SETTING_NAME = sETTING_NAME; } } if (sETTING_VALUE != null) { e.SETTING_VALUE = sETTING_VALUE; } e.MODIFY_DT = System.DateTime.Now; e.MODIFY_USERIDX = cREATE_USER; if (insInd) { ctx.T_OE_APP_SETTINGS.Add(e); } ctx.SaveChanges(); return(e.SETTING_IDX); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int InsertUpdatetT_OE_REF_SYNONYMS(int?sYNONYM_IDX, string sYNONYM_TEXT, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { Boolean insInd = false; T_OE_REF_SYNONYMS e = (from c in ctx.T_OE_REF_SYNONYMS where c.SYNONYM_IDX == sYNONYM_IDX select c).FirstOrDefault(); if (e == null) { insInd = true; e = new T_OE_REF_SYNONYMS(); e.CREATE_DT = System.DateTime.Now; e.CREATE_USERIDX = cREATE_USER; } else { e.MODIFY_DT = System.DateTime.Now; e.MODIFY_USERIDX = cREATE_USER; } if (sYNONYM_TEXT != null) { e.SYNONYM_TEXT = sYNONYM_TEXT.ToLower(); } if (insInd) { ctx.T_OE_REF_SYNONYMS.Add(e); } ctx.SaveChanges(); return(e.SYNONYM_IDX); } catch (Exception ex) { LogEFException(ex); return(0); } } }
public static int InsertUpdateT_OE_APP_SETTING_CUSTOM(string tERMS_AND_CONDITIONS, string aNNOUNCEMENTS, string wELCOME_EMAIL) { using (EECIPEntities ctx = new EECIPEntities()) { try { Boolean insInd = false; T_OE_APP_SETTINGS_CUSTOM e = (from c in ctx.T_OE_APP_SETTINGS_CUSTOM select c).FirstOrDefault(); if (e == null) { insInd = true; e = new T_OE_APP_SETTINGS_CUSTOM(); } if (tERMS_AND_CONDITIONS != null) { e.TERMS_AND_CONDITIONS = Utils.GetSafeHtml(tERMS_AND_CONDITIONS); } if (aNNOUNCEMENTS != null) { e.ANNOUNCEMENTS = Utils.GetSafeHtml(aNNOUNCEMENTS); } if (wELCOME_EMAIL != null) { e.WELCOME_EMAIL = Utils.GetSafeHtml(wELCOME_EMAIL); } if (insInd) { ctx.T_OE_APP_SETTINGS_CUSTOM.Add(e); } ctx.SaveChanges(); return(e.SETTING_CUSTOM_IDX); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int UpdateT_OE_USERS_UnlockGovernance(int idx) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS row = (from c in ctx.T_OE_USERS where c.USER_IDX == idx select c).First(); row.ALLOW_GOVERNANCE = true; ctx.SaveChanges(); return(row.USER_IDX); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int UpdateT_OE_USERS_WelcomeEmailSent(int idx) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS row = (from c in ctx.T_OE_USERS where c.USER_IDX == idx select c).First(); row.NEW_USER_EMAIL_IND = true; ctx.SaveChanges(); return(row.USER_IDX); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int DeleteT_OE_USERS(int idx) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS row = ctx.T_OE_USERS.First(i => i.USER_IDX == idx); ctx.T_OE_USERS.Remove(row); ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int UpdateT_OE_USERS_SyncInd(int idx, bool sYNC_IND) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS row = new T_OE_USERS(); row = (from c in ctx.T_OE_USERS where c.USER_IDX == idx select c).First(); row.SYNC_IND = sYNC_IND; ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int DeleteT_OE_ROLE(int idx) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_ROLES row = new T_OE_ROLES(); row = (from c in ctx.T_OE_ROLES where c.ROLE_IDX == idx select c).First(); ctx.T_OE_ROLES.Remove(row); ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int DeleteT_OE_USER_ROLE(int UserIDX, int RoleIDX) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USER_ROLES row = (from c in ctx.T_OE_USER_ROLES where c.ROLE_IDX == RoleIDX && c.USER_IDX == UserIDX select c).FirstOrDefault(); ctx.T_OE_USER_ROLES.Remove(row); ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int DeleteT_OE_USERS(int idx) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS row = ctx.T_OE_USERS.First(i => i.USER_IDX == idx); ctx.T_OE_USERS.Remove(row); ctx.SaveChanges(); return(1); } catch (Exception ex) { //set to inactive if cannot delete UpdateT_OE_USERS(idx, null, null, null, null, null, false, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); db_Ref.LogEFException(ex); return(0); } } }
//*****************SYS_SEARCH_LOG********************************** public static int InsertT_OE_SYS_SEARCH_LOG(string searchTerm) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_SYS_SEARCH_LOG e = new T_OE_SYS_SEARCH_LOG(); e.LOG_USERIDX = null; //anonymous e.LOG_TERM = searchTerm.Replace("\"", ""); e.LOG_DT = System.DateTime.Now; ctx.T_OE_SYS_SEARCH_LOG.Add(e); ctx.SaveChanges(); return(e.SYS_SEARCH_LOG_ID); } catch (Exception ex) { throw ex; } } }
//*****************SYS_LOG********************************** public static int InsertT_OE_SYS_LOG(string logType, string logMsg) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_SYS_LOG e = new T_OE_SYS_LOG(); e.LOG_TYPE = logType; e.LOG_MSG = logMsg; e.LOG_DT = System.DateTime.Now; ctx.T_OE_SYS_LOG.Add(e); ctx.SaveChanges(); return(e.SYS_LOG_ID); } catch (Exception ex) { throw ex; } } }
public static int UpdateT_OE_USERS_Avatar(int idx, Byte[] UserAvatar) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS row = (from c in ctx.T_OE_USERS where c.USER_IDX == idx select c).First(); if (UserAvatar != null) { row.USER_AVATAR = UserAvatar; } ctx.SaveChanges(); return(row.USER_IDX); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int DeleteT_OE_ORGANIZATION_EMAIL_RULE(Guid id, string email) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_ORGANIZATION_EMAIL_RULE rec = new T_OE_ORGANIZATION_EMAIL_RULE { ORG_IDX = id, EMAIL_STRING = email }; ctx.Entry(rec).State = System.Data.Entity.EntityState.Deleted; ctx.SaveChanges(); return(1); } catch (Exception ex) { LogEFException(ex); return(0); } } }
public static int DeleteT_OE_PROJECTS(Guid id) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_PROJECTS rec = new T_OE_PROJECTS { PROJECT_IDX = id }; ctx.Entry(rec).State = System.Data.Entity.EntityState.Deleted; ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int DeleteT_OE_REF_TAGS(int id) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_REF_TAGS rec = new T_OE_REF_TAGS { TAG_IDX = id }; ctx.Entry(rec).State = System.Data.Entity.EntityState.Deleted; ctx.SaveChanges(); return(1); } catch (Exception ex) { LogEFException(ex); return(0); } } }
public static int DeleteT_OE_ORGANIZATION(Guid id) { using (EECIPEntities ctx = new EECIPEntities()) { try { //***************** VALIDATION (DONT DELETE ORG IF ANY USERS) ********************** List <T_OE_USERS> u = db_Accounts.GetT_OE_USERSByAgency(id); if (u != null && u.Count > 0) { return(-1); } List <T_OE_PROJECTS> p = db_EECIP.GetT_OE_PROJECTS_ByOrgIDX(id); if (p != null && p.Count > 0) { return(-2); } List <OrganizationEntServicesDisplayType> es = db_EECIP.GetT_OE_ORGANIZATION_ENT_SVCS_NoLeftJoin(id); if (es != null && es.Count > 0) { return(-3); } T_OE_ORGANIZATION rec = new T_OE_ORGANIZATION { ORG_IDX = id }; ctx.Entry(rec).State = System.Data.Entity.EntityState.Deleted; ctx.SaveChanges(); return(1); } catch (Exception ex) { LogEFException(ex); return(0); } } }
public static int CreateT_OE_USER_ROLE(global::System.Int32 rOLE_IDX, global::System.Int32 uSER_IDX, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USER_ROLES ur = new T_OE_USER_ROLES(); ur.ROLE_IDX = rOLE_IDX; ur.USER_IDX = uSER_IDX; ur.CREATE_DT = System.DateTime.Now; ur.CREATE_USERIDX = cREATE_USER; ctx.T_OE_USER_ROLES.Add(ur); ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static bool ResetT_OE_USERS_Unsynced() { using (EECIPEntities ctx = new EECIPEntities()) { try { var xxx = (from a in ctx.T_OE_USERS where a.SYNC_IND == true select a).ToList(); xxx.ForEach(a => a.SYNC_IND = false); ctx.SaveChanges(); return(true); } catch (Exception ex) { db_Ref.LogEFException(ex); return(false); } } }
//*****************ROLES ********************************** public static int CreateT_OE_ROLES(global::System.String rOLE_NAME, global::System.String rOLE_DESC, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_ROLES r = new T_OE_ROLES(); r.ROLE_NAME = rOLE_NAME; r.ROLE_DESC = rOLE_DESC; r.CREATE_DT = System.DateTime.Now; r.CREATE_USERIDX = cREATE_USER; ctx.T_OE_ROLES.Add(r); ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int InsertT_OE_ORGANIZATION_EMAIL_RULE(Guid oRG_IDX, string eMAIL_STRING, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_ORGANIZATION_EMAIL_RULE e = new T_OE_ORGANIZATION_EMAIL_RULE(); e.ORG_IDX = oRG_IDX; e.EMAIL_STRING = eMAIL_STRING; e.MODIFY_DT = System.DateTime.Now; e.MODIFY_USERIDX = cREATE_USER; ctx.T_OE_ORGANIZATION_EMAIL_RULE.Add(e); ctx.SaveChanges(); return(1); } catch (Exception ex) { LogEFException(ex); return(0); } } }
public static int UpdateT_OE_ROLE(int idx, string newROLE_NAME, string newROLE_DESC, int?newMODIFY_USR) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_ROLES row = new T_OE_ROLES(); row = (from c in ctx.T_OE_ROLES where c.ROLE_IDX == idx select c).First(); if (newROLE_NAME != null) { row.ROLE_NAME = newROLE_NAME; } if (newROLE_DESC != null) { row.ROLE_DESC = newROLE_DESC; } if (newMODIFY_USR != null) { row.MODIFY_USERIDX = newMODIFY_USR; } row.MODIFY_DT = System.DateTime.Now; ctx.SaveChanges(); return(row.ROLE_IDX); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int InsertT_OE_USER_EXPERTISE(int uSER_IDX, int eXPERTISE_TAG_IDX, int?cREATE_USER = 0) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USER_EXPERTISE e = new T_OE_USER_EXPERTISE(); e.USER_IDX = uSER_IDX; e.EXPERTISE_TAG_IDX = eXPERTISE_TAG_IDX; e.CREATE_DT = System.DateTime.Now; e.CREATE_USERIDX = cREATE_USER; ctx.T_OE_USER_EXPERTISE.Add(e); ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int UpdateT_OE_USERS(int idx, string pWD_HASH, string pWD_SALT, string fNAME, string lNAME, string eMAIL, bool?aCT_IND, bool?iNIT_PWD_FLG, DateTime?eFF_DATE, DateTime?lAST_LOGIN_DT, string pHONE, string pHONE_EXT, int?mODIFY_USR, int?LogAtmpt, Guid?oRG_IDX, string jOB_TITLE, string lINKED_IN, bool?NodeAdmin, bool?ExcludeBadges, bool?nOTIFY_DISCUSSION_IND, bool?nOTIFY_BADGE_IND, bool?nOTIFY_NEWSLETTER) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS row = new T_OE_USERS(); row = (from c in ctx.T_OE_USERS where c.USER_IDX == idx select c).First(); if (pWD_HASH != null) { row.PWD_HASH = pWD_HASH; } if (pWD_SALT != null) { row.PWD_SALT = pWD_SALT; } if (fNAME != null) { row.FNAME = fNAME; } if (lNAME != null) { row.LNAME = lNAME; } if (eMAIL != null) { row.EMAIL = eMAIL; } if (aCT_IND != null) { row.ACT_IND = (bool)aCT_IND; } if (iNIT_PWD_FLG != null) { row.INITAL_PWD_FLAG = (bool)iNIT_PWD_FLG; } if (eFF_DATE != null) { row.EFFECTIVE_DT = (DateTime)eFF_DATE; } if (lAST_LOGIN_DT != null) { row.LASTLOGIN_DT = (DateTime)lAST_LOGIN_DT; } if (pHONE != null) { row.PHONE = pHONE; } if (pHONE_EXT != null) { row.PHONE_EXT = pHONE_EXT; } if (mODIFY_USR != null) { row.MODIFY_USERIDX = mODIFY_USR; } if (LogAtmpt != null) { row.LOG_ATMPT = LogAtmpt; } if (oRG_IDX != null) { row.ORG_IDX = oRG_IDX; } if (oRG_IDX == Guid.Empty) { row.ORG_IDX = null; //handling blanking out of OrgIDX } if (jOB_TITLE != null) { row.JOB_TITLE = jOB_TITLE; } if (lINKED_IN != null) { row.LINKEDIN = lINKED_IN; } if (NodeAdmin != null) { row.NODE_ADMIN = NodeAdmin ?? false; } if (ExcludeBadges != null) { row.EXCLUDE_POINTS_IND = (bool)ExcludeBadges; } if (nOTIFY_DISCUSSION_IND != null) { row.NOTIFY_DISCUSSION_IND = (bool)nOTIFY_DISCUSSION_IND; } if (nOTIFY_BADGE_IND != null) { row.NOTIFY_BADGE_IND = (bool)nOTIFY_BADGE_IND; } if (nOTIFY_NEWSLETTER != null) { row.NOTIFY_NEWSLETTER = (bool)nOTIFY_NEWSLETTER; } row.MODIFY_DT = System.DateTime.Now; ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }
public static int UpdateT_OE_USERS(int idx, string pWD_HASH, string pWD_SALT, string fNAME, string lNAME, string eMAIL, bool?aCT_IND, bool?iNIT_PWD_FLG, DateTime?eFF_DATE, DateTime?lAST_LOGIN_DT, string pHONE, string pHONE_EXT, int?mODIFY_USR, int?LogAtmpt, Guid?oRG_IDX, string jOB_TITLE) { using (EECIPEntities ctx = new EECIPEntities()) { try { T_OE_USERS row = new T_OE_USERS(); row = (from c in ctx.T_OE_USERS where c.USER_IDX == idx select c).First(); if (pWD_HASH != null) { row.PWD_HASH = pWD_HASH; } if (pWD_SALT != null) { row.PWD_SALT = pWD_SALT; } if (fNAME != null) { row.FNAME = fNAME; } if (lNAME != null) { row.LNAME = lNAME; } if (eMAIL != null) { row.EMAIL = eMAIL; } if (aCT_IND != null) { row.ACT_IND = (bool)aCT_IND; } if (iNIT_PWD_FLG != null) { row.INITAL_PWD_FLAG = (bool)iNIT_PWD_FLG; } if (eFF_DATE != null) { row.EFFECTIVE_DT = (DateTime)eFF_DATE; } if (lAST_LOGIN_DT != null) { row.LASTLOGIN_DT = (DateTime)lAST_LOGIN_DT; } if (pHONE != null) { row.PHONE = pHONE; } if (pHONE_EXT != null) { row.PHONE_EXT = pHONE_EXT; } if (mODIFY_USR != null) { row.MODIFY_USERIDX = mODIFY_USR; } if (LogAtmpt != null) { row.LOG_ATMPT = LogAtmpt; } if (oRG_IDX != null) { row.ORG_IDX = oRG_IDX; } if (jOB_TITLE != null) { row.JOB_TITLE = jOB_TITLE; } row.MODIFY_DT = System.DateTime.Now; ctx.SaveChanges(); return(1); } catch (Exception ex) { db_Ref.LogEFException(ex); return(0); } } }