private void BindEntityGrid()
        {
            try
            {
                string sql = " SELECT \"Id\", \"RedirectUri\" AS URI, \"ClientId\", 'Redirect URI' AS URIType FROM public.\"ClientRedirectUris\" WHERE \"ClientId\" = CAST(@ClientId AS INT)"
                             + " UNION ALL "
                             + " SELECT \"Id\", \"Origin\" AS URI, \"ClientId\", 'CORS origin URI' AS URIType FROM public.\"ClientCorsOrigins\" WHERE \"ClientId\" = CAST(@ClientId AS INT)"
                             + " UNION ALL "
                             + " SELECT \"Id\", \"PostLogoutRedirectUri\" AS URI, \"ClientId\", 'Post logout redirect URI' AS URIType FROM public.\"ClientPostLogoutRedirectUris\" WHERE \"ClientId\" = CAST(@ClientId AS INT)"
                             + " ORDER BY URIType";

                var paramList = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("ClientId", this.hdnClientID.Value)
                };

                DataSet   ds = DataServices.DataSetFromSQL(sql, paramList, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
                DataTable dt = ds.Tables[0];

                this.dgClientRedirectURI.DataSource = dt;
                this.dgClientRedirectURI.DataBind();

                this.lblResultCount.Text = dt.Rows.Count.ToString();
            }
            catch (Exception ex)
            {
                this.lblError.Text    = ex.ToString();
                this.lblError.Visible = true;
                return;
            }
        }
Example #2
0
        public static List <selectedAttribute> GetSelectedAttributes(string listId)
        {
            string sql = @"SELECT
                            la.listattribute_id, la.list_id, la.baseviewattribute_id, la.attributename, la.datatype, la.displayname, la.ordinalposition, la.defaultcssclassname
                            FROM listsettings.listattribute la
                            INNER JOIN listsettings.baseviewattribute bva
                            ON la.attributename = bva.attributename
                            WHERE la.list_id = @list_id
                            AND COALESCE(isselected, false) = true
                            AND bva.baseview_ID IN (SELECT baseview_id FROM listsettings.listmanager WHERE list_id = @list_id)
                            ORDER BY la.ordinalposition";

            var paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("list_id", listId)
            };

            DataSet ds = new DataSet();

            try
            {
                ds = DataServices.DataSetFromSQL(sql, paramList);
            }
            catch (Exception ex)
            {
                return(null);
            }

            DataTable dt = ds.Tables[0];

            List <selectedAttribute> lst = ds.Tables[0].ToList <selectedAttribute>();

            return(lst);
        }
Example #3
0
        protected void btnCreateNewEntity_Click(object sender, EventArgs e)
        {
            string tmpViewName = Guid.NewGuid().ToString("N");
            //Check if we can create a temporary view using the supplied SQL Statement
            string sqlCreate       = "CREATE VIEW baseviewcore." + this.lblNamespaceName.Text + "_" + this.txtEntityName.Text + " AS " + this.txtSQL.Text + ";";
            var    paramListCreate = new List <KeyValuePair <string, string> >()
            {
            };

            try
            {
                DataServices.executeSQLStatement(sqlCreate, paramListCreate);
            }
            catch (Exception ex)
            {
                this.lblError.Text    = "Error creating view: " + ex.ToString();
                this.lblError.Visible = true;
                return;
            }

            string sql = "SELECT listsettings.createbaseview(@p_baseviewnamespaceid, @p_baseviewnamespace, @p_baseviewname, @p_baseviewdescription, @p_baseviewsqlstatement, @p_username);";

            var paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("p_baseviewnamespaceid", this.hdnNamespaceID.Value),
                new KeyValuePair <string, string>("p_baseviewnamespace", SynapseHelpers.GetBaseviewNamespaceNameFromID(this.hdnNamespaceID.Value)),
                new KeyValuePair <string, string>("p_baseviewname", this.txtEntityName.Text),
                new KeyValuePair <string, string>("p_baseviewdescription", this.txtEntityComments.Text),
                new KeyValuePair <string, string>("p_baseviewsqlstatement", this.txtSQL.Text),
                new KeyValuePair <string, string>("p_username", this.hdnUserName.Value)
            };


            DataSet ds = new DataSet();

            try
            {
                ds = DataServices.DataSetFromSQL(sql, paramList);
            }
            catch (Exception ex)
            {
                this.lblError.Text    = "Error creating view: " + System.Environment.NewLine + ex.ToString();
                this.lblError.Visible = true;
                return;
            }



            DataTable dt = ds.Tables[0];

            string newGuid = "";

            try
            {
                newGuid = dt.Rows[0][0].ToString();
            }
            catch { }

            Response.Redirect("BaseviewManagerView.aspx?id=" + newGuid);
        }
Example #4
0
        protected void btnCreateNewEntity_Click(object sender, EventArgs e)
        {
            string sql = "SELECT entitysettings.createentityfrommodel(@p_synapsenamespaceid, @p_synapsenamespacename, @p_entityname, @p_entitydescription, @p_username, @p_localnamespaceid, @p_localnamespacename)";

            var paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("p_synapsenamespaceid", this.hdnNamespaceID.Value),
                new KeyValuePair <string, string>("p_synapsenamespacename", SynapseHelpers.GetNamespaceNameFromID(this.hdnNamespaceID.Value)),
                new KeyValuePair <string, string>("p_entityname", this.ddlCoreEntity.SelectedItem.Text),
                new KeyValuePair <string, string>("p_entitydescription", this.txtEntityComments.Text),
                new KeyValuePair <string, string>("p_username", this.hdnUserName.Value),
                new KeyValuePair <string, string>("p_localnamespaceid", this.hdnLocalNamespaceID.Value),
                new KeyValuePair <string, string>("p_localnamespacename", SynapseHelpers.GetNamespaceNameFromID(this.hdnLocalNamespaceID.Value)),
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            string newGuid = "";

            try
            {
                newGuid = dt.Rows[0][0].ToString();
            }
            catch { }

            Response.Redirect("EntityManagerAttributes.aspx?id=" + newGuid);
        }
Example #5
0
        private void BindDevOpsDashboardGrids()
        {
            // Database Activity
            string dbActivitySQL = "SELECT * FROM pg_stat_activity WHERE datname='synapse';";
            var    paramList     = new List <KeyValuePair <string, string> >()
            {
            };

            DataSet   dsActivity = DataServices.DataSetFromSQL(dbActivitySQL, paramList, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionPostgresDB);
            DataTable dtActivity = dsActivity.Tables[0];

            this.dataGridDatabaseActivity.DataSource = dtActivity;
            this.dataGridDatabaseActivity.DataBind();

            //Replication Status
            string replStatusSQL = "select pid, usename, client_addr, client_port, backend_start, sent_location, write_location, flush_location, replay_location from pg_stat_replication;";

            DataSet   dsReplStatus = DataServices.DataSetFromSQL(replStatusSQL, paramList, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionPostgresDB);
            DataTable dtReplStatus = dsReplStatus.Tables[0];

            this.dgReplStatus.DataSource = dtReplStatus;
            this.dgReplStatus.DataBind();



            //Update Refreshed Label
            this.lblDashboardRefreshed.Text = "Lasted refreshed @ " + DateTime.Now.ToShortTimeString();
        }
Example #6
0
        private int CheckEmailAddress()
        {
            /*
             * 0 Okay
             * 1 Email exists
             * 2 Email not correct extension
             */

            string sql       = "SELECT * from systemsettings.app_user where emailaddress = @email;";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("email", this.txtRegistrationEmail.Text),
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Example #7
0
        private void BindEntityGrid()
        {
            try
            {
                string sql = "SELECT \"Id\", \"Type\", \"Value\", \"ClientId\" FROM public.\"ClientClaims\" WHERE \"ClientId\" = CAST(@ClientId AS INT) ORDER BY \"Id\";";

                var paramList = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("ClientId", this.hdnClientID.Value)
                };

                DataSet   ds = DataServices.DataSetFromSQL(sql, paramList, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
                DataTable dt = ds.Tables[0];

                this.dgClientClaim.DataSource = dt;
                this.dgClientClaim.DataBind();

                this.lblResultCount.Text = dt.Rows.Count.ToString();
            }
            catch (Exception ex)
            {
                this.lblError.Text    = ex.ToString();
                this.lblError.Visible = true;
                return;
            }
        }
Example #8
0
        private string GetClientName(string id)
        {
            try
            {
                string sql = "SELECT \"ClientId\" FROM public.\"Clients\" WHERE \"Id\" = CAST(@Id AS INT);";

                var paramList = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("Id", id)
                };

                DataSet ds = DataServices.DataSetFromSQL(sql, paramList, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);

                DataTable dt = ds.Tables[0];

                if (dt.Rows.Count > 0)
                {
                    return(dt.Rows[0][0].ToString());
                }
                else
                {
                    return("");
                }
            }
            catch (Exception ex)
            {
                this.lblError.Text    = ex.ToString();
                this.lblError.Visible = true;
                return("An error occurred");
            }
        }
Example #9
0
        public static List <availableAttribute> GetAvailableAttributes(string listId)
        {
            string sql = @"SELECT
                            bva.baseviewattribute_id, baseviewnamespaceid, baseviewnamespace, baseview_id, baseviewname, bva.attributename, datatype, ordinalposition, case when sa.baseviewattribute_id is null then false else true end as isselected
                            FROM listsettings.baseviewattribute bva
                            LEFT OUTER JOIN 
                            (SELECT baseviewattribute_id, attributename FROM listsettings.listattribute WHERE list_id = @list_id AND COALESCE(isselected,false) = true) sa
                            ON bva.attributename = sa.attributename                            
                            WHERE baseview_ID IN (SELECT baseview_id FROM listsettings.listmanager WHERE list_id = @list_id) ORDER BY bva.attributename";


            var paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("list_id", listId)
            };

            DataSet ds = new DataSet();

            try
            {
                ds = DataServices.DataSetFromSQL(sql, paramList);
            }
            catch (Exception ex)
            {
                return(null);
            }

            DataTable dt = ds.Tables[0];
            List <availableAttribute> lst = ds.Tables[0].ToList <availableAttribute>();

            return(lst);
        }
        private void loadFormById(string id)
        {
            string sql = "SELECT * FROM \"Clients\" WHERE \"ClientId\" = @ClientId";

            var param = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("ClientId", id)
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, param, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
            DataTable dt = ds.Tables[0];

            chkEnabled.Checked       = ds.Tables[0].Rows[0]["Enabled"].ToString() == "True" ? true : false;
            txtClientId.Text         = ds.Tables[0].Rows[0]["ClientId"].ToString();
            chkReqClntSecret.Checked = ds.Tables[0].Rows[0]["RequireClientSecret"].ToString() == "True" ? true : false;
            txtClientName.Text       = ds.Tables[0].Rows[0]["ClientName"].ToString();
            txtDesc.Text             = ds.Tables[0].Rows[0]["Description"].ToString();
            chkReqCon.Checked        = ds.Tables[0].Rows[0]["RequireConsent"].ToString() == "True" ? true : false;
            chkAllAccTkn.Checked     = ds.Tables[0].Rows[0]["AllowAccessTokensViaBrowser"].ToString() == "True" ? true : false;
            chkAllOffAcc.Checked     = ds.Tables[0].Rows[0]["AllowOfflineAccess"].ToString() == "True" ? true : false;
            txtIdTknLt.Text          = ds.Tables[0].Rows[0]["IdentityTokenLifetime"].ToString();
            txtAccTknLt.Text         = ds.Tables[0].Rows[0]["AccessTokenLifetime"].ToString();
            txtAuthCodeLt.Text       = ds.Tables[0].Rows[0]["AuthorizationCodeLifetime"].ToString();
            txtConLt.Text            = ds.Tables[0].Rows[0]["ConsentLifetime"].ToString();
            txtAbReTknLt.Text        = ds.Tables[0].Rows[0]["AbsoluteRefreshTokenLifetime"].ToString();
            txtSlReTknLt.Text        = ds.Tables[0].Rows[0]["SlidingRefreshTokenLifetime"].ToString();
            chkReTknUs.Checked       = ds.Tables[0].Rows[0]["RefreshTokenUsage"].ToString() == "1" ? true : false;
            chkUpdAccTknClRe.Checked = ds.Tables[0].Rows[0]["UpdateAccessTokenClaimsOnRefresh"].ToString() == "True" ? true : false;
            chkReTknExp.Checked      = ds.Tables[0].Rows[0]["RefreshTokenExpiration"].ToString() == "1" ? true : false;
            chkEnLocLog.Checked      = ds.Tables[0].Rows[0]["EnableLocalLogin"].ToString() == "True" ? true : false;
            chkAlSenClntCl.Checked   = ds.Tables[0].Rows[0]["AlwaysSendClientClaims"].ToString() == "True" ? true : false;
            txtClntClPre.Text        = ds.Tables[0].Rows[0]["ClientClaimsPrefix"].ToString();
        }
Example #11
0
        private bool ValidateUser(out string emailvalidationstring)
        {
            emailvalidationstring = "";
            string sql       = "SELECT * FROM systemsettings.app_user WHERE emailaddress = @email;";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("email", this.txtEmail.Text)
            };



            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                string newguid         = System.Convert.ToString(System.Guid.NewGuid());
                string sqlUpdate       = "UPDATE systemsettings.app_user SET emailresetstring = @newguid WHERE emailaddress = @email;";
                var    paramListUpdate = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("email", this.txtEmail.Text),
                    new KeyValuePair <string, string>("newguid", newguid)
                };

                DataServices.executeSQLStatement(sqlUpdate, paramListUpdate);

                emailvalidationstring = newguid;

                return(true);
            }


            return(false);
        }
Example #12
0
        protected void getAPIName()
        {
            string    sql = "SELECT \"Id\", \"Name\" FROM \"ApiResources\" where \"Id\" = cast('" + Session["SM_apiid"].ToString() + "' as int)  ;";
            DataSet   ds  = DataServices.DataSetFromSQL(sql, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
            DataTable dt  = ds.Tables[0];

            Session["SM_apiname"] = dt.Rows[0]["Name"].ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string id = "";
                try
                {
                    id = Request.QueryString["id"].ToString();
                }
                catch
                {
                    Response.Redirect("Error.aspx");
                }


                if (String.IsNullOrEmpty(id))
                {
                    Response.Redirect("Error.aspx");
                }

                this.hdnOptionCollectionID.Value = id;

                string sql = "SELECT * FROM listsettings.questionoptioncollection WHERE questionoptioncollection_id = @questionoptioncollection_id;";

                var paramList = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("questionoptioncollection_id", id)
                };
                DataSet ds = new DataSet();
                try
                {
                    ds = DataServices.DataSetFromSQL(sql, paramList);
                }
                catch (Exception ex)
                {
                    StringBuilder sbe = new StringBuilder();
                    sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>");
                    sbe.AppendLine(ex.ToString());
                    sbe.AppendLine("</div>");
                    this.ltrlError.Visible = true;
                    this.ltrlError.Text    = sbe.ToString();
                    return;
                }

                DataTable dt = ds.Tables[0];

                try
                {
                    this.lblListOptionCollection.Text = dt.Rows[0]["questionoptioncollectionname"].ToString();
                }
                catch
                {
                }

                this.lblError.Visible   = false;
                this.lblSuccess.Visible = false;
            }
        }
Example #14
0
        //RadioButtonList
        private void BindRadioList(RadioButtonList rad, string sql, string valueField, string displayField)
        {
            DataSet ds = DataServices.DataSetFromSQL(sql);

            rad.DataSource     = ds;
            rad.DataValueField = valueField;
            rad.DataTextField  = displayField;
            rad.DataBind();
        }
Example #15
0
        protected void LoadIdentityResoucess()
        {
            string sql = " Select 'Please Select' as Name, '0' as resourceid UNION ALL SELECT ir.\"Name\" , ir.\"Id\" as resourceid FROM \"IdentityResources\" ir  where ir.\"Enabled\" = true;";


            DataSet   ds = DataServices.DataSetFromSQL(sql, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
            DataTable dt = ds.Tables[0];

            this.ddlResource.DataSource = dt;
            this.ddlResource.DataBind();
        }
        protected void LoadApiScopes()
        {
            string sql = " Select 'Please Select' as Name, '0' as Id UNION ALL SELECT ir.\"Name\" , ir.\"Id\"  FROM \"ApiScopes\" ir";


            DataSet   ds = DataServices.DataSetFromSQL(sql, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
            DataTable dt = ds.Tables[0];

            this.ddlApiScopes.DataSource = dt;
            this.ddlApiScopes.DataBind();
        }
        private void SearchLocalLogins()
        {
            string sql = "SELECT \"Id\", \"UserName\" FROM \"AspNetUsers\" where \"Id\" not in (select \"UserId\" from \"AspNetUserLogins\" ) and \"UserName\" like '" + txtLocalUserId.Text + "%'  ;";


            DataSet   ds = DataServices.DataSetFromSQL(sql, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
            DataTable dt = ds.Tables[0];

            this.gvLocalLogins.DataSource = dt;
            this.gvLocalLogins.DataBind();
        }
Example #18
0
        protected void btnValidateEntity_Click(object sender, EventArgs e)
        {
            this.txtEntityName.Text    = RemoveAndReplaceSpecialCharacters(this.txtEntityName.Text);
            this.txtEntityName.Enabled = true;

            string haserr = "form-group has-error";
            string noerr  = "form-group";


            this.lblError.Text         = string.Empty;
            this.lblError.Visible      = false;
            this.lblSuccess.Visible    = false;
            this.fgEntityName.CssClass = noerr;

            if (string.IsNullOrEmpty(this.txtEntityName.Text.ToString()))
            {
                this.lblError.Text = "Please enter a new name for the entity";
                this.txtEntityName.Focus();
                this.lblError.Visible      = true;
                this.fgEntityName.CssClass = haserr;
                return;
            }


            string sql       = "SELECT * FROM entitysettings.entitymanager WHERE synapseNamespaceid = @synapseNamespaceid and entityname = @entityname;";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("synapseNamespaceid", this.hdnNamespaceID.Value),
                new KeyValuePair <string, string>("entityname", this.txtEntityName.Text)
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                this.lblError.Text = "The name of the entity that you you have entered already exists";
                this.txtEntityName.Focus();
                this.lblError.Visible      = true;
                this.fgEntityName.CssClass = haserr;
                return;
            }


            this.lblSuccess.Visible         = true;
            this.lblSuccess.Text            = "Validation succeeded";
            this.btnCreateNewEntity.Visible = true;
            this.btnCancel.Visible          = true;
            this.btnCreateNewEntity.Focus();
            this.btnValidateEntity.Visible = false;
            this.txtEntityName.Enabled     = false;
        }
        private void BindEntityGrid()
        {
            string sql       = "SELECT logintimestamp, emailaddress, ipaddress FROM systemsettings.loginhistory ORDER BY _sequenceid DESC LIMIT 100;";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            this.dgLoginHistory.DataSource = dt;
            this.dgLoginHistory.DataBind();
        }
Example #20
0
        private void GetSwiftDataModel()
        {
            string sql       = "SELECT entitysettings.getswiftmodel(@entityid);";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("entityid", this.hdnEntityID.Value)
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            this.txtSwiftDataModel.Text = dt.Rows[0][0].ToString();
        }
Example #21
0
        private void BindGrid()
        {
            string sql       = "SELECT * FROM listsettings.baseviewnamespace ORDER BY baseviewnamespace; ";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            this.dgEntities.DataSource = dt;
            this.dgEntities.DataBind();
        }
Example #22
0
        protected void btnValidateEntity_Click(object sender, EventArgs e)
        {
            this.txtLocalNamespaceName.Text    = RemoveAndReplaceSpecialCharacters(this.txtLocalNamespaceName.Text);
            this.txtLocalNamespaceName.Enabled = true;

            string haserr = "form-group has-error";
            string noerr  = "form-group";


            this.lblError.Text      = string.Empty;
            this.lblError.Visible   = false;
            this.lblSuccess.Visible = false;


            if (string.IsNullOrEmpty(this.txtLocalNamespaceName.Text.ToString()))
            {
                this.lblError.Text = "Please enter a new name for the namespace";
                this.txtLocalNamespaceName.Focus();
                this.lblError.Visible = true;
                this.fgLocalNamespaceName.CssClass = haserr;
                return;
            }


            string sql       = "SELECT * FROM listsettings.baseviewnamespace WHERE baseviewnamespace = @baseviewnamespace;";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("baseviewnamespace", this.txtLocalNamespaceName.Text)
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                this.lblError.Text = "There is already a baseview namespace with that name ";
                this.txtLocalNamespaceName.Focus();
                this.lblError.Visible = true;
                this.fgLocalNamespaceName.CssClass = haserr;
                return;
            }


            this.lblSuccess.Visible            = true;
            this.lblSuccess.Text               = "Validation succeeded";
            this.btnCreateNewNamespace.Visible = true;
            this.btnCancel.Visible             = true;
            this.btnCreateNewNamespace.Focus();
            this.btnValidateEntity.Visible     = false;
            this.txtLocalNamespaceName.Enabled = false;
        }
Example #23
0
        protected void showTree()
        {
            //Entities

            tv.Nodes.Clear();
            TreeNode entitiesrootnode = new TreeNode("Entities", "entities");

            tv.ShowCheckBoxes = TreeNodeTypes.All;
            TreeNode baseviewsrootnode = new TreeNode("Baseviews", "baseviews");
            TreeNode listsrootnode     = new TreeNode("Lists", "lists");

            tv.Nodes.Add(entitiesrootnode);
            tv.Nodes.Add(baseviewsrootnode);
            tv.Nodes.Add(listsrootnode);

            tv.CollapseAll();

            string    sql = @"SELECT entityid as id,entityname as name from entitysettings.entitymanager order by entityname";
            DataTable dt  = new DataTable();

            try
            {
                dt = DataServices.DataSetFromSQL(sql).Tables[0];
            }
            catch (Exception ex)
            {
            }
            AddNodes(dt, tv.FindNode("entities"));

            sql = @"SELECT baseview_id as id,baseviewname as name from listsettings.baseviewmanager order by baseviewname";
            dt  = new DataTable();
            try
            {
                dt = DataServices.DataSetFromSQL(sql).Tables[0];
            }
            catch (Exception ex)
            {
            }
            AddNodes(dt, tv.FindNode("baseviews"));

            sql = @"SELECT list_id as id,listname as name from listsettings.listmanager order by listname";
            dt  = new DataTable();
            try
            {
                dt = DataServices.DataSetFromSQL(sql).Tables[0];
            }
            catch (Exception ex)
            {
            }
            AddNodes(dt, tv.FindNode("lists"));
        }
Example #24
0
        private void BindFormControls()
        {
            string  sql       = "SELECT * FROM eboards.bedboarddevice WHERE bedboarddevice_id = @bedboarddevice_id;";
            DataSet ds        = new DataSet();
            var     paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("bedboarddevice_id", this.hdnDeviceID.Value)
            };

            try
            {
                ds = DataServices.DataSetFromSQL(sql, paramList);
            }
            catch (Exception ex)
            {
                StringBuilder sbe = new StringBuilder();
                //sbe.AppendLine("<div class='contentAlertDanger'><h3 style='color: #712f2f'>Sorry, there was an error:</h3>");
                sbe.AppendLine(ex.ToString());
                //sbe.AppendLine("</div>");
                this.lblError.Visible = true;
                this.lblError.Text    = sbe.ToString();
                return;
            }

            DataTable dt = ds.Tables[0];

            try
            {
                this.txtDeviceName.Text = dt.Rows[0]["bedboarddevicename"].ToString();
            }
            catch { }

            try
            {
                this.txtIPAddress.Text = dt.Rows[0]["deviceipaddress"].ToString();
            }
            catch { }

            SetDDLSource(this.ddlBedBoard, dt.Rows[0]["bedboard_id"].ToString());

            SetDDLSource(this.ddllWard, dt.Rows[0]["locationward"].ToString());

            BindBayRoomDDL();

            SetDDLSource(this.ddlBayRoom, dt.Rows[0]["locationbayroom"].ToString());

            BindBedDDL();

            SetDDLSource(this.ddlBed, dt.Rows[0]["locationbed"].ToString());
        }
Example #25
0
        private void BindGrid()
        {
            string sql       = "SELECT * FROM listsettings.v_baseviewdetailsummary WHERE baseview_id = @baseview_id ORDER BY orderby";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("baseview_id", this.hdnBaseViewID.Value)
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            this.dgEntities.DataSource = dt;
            this.dgEntities.DataBind();
        }
Example #26
0
        protected void btnValidateEntity_Click(object sender, EventArgs e)
        {
            string haserr = "form-group has-error";
            string noerr  = "form-group";


            this.lblError.Text         = string.Empty;
            this.lblError.Visible      = false;
            this.lblSuccess.Visible    = false;
            this.fgCoreEntity.CssClass = noerr;

            if (this.ddlCoreEntity.SelectedIndex == 0)
            {
                this.lblError.Text = "Please select the entity that you wish to extend";
                this.ddlCoreEntity.Focus();
                this.lblError.Visible      = true;
                this.fgCoreEntity.CssClass = haserr;
                return;
            }


            string sql       = "SELECT * FROM entitysettings.entitymanager WHERE synapseNamespaceid = @synapseNamespaceid and entityname = @entityname;";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("synapseNamespaceid", this.hdnNamespaceID.Value),
                new KeyValuePair <string, string>("entityname", this.ddlCoreEntity.SelectedItem.Text)
            };

            DataSet   ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                this.lblError.Text = "There is already an extended entity for the entity you have selected";
                this.ddlCoreEntity.Focus();
                this.lblError.Visible      = true;
                this.fgCoreEntity.CssClass = haserr;
                return;
            }


            this.lblSuccess.Visible         = true;
            this.lblSuccess.Text            = "Validation succeeded";
            this.btnCreateNewEntity.Visible = true;
            this.btnCancel.Visible          = true;
            this.btnCreateNewEntity.Focus();
            this.btnValidateEntity.Visible = false;
            this.ddlCoreEntity.Enabled     = false;
        }
Example #27
0
        protected void LoadAPIResources()
        {
            string sql = "SELECT ar.\"Name\" as resourcename, aps.\"Name\" as scopename, aps.\"Description\" as scopedescription FROM \"ApiResources\" ar INNER JOIN \"ApiScopes\" aps on (ar.\"Id\" = aps.\"ApiResourceId\")  ORDER BY ar.\"Name\" , aps.\"Name\";";
            //var paramList = new List<KeyValuePair<string, string>>() {
            //    new KeyValuePair<string, string>("listnamespaceid", this.ddlSynapseNamespace.SelectedValue)
            //};

            DataSet   ds = DataServices.DataSetFromSQL(sql, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
            DataTable dt = ds.Tables[0];

            this.dgAPIs.DataSource = dt;
            this.dgAPIs.DataBind();

            this.lblAPICount.Text = dt.Rows.Count.ToString();
        }
        private string GetSiteURL()
        {
            string sql     = "SELECT * FROM systemsettings.systemsetup WHERE systemsetupid = 1;";
            string siteURL = "";

            DataSet   ds = DataServices.DataSetFromSQL(sql, null);
            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                try { siteURL = dt.Rows[0]["siteurl"].ToString(); } catch { }
            }

            return(siteURL);
        }
Example #29
0
        protected void LoadRoles()
        {
            string sql = "SELECT \"Name\" as rolename, \"Id\" as id FROM \"AspNetRoles\" ORDER BY \"Name\";";
            //var paramList = new List<KeyValuePair<string, string>>() {
            //    new KeyValuePair<string, string>("listnamespaceid", this.ddlSynapseNamespace.SelectedValue)
            //};

            DataSet   ds = DataServices.DataSetFromSQL(sql, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
            DataTable dt = ds.Tables[0];

            this.dgRoles.DataSource = dt;
            this.dgRoles.DataBind();

            this.lblRoleCount.Text = dt.Rows.Count.ToString();
        }
Example #30
0
        protected void LoadIdentityClaims()
        {
            string sql = "SELECT ir.\"Name\" as resourcename, ic.\"Type\" as claimname ,ic.\"Id\" as claimid FROM \"IdentityResources\" ir INNER JOIN \"IdentityClaims\" ic on (ir.\"Id\" = ic.\"IdentityResourceId\")  ORDER BY \"Type\";";
            //var paramList = new List<KeyValuePair<string, string>>() {
            //    new KeyValuePair<string, string>("listnamespaceid", this.ddlSynapseNamespace.SelectedValue)
            //};

            DataSet   ds = DataServices.DataSetFromSQL(sql, dbConnection: SynapseHelpers.DBConnections.PGSQLConnectionSIS);
            DataTable dt = ds.Tables[0];

            this.dgIdentityClaims.DataSource = dt;
            this.dgIdentityClaims.DataBind();

            this.lblResultCount.Text = dt.Rows.Count.ToString();
        }