//// GET ORGID WITH LEADERS ASPNET EMAIL //// protected void GetOrgId() { // Instantiate SQL String string SelectOrgIDSQL; // Select SQL SelectOrgIDSQL = "SELECT UserID, OrgID FROM tbl_UsersMaster WHERE UserEmail ='" + FetchUser.UserEmail() + "'"; // Use SQL Statement to Select Records from DB var sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString); var cmd = new SqlCommand(SelectOrgIDSQL, sqlConn); cmd.Connection.Open(); SqlDataReader OrgIdRdr; OrgIdRdr = cmd.ExecuteReader(); while (OrgIdRdr.Read()) { string sOrgID = OrgIdRdr["OrgID"].ToString(); lbl_OrgID.Text = sOrgID; // Set Session Session["OrgID"] = sOrgID; string sUserID = OrgIdRdr["UserID"].ToString(); // Set Session Session["UserID"] = sUserID; } cmd.Connection.Close(); cmd.Connection.Dispose(); }
//// GET ORG DETAILS FROM ORGID SESSION VARIABLE //// protected void GetOrgDetails() { // Instantiate SQL String string SelectOrgDetailsSQL; string sOrgID = lbl_OrgID.Text; // Select SQL SelectOrgDetailsSQL = "SELECT * FROM tbl_OrgsMaster WHERE OrgID ='" + sOrgID + "'"; // Use SQL Statement to Select Records from DB var sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString); var cmd = new SqlCommand(SelectOrgDetailsSQL, sqlConn); cmd.Connection.Open(); SqlDataReader OrgIdRdr; OrgIdRdr = cmd.ExecuteReader(); while (OrgIdRdr.Read()) { string sOrgName = OrgIdRdr["OrgName"].ToString(); lbl_OrgName.Text = sOrgName; // Set Session Session["OrgName"] = sOrgName; } cmd.Connection.Close(); cmd.Connection.Dispose(); }
//// GET ORG DETAILS FROM ORGID SESSION VARIABLE //// protected void GetOrgDetails() { // Instantiate SQL String string SelectOrgDetailsSQL; // Get From Session string sOrgID = Session["OrgID"].ToString(); // Select SQL SelectOrgDetailsSQL = "SELECT * FROM tbl_OrgsMaster WHERE OrgID ='" + sOrgID + "'"; // Use SQL Statement to Select Records from DB var sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString); var cmd = new SqlCommand(SelectOrgDetailsSQL, sqlConn); cmd.Connection.Open(); SqlDataReader OrgIdRdr; OrgIdRdr = cmd.ExecuteReader(); while (OrgIdRdr.Read()) { // Create strings from reader string sOrgName = OrgIdRdr["OrgName"].ToString(); string sautoApproveConversation = OrgIdRdr["autoApproveConversation"].ToString(); string sautoApproveComment = OrgIdRdr["autoApproveComment"].ToString(); string sconversationEmail = OrgIdRdr["conversationEmail"].ToString(); string scommentEmail = OrgIdRdr["commentEmail"].ToString(); string sprofanityFilter = OrgIdRdr["profanityFilter"].ToString(); string sorgEnabled = OrgIdRdr["OrgEnabled"].ToString().ToLower(); lbl_OrgName.Text = sOrgName; // Set Sessions with created strings Session["OrgName"] = sOrgName; Session["autoApproveConversation"] = sautoApproveConversation; Session["autoApproveComment"] = sautoApproveComment; Session["conversationEmail"] = sconversationEmail; Session["commentEmail"] = scommentEmail; Session["profanityFilter"] = sprofanityFilter; // Set Master Org Label var lbl_masterOrg = (Label)Master.FindControl("lbl_masterOrg"); lbl_masterOrg.Text = sOrgName; // Set Org Enabled Label var lbl_orgEnabled = (Label)Master.FindControl("lbl_orgEnabled"); lbl_orgEnabled.Text = sorgEnabled; } cmd.Connection.Close(); cmd.Connection.Dispose(); }
//// GET ORG DETAILS FROM ORGID SESSION VARIABLE //// protected void GetOrgDetails() { // Instantiate SQL String string SelectOrgDetailsSQL; string sOrgID = lbl_OrgID.Text; // Select SQL SelectOrgDetailsSQL = "SELECT * FROM tbl_OrgsMaster WHERE OrgID ='" + sOrgID + "'"; // Use SQL Statement to Select Records from DB var sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString); var cmd = new SqlCommand(SelectOrgDetailsSQL, sqlConn); cmd.Connection.Open(); SqlDataReader OrgIdRdr; OrgIdRdr = cmd.ExecuteReader(); while (OrgIdRdr.Read()) { // Set Page Org Name string sOrgName = OrgIdRdr["OrgName"].ToString(); lbl_OrgName.Text = sOrgName; // Get Enabled Status string sorgEnabled = OrgIdRdr["OrgEnabled"].ToString().ToLower(); // Set Master Org Label var lbl_masterOrg = (Label)Master.FindControl("lbl_masterOrg"); lbl_masterOrg.Text = sOrgName; // Set Org Enabled Label var lbl_orgEnabled = (Label)Master.FindControl("lbl_orgEnabled"); lbl_orgEnabled.Text = sorgEnabled; // Set Session Session["OrgName"] = sOrgName; } cmd.Connection.Close(); cmd.Connection.Dispose(); }