public void Get_Active_Schema_And_Site(string userid)// { List <string> tempSAPList = new List <string>() { "GDV", "GQA", "GPR", "GBP", "STJ", "STG" }; try { // If any of these break, they'll need to be put in Try statements just like the DS/DM below. System.Data.DataSet userschemadata = commmanager.Active_Schema_And_Site(userid); var rows_can_choose_country = userschemadata.Tables[0].Select("PROP_NAME='CAN_CHOOSE_COUNTRY'"); DDRSessionEntity.Current.can_choose_country = rows_can_choose_country[0].ItemArray[3].ToString(); var rows_can_choose_schema = userschemadata.Tables[0].Select("PROP_NAME = 'CAN_CHOOSE_SCHEMA'"); DDRSessionEntity.Current.can_choose_schema = rows_can_choose_schema[0].ItemArray[3].ToString(); var default_site_code = userschemadata.Tables[0].Select("PROP_NAME = 'USER_SITE'"); DDRSessionEntity.Current.SiteCode = default_site_code[0].ItemArray[3].ToString(); // Gets overridden if user selects a different site. (Ex: SE, W5) DDRSessionEntity.Current.table_schema = rows_can_choose_schema[0].ItemArray[1].ToString(); var rows_code_schema = userschemadata.Tables[0].Select("PROP_NAME = 'CODE_SCHEMA'"); DDRSessionEntity.Current.code_schema = rows_code_schema[0].ItemArray[3].ToString().Split('_')[0]; // Gets overridden if user selects a different schema. (SCM/SC3) // Set Default SAP Instance try { DDRSessionEntity.Current.defaultSAPInstance = userschemadata.Tables[0].Select("PROP_NAME = 'USER_SAPINSTANCE'")[0].ItemArray[3].ToString(); tempSAPList.Remove(DDRSessionEntity.Current.defaultSAPInstance); // Removes the user's default SAP instc from wherever it used to be in the list. tempSAPList.Insert(0, DDRSessionEntity.Current.defaultSAPInstance); // Places the user's default SAP instc at the beginning of the list. DDRSessionEntity.Current.userSAPList = tempSAPList; } catch (Exception) // If user doesn't have an assigned default SAP instance { DDRSessionEntity.Current.userSAPList = tempSAPList; // ["GDV","GQA","GPR","GBP","STJ","STG"] } ////////////////////////// Is User an Admin //////////////////////////////// string isDSUser = "******"; string isDMUser = "******"; // Must be inside Try statement because not all users have the Property set for DS or DM. try { isDSUser = userschemadata.Tables[0].Select("PROP_NAME='IS_DS_USER'")[0].ItemArray[3].ToString(); } catch (Exception) { } try { isDMUser = userschemadata.Tables[0].Select("PROP_NAME='IS_DM_USER'")[0].ItemArray[3].ToString(); } catch (Exception) { } if ((isDSUser == "Y") || (isDMUser == "Y")) { DDRSessionEntity.Current.isUserAnAdmin = true; } else { DDRSessionEntity.Current.isUserAnAdmin = false; } ///////////////////////////////////////////////////////////////////////////// // Is the User in Local Environment, Dev DDR, Q DDR, or Production DDR? (Based on URL) if (HttpContext.Current.Request.Url.AbsoluteUri.Contains("localhost")) { DDRSessionEntity.Current.ddrInstance = "L"; // User is testing in Local environment } else if (HttpContext.Current.Request.Url.AbsoluteUri.Contains("ddr-d")) { DDRSessionEntity.Current.ddrInstance = "D"; // User is on the D server } else if (HttpContext.Current.Request.Url.AbsoluteUri.Contains("ddr-q")) { DDRSessionEntity.Current.ddrInstance = "Q"; // User is on the Q server } else { DDRSessionEntity.Current.ddrInstance = "P"; // User is on the P server } } catch (Exception ex) { throw ex; } }