示例#1
0
文件: db_Ref.cs 项目: ljsweeny/EECIP
        public static int DeleteT_OE_REF_ENTERPRISE_PLATFORM(int id)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    T_OE_REF_ENTERPRISE_PLATFORM rec = new T_OE_REF_ENTERPRISE_PLATFORM {
                        ENT_PLATFORM_IDX = id
                    };
                    ctx.Entry(rec).State = System.Data.Entity.EntityState.Deleted;
                    ctx.SaveChanges();

                    return(1);
                }
                catch (Exception ex)
                {
                    LogEFException(ex);
                    return(0);
                }
            }
        }
示例#2
0
文件: db_Ref.cs 项目: ljsweeny/EECIP
        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);
                }
            }
        }
示例#3
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);
                }
            }
        }
示例#4
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);
         }
     }
 }
示例#5
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);
                }
            }
        }
示例#6
0
        //******************REF_TAGS*********************************
        public static List <T_OE_REF_TAGS> GetT_OE_REF_TAGS_ByCategory(string CatName)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    if (CatName == "")
                    {
                        CatName = null;
                    }

                    return((from a in ctx.T_OE_REF_TAGS
                            where (CatName == null ? true : a.TAG_CAT_NAME == CatName)
                            orderby a.TAG_CAT_NAME, a.TAG_NAME
                            select a).ToList());
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    return(null);
                }
            }
        }
示例#7
0
        //*****************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);
                }
            }
        }
示例#8
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);
                }
            }
        }
示例#9
0
        public static List <UserDisplayType> GetT_OE_USERS()
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    var xxx = (from a in ctx.T_OE_USERS
                               join s in ctx.T_OE_ORGANIZATION on a.ORG_IDX equals s.ORG_IDX into sr1 from x1 in sr1.DefaultIfEmpty() //left join
                               orderby x1.ORG_NAME, a.FNAME
                               select new UserDisplayType
                    {
                        users = a,
                        ORG_NAME = x1.ORG_NAME
                    }).ToList();

                    return(xxx);
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    throw ex;
                }
            }
        }
示例#10
0
        public static List <SearchTermCountDisplayType> GetT_OE_SYS_SEARCH_LOG_Popular(int days)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    DateTime _fromDt = System.DateTime.Today.AddDays(days * -1);

                    return((from a in ctx.T_OE_SYS_SEARCH_LOG
                            where a.LOG_DT >= _fromDt
                            group a by a.LOG_TERM
                            into grp
                            select new SearchTermCountDisplayType {
                        LOG_TERM = grp.Key,
                        discCount = grp.Count()
                    }).OrderByDescending(x => x.discCount).Take(15).ToList());
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    return(null);
                }
            }
        }
示例#11
0
        public static bool UserCanEditOrgList(int idx, List <T_OE_ORGANIZATION> orgs)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    bool canEdit = false;

                    foreach (T_OE_ORGANIZATION org in orgs)
                    {
                        //if governance, anyone can edit
                        if (org.ORG_TYPE == "Governance")
                        {
                            canEdit = true;
                        }

                        //otherwise, check if user belongs
                        int c = (from a in ctx.T_OE_USERS
                                 where a.ORG_IDX == org.ORG_IDX &&
                                 a.USER_IDX == idx
                                 select a).Count();
                        if (c > 0)
                        {
                            canEdit = true;
                        }
                    }

                    return(canEdit);
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    return(false);
                }
            }
        }
示例#12
0
        public static List <T_OE_USERS> GetT_OE_USERSByAgencyList(List <T_OE_ORGANIZATION> orgs)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    List <Guid?> orgList = new List <Guid?>();
                    foreach (T_OE_ORGANIZATION org in orgs)
                    {
                        orgList.Add(org.ORG_IDX);
                    }

                    return((from a in ctx.T_OE_USERS
                            where orgList.Contains(a.ORG_IDX)
                            orderby a.LNAME
                            select a).ToList());
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    return(null);
                }
            }
        }
示例#13
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);
                }
            }
        }
示例#14
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);
                }
            }
        }
示例#15
0
        public static List <string> GetT_OE_ORGANIZATION_TAGS_ByAttributeAll(Guid OrgIDX, string aTTRIBUTE)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    var xx1 = (from a in ctx.T_OE_ORGANIZATION_TAGS
                               where a.ORG_IDX == OrgIDX &&
                               a.ORG_ATTRIBUTE == aTTRIBUTE
                               select a.ORG_TAG);

                    var xx2 = (from a in ctx.T_OE_REF_TAGS
                               where a.TAG_CAT_NAME == aTTRIBUTE
                               select a.TAG_NAME);

                    return(xx1.Union(xx2).ToList());
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    return(null);
                }
            }
        }
示例#16
0
        public static List <UserDisplayType> GetT_OE_USERS_Search(string sort, int page, Guid?orgIDX)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    var xxx = new List <UserDisplayType>();

                    if (sort == null || sort == "ORG_NAME")
                    {
                        xxx = (from a in ctx.T_OE_USERS
                               join s in ctx.T_OE_ORGANIZATION on a.ORG_IDX equals s.ORG_IDX into sr1
                               from x1 in sr1.DefaultIfEmpty() //left join
                               where (orgIDX == null ? true : x1.ORG_IDX == orgIDX)
                               orderby x1.ORG_NAME, a.FNAME
                               select new UserDisplayType
                        {
                            users = a,
                            ORG_NAME = x1.ORG_NAME
                        }).Skip((page - 1) * 50).Take(50).ToList();
                    }
                    else if (sort == "FNAME")
                    {
                        xxx = (from a in ctx.T_OE_USERS
                               join s in ctx.T_OE_ORGANIZATION on a.ORG_IDX equals s.ORG_IDX into sr1
                               from x1 in sr1.DefaultIfEmpty() //left join
                               where (orgIDX == null ? true : x1.ORG_IDX == orgIDX)
                               orderby a.FNAME
                               select new UserDisplayType
                        {
                            users = a,
                            ORG_NAME = x1.ORG_NAME
                        }).Skip((page - 1) * 50).Take(50).ToList();
                    }
                    else if (sort == "LNAME")
                    {
                        xxx = (from a in ctx.T_OE_USERS
                               join s in ctx.T_OE_ORGANIZATION on a.ORG_IDX equals s.ORG_IDX into sr1
                               from x1 in sr1.DefaultIfEmpty() //left join
                               where (orgIDX == null ? true : x1.ORG_IDX == orgIDX)
                               orderby a.LNAME
                               select new UserDisplayType
                        {
                            users = a,
                            ORG_NAME = x1.ORG_NAME
                        }).Skip((page - 1) * 50).Take(50).ToList();
                    }
                    else if (sort == "LASTLOGIN_DT")
                    {
                        xxx = (from a in ctx.T_OE_USERS
                               join s in ctx.T_OE_ORGANIZATION on a.ORG_IDX equals s.ORG_IDX into sr1
                               from x1 in sr1.DefaultIfEmpty() //left join
                               where (orgIDX == null ? true : x1.ORG_IDX == orgIDX)
                               orderby a.LASTLOGIN_DT descending
                               select new UserDisplayType
                        {
                            users = a,
                            ORG_NAME = x1.ORG_NAME
                        }).Skip((page - 1) * 50).Take(50).ToList();
                    }
                    else if (sort == "CREATE_DT")
                    {
                        xxx = (from a in ctx.T_OE_USERS
                               join s in ctx.T_OE_ORGANIZATION on a.ORG_IDX equals s.ORG_IDX into sr1
                               from x1 in sr1.DefaultIfEmpty() //left join
                               where (orgIDX == null ? true : x1.ORG_IDX == orgIDX)
                               orderby a.CREATE_DT descending
                               select new UserDisplayType
                        {
                            users = a,
                            ORG_NAME = x1.ORG_NAME
                        }).Skip((page - 1) * 50).Take(50).ToList();
                    }

                    return(xxx);
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    throw ex;
                }
            }
        }
示例#17
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);
                }
            }
        }
示例#18
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);
                }
            }
        }
示例#19
0
        //***************************project local****************************************
        /// <summary>
        /// Creates a new local PROJECT record and validates it according to the validation rules contained in XML file
        /// </summary>
        /// <param name="UserIDX"></param>
        /// <param name="colVals">Name value pair for the different fields to import into the project record</param>
        /// <returns></returns>
        public static ProjectImportType InsertOrUpdate_T_OE_PROJECT_local(int UserIDX, Dictionary <string, string> colVals)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    //Boolean insInd = true;
                    ProjectImportType e = new ProjectImportType();
                    e.T_OE_PROJECT.PROJECT_IDX    = Guid.NewGuid();
                    e.T_OE_PROJECT.CREATE_DT      = System.DateTime.Now;
                    e.T_OE_PROJECT.CREATE_USERIDX = UserIDX;

                    //get import config rules
                    List <ConfigInfoType> _allRules = Utils.GetAllColumnInfo("P");

                    //explicitly validate mandatory fields
                    foreach (string entry in Utils.GetMandatoryImportFieldList("P"))
                    {
                        T_OE_PROJECT_validate(ref e, _allRules, colVals, entry);
                    }

                    //then only validate optional fields if supplied (performance)
                    foreach (string entry in Utils.GetOptionalImportFieldList("P"))
                    {
                        T_OE_PROJECT_validate(ref e, _allRules, colVals, entry);
                    }

                    //********************** CUSTOM POST VALIDATION ********************************************
                    //SET ORG_IDX based on supplied ORG_NAME
                    e.ORG_NAME = Utils.GetValueOrDefault(colVals, "ORG_NAME");
                    T_OE_ORGANIZATION oo = db_Ref.GetT_OE_ORGANIZATION_ByName(e.ORG_NAME);
                    if (oo != null)
                    {
                        e.T_OE_PROJECT.ORG_IDX = oo.ORG_IDX;
                    }
                    else
                    {
                        e.VALIDATE_CD   = false;
                        e.VALIDATE_MSG += "No matching agency found.";
                    }


                    //MEDIA
                    e.MEDIA_NAME = Utils.GetValueOrDefault(colVals, "MEDIA_TAG");
                    T_OE_REF_TAGS media1 = db_Ref.GetT_OE_REF_TAGS_ByCategoryAndName("Project Media", e.MEDIA_NAME);
                    if (media1 != null)
                    {
                        e.T_OE_PROJECT.MEDIA_TAG = media1.TAG_IDX;
                    }
                    else
                    {
                        e.VALIDATE_CD   = false;
                        e.VALIDATE_MSG += "Invalid Media name.";
                    }


                    //MOBILE
                    e.MOBILE_IND_NAME = Utils.GetValueOrDefault(colVals, "MOBILE_IND");
                    if (!string.IsNullOrEmpty(e.MOBILE_IND_NAME))
                    {
                        T_OE_REF_TAGS mobile1 = db_Ref.GetT_OE_REF_TAGS_ByCategoryAndName("Use Amount", e.MOBILE_IND_NAME);
                        if (mobile1 != null)
                        {
                            e.T_OE_PROJECT.MOBILE_IND = mobile1.TAG_IDX;
                        }
                        else
                        {
                            e.VALIDATE_CD   = false;
                            e.VALIDATE_MSG += "Invalid Mobile Use. ";
                        }
                    }

                    //ADV MON
                    e.ADV_MON_IND_NAME = Utils.GetValueOrDefault(colVals, "ADV_MON_IND");
                    if (!string.IsNullOrEmpty(e.ADV_MON_IND_NAME))
                    {
                        T_OE_REF_TAGS adv1 = db_Ref.GetT_OE_REF_TAGS_ByCategoryAndName("Use Amount", e.ADV_MON_IND_NAME);
                        if (adv1 != null)
                        {
                            e.T_OE_PROJECT.ADV_MON_IND = adv1.TAG_IDX;
                        }
                        else
                        {
                            e.VALIDATE_CD   = false;
                            e.VALIDATE_MSG += "Invalid Advanced Monitoring Use. ";
                        }
                    }

                    //BP MODERN
                    e.BP_MODERN_IND_NAME = Utils.GetValueOrDefault(colVals, "BP_MODERN_IND");
                    if (!string.IsNullOrEmpty(e.BP_MODERN_IND_NAME))
                    {
                        T_OE_REF_TAGS bp1 = db_Ref.GetT_OE_REF_TAGS_ByCategoryAndName("Use Amount", e.BP_MODERN_IND_NAME);
                        if (bp1 != null)
                        {
                            e.T_OE_PROJECT.BP_MODERN_IND = bp1.TAG_IDX;
                        }
                        else
                        {
                            e.VALIDATE_CD   = false;
                            e.VALIDATE_MSG += "Invalid Business Process Improvement Use. ";
                        }
                    }


                    e.PROGRAM_AREAS = Utils.GetValueOrDefault(colVals, "PROGRAM_AREAS");
                    e.FEATURES      = Utils.GetValueOrDefault(colVals, "FEATURES");
                    //********************** CUSTOM POST VALIDATION END ********************************************

                    return(e);
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    return(null);
                }
            }
        }
示例#20
0
        public static int InsertUpdatetT_OE_ORGANIZATION_ENT_SVCS(int?oRG_ENT_SVCS_IDX, Guid?oRG_IDX, int?eNT_PLATFORM_IDX, string pROJECT_NAME,
                                                                  string vENDOR, string iMPLEMENT_STATUS, string cOMMENTS, int?cREATE_USER = 0)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    Boolean insInd = false;

                    T_OE_ORGANIZATION_ENT_SVCS e = (from c in ctx.T_OE_ORGANIZATION_ENT_SVCS
                                                    where c.ORG_ENT_SVCS_IDX == oRG_ENT_SVCS_IDX
                                                    select c).FirstOrDefault();

                    if (e == null)
                    {
                        e = (from c in ctx.T_OE_ORGANIZATION_ENT_SVCS
                             where c.ORG_IDX == oRG_IDX &&
                             c.ENT_PLATFORM_IDX == eNT_PLATFORM_IDX
                             select c).FirstOrDefault();
                    }

                    if (e == null)
                    {
                        insInd           = true;
                        e                = new T_OE_ORGANIZATION_ENT_SVCS();
                        e.CREATE_DT      = System.DateTime.Now;
                        e.CREATE_USERIDX = cREATE_USER;
                    }
                    else
                    {
                        e.MODIFY_DT      = System.DateTime.Now;
                        e.MODIFY_USERIDX = cREATE_USER;
                    }



                    if (oRG_IDX != null)
                    {
                        e.ORG_IDX = oRG_IDX.ConvertOrDefault <Guid>();
                    }
                    if (eNT_PLATFORM_IDX != null)
                    {
                        e.ENT_PLATFORM_IDX = eNT_PLATFORM_IDX ?? 0;
                    }
                    if (pROJECT_NAME != null)
                    {
                        e.PROJECT_NAME = pROJECT_NAME;
                    }
                    if (vENDOR != null)
                    {
                        e.VENDOR = vENDOR;
                    }
                    if (iMPLEMENT_STATUS != null)
                    {
                        e.IMPLEMENT_STATUS = iMPLEMENT_STATUS;
                    }
                    if (cOMMENTS != null)
                    {
                        e.COMMENTS = cOMMENTS;
                    }

                    if (insInd)
                    {
                        ctx.T_OE_ORGANIZATION_ENT_SVCS.Add(e);
                    }

                    ctx.SaveChanges();
                    return(e.ENT_PLATFORM_IDX);
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    return(0);
                }
            }
        }
示例#21
0
        public static Guid?InsertUpdatetT_OE_ORGANIZATION(Guid?oRG_IDX, string oRG_ABBR, string oRG_NAME, string sTATE_CD, int?ePA_REGION, string oRG_TYPE,
                                                          string cLOUD, string aPI, bool?aCT_IND, int?cREATE_USER = 0)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    Boolean insInd = false;

                    T_OE_ORGANIZATION e = (from c in ctx.T_OE_ORGANIZATION
                                           where c.ORG_IDX == oRG_IDX
                                           select c).FirstOrDefault();

                    if (e == null)
                    {
                        insInd           = true;
                        e                = new T_OE_ORGANIZATION();
                        e.ORG_IDX        = Guid.NewGuid();
                        e.CREATE_DT      = System.DateTime.Now;
                        e.CREATE_USERIDX = cREATE_USER;
                    }
                    else
                    {
                        e.MODIFY_DT      = System.DateTime.Now;
                        e.MODIFY_USERIDX = cREATE_USER;
                    }

                    if (oRG_ABBR != null)
                    {
                        e.ORG_ABBR = oRG_ABBR;
                    }
                    if (e.ORG_ABBR == null)
                    {
                        e.ORG_ABBR = "";
                    }
                    if (oRG_NAME != null)
                    {
                        e.ORG_NAME = oRG_NAME;
                    }
                    if (sTATE_CD != null)
                    {
                        e.STATE_CD = sTATE_CD;
                    }
                    if (ePA_REGION != null)
                    {
                        e.EPA_REGION = ePA_REGION;
                    }
                    if (oRG_TYPE != null)
                    {
                        e.ORG_TYPE = oRG_TYPE;
                    }
                    if (cLOUD != null)
                    {
                        e.CLOUD = cLOUD;
                    }
                    if (aPI != null)
                    {
                        e.API = aPI;
                    }
                    if (aCT_IND != null)
                    {
                        e.ACT_IND = aCT_IND ?? true;
                    }


                    if (insInd)
                    {
                        ctx.T_OE_ORGANIZATION.Add(e);
                    }

                    ctx.SaveChanges();
                    return(e.ORG_IDX);
                }
                catch (Exception ex)
                {
                    LogEFException(ex);
                    return(null);
                }
            }
        }
示例#22
0
        public static int InsertUpdatetT_OE_REF_ENTERPRISE_PLATFORM(int eNT_PLATFORM_IDX, string eNT_PLATFORM_NAME, string eNT_PLATFORM_DESC, string eNT_PLATFORM_EXAMPLE,
                                                                    int?sEQ_NO, bool?aCT_IND, int?cREATE_USER = 0)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    Boolean insInd = false;

                    T_OE_REF_ENTERPRISE_PLATFORM e = (from c in ctx.T_OE_REF_ENTERPRISE_PLATFORM
                                                      where c.ENT_PLATFORM_IDX == eNT_PLATFORM_IDX
                                                      select c).FirstOrDefault();

                    if (e == null)
                    {
                        insInd = true;
                        e      = new T_OE_REF_ENTERPRISE_PLATFORM();
                    }


                    if (eNT_PLATFORM_NAME != null)
                    {
                        e.ENT_PLATFORM_NAME = eNT_PLATFORM_NAME;
                    }
                    if (eNT_PLATFORM_DESC != null)
                    {
                        e.ENT_PLATFORM_DESC = eNT_PLATFORM_DESC;
                    }
                    if (eNT_PLATFORM_EXAMPLE != null)
                    {
                        e.ENT_PLATFORM_EXAMPLE = eNT_PLATFORM_EXAMPLE;
                    }
                    if (sEQ_NO != null)
                    {
                        e.SEQ_NO = sEQ_NO;
                    }
                    if (e.SEQ_NO == null)
                    {
                        e.SEQ_NO = GetT_OE_REF_ENTERPRISE_PLATFORM_MaxSeq() + 1;
                    }
                    if (aCT_IND != null)
                    {
                        e.ACT_IND = aCT_IND ?? true;
                    }

                    e.MODIFY_DT      = System.DateTime.Now;
                    e.MODIFY_USERIDX = cREATE_USER;

                    if (insInd)
                    {
                        ctx.T_OE_REF_ENTERPRISE_PLATFORM.Add(e);
                    }

                    ctx.SaveChanges();
                    return(e.ENT_PLATFORM_IDX);
                }
                catch (Exception ex)
                {
                    LogEFException(ex);
                    return(0);
                }
            }
        }
示例#23
0
        public static Guid?InsertUpdatetT_OE_PROJECTS(Guid?pROJECT_IDX, Guid?oRG_IDX, string pROJ_NAME, string pROJ_DESC, int?mEDIA_TAG, int?sTART_YEAR,
                                                      string pROJ_STATUS, int?dATE_LAST_UPDATE, string rECORD_SOURCE, string pROJECT_URL, int?mOBILE_IND, string mOBILE_DESC, int?aDV_MON_IND,
                                                      string aDV_MON_DESC, int?bP_MODERN_IND, string bP_MODERN_DESC, string cOTS, string vENDOR, bool aCT_IND, bool?sYNC_IND, int?cREATE_USER = 0,
                                                      bool?updateSearch = false)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    Boolean insInd = false;

                    T_OE_PROJECTS e = (from c in ctx.T_OE_PROJECTS
                                       where c.PROJECT_IDX == pROJECT_IDX
                                       select c).FirstOrDefault();

                    if (e == null)
                    {
                        insInd           = true;
                        e                = new T_OE_PROJECTS();
                        e.PROJECT_IDX    = Guid.NewGuid();
                        e.CREATE_DT      = System.DateTime.Now;
                        e.CREATE_USERIDX = cREATE_USER;
                    }
                    else
                    {
                        e.MODIFY_DT      = System.DateTime.Now;
                        e.MODIFY_USERIDX = cREATE_USER;
                    }

                    if (oRG_IDX != null)
                    {
                        e.ORG_IDX = oRG_IDX.ConvertOrDefault <Guid>();
                    }
                    if (pROJ_NAME != null)
                    {
                        e.PROJ_NAME = pROJ_NAME;
                    }
                    if (pROJ_DESC != null)
                    {
                        e.PROJ_DESC = pROJ_DESC;
                    }
                    if (mEDIA_TAG != null)
                    {
                        e.MEDIA_TAG = mEDIA_TAG;
                    }
                    if (sTART_YEAR != null)
                    {
                        e.START_YEAR = sTART_YEAR;
                    }
                    if (pROJ_STATUS != null)
                    {
                        e.PROJ_STATUS = pROJ_STATUS;
                    }
                    if (dATE_LAST_UPDATE != null)
                    {
                        e.DATE_LAST_UPDATE = dATE_LAST_UPDATE;
                    }
                    if (rECORD_SOURCE != null)
                    {
                        e.RECORD_SOURCE = rECORD_SOURCE;
                    }
                    if (e.RECORD_SOURCE == null)
                    {
                        e.RECORD_SOURCE = "Agency supplied";
                    }
                    if (pROJECT_URL != null)
                    {
                        e.PROJECT_URL = pROJECT_URL;
                    }
                    if (mOBILE_IND != null)
                    {
                        e.MOBILE_IND = mOBILE_IND;
                    }
                    if (mOBILE_DESC != null)
                    {
                        e.MOBILE_DESC = mOBILE_DESC;
                    }
                    if (aDV_MON_IND != null)
                    {
                        e.ADV_MON_IND = aDV_MON_IND;
                    }
                    if (aDV_MON_DESC != null)
                    {
                        e.ADV_MON_DESC = aDV_MON_DESC;
                    }
                    if (bP_MODERN_IND != null)
                    {
                        e.BP_MODERN_IND = bP_MODERN_IND;
                    }
                    if (bP_MODERN_DESC != null)
                    {
                        e.BP_MODERN_DESC = bP_MODERN_DESC;
                    }
                    if (cOTS != null)
                    {
                        e.COTS = cOTS;
                    }
                    if (vENDOR != null)
                    {
                        e.VENDOR = vENDOR;
                    }
                    e.ACT_IND = aCT_IND;
                    if (sYNC_IND != null)
                    {
                        e.SYNC_IND = sYNC_IND ?? false;
                    }

                    if (insInd)
                    {
                        ctx.T_OE_PROJECTS.Add(e);
                    }

                    ctx.SaveChanges();
                    return(e.PROJECT_IDX);
                }
                catch (Exception ex)
                {
                    db_Ref.LogEFException(ex);
                    return(null);
                }
            }
        }