コード例 #1
0
        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.hdnAttributeID.Value = id;

                this.hdnEntityID.Value = SynapseHelpers.GetEntityIDFromAttributeID(id);

                this.lblHeading.Text = SynapseHelpers.GetAttributeNameFromAttributeID(id);

                this.lblAttributeName.Text = SynapseHelpers.GetAttributeNameFromAttributeID(id);


                try
                {
                }
                catch { }

                try
                {
                    this.hdnUserName.Value = Session["userFullName"].ToString();
                }
                catch { }


                this.lblSummaryType.Text          = SynapseHelpers.GetEntityNameAndNamespaceFromID(id);
                this.hdnNextOrdinalPosition.Value = SynapseHelpers.GetNextOrdinalPositionFromID(id);

                BindGrid();

                this.btnDropAttribute.Attributes.Add("onclick", "if(confirm('Are you sure that you want to delete this relation? This cannot be undone!!')){return true;} else {return false;};");
            }
        }
コード例 #2
0
        public IActionResult RelationView(string id)
        {
            ViewBag.Id         = namespaceId;
            ViewBag.RelationId = id;
            ViewBag.Summary    = SynapseHelpers.GetAttributeNameFromAttributeID(id);
            string sql       = "SELECT * FROM entitysettings.v_attributedetailsummary WHERE attributeid = @attributeid ORDER BY orderby";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("attributeid", id)
            };
            DataSet dsEntityDetail = DataServices.DataSetFromSQL(sql, paramList);

            List <DetailDto> detailDto = dsEntityDetail.Tables[0].ToList <DetailDto>();

            return(View(detailDto));
        }
コード例 #3
0
        public IActionResult EntityManagerRelationSave(RelationModel model)
        {
            if (namespaceId == model.EntityId)
            {
                return(Json("You are unable to create a relation to the same entity"));
            }
            string sqlValidation       = "";
            var    paramListValidation = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("entityid", namespaceId),
                new KeyValuePair <string, string>("parententityid", model.EntityId)
            };

            if (model.AttributeId != "0" && model.AttributeId != "")
            {
                sqlValidation = "SELECT * FROM entitysettings.entityrelation WHERE entityid = @entityid and parententityid = @parententityid;";
            }
            else
            {
                sqlValidation = "SELECT * FROM entitysettings.entityrelation WHERE entityid = @entityid and parententityid = @parententityid and localentityattributeid = @localentityattributeid;";
                paramListValidation.Add(new KeyValuePair <string, string>("localentityattributeid", model.AttributeId));
            }
            DataSet   ds           = DataServices.DataSetFromSQL(sqlValidation, paramListValidation);
            DataTable dtValidation = ds.Tables[0];

            if (dtValidation.Rows.Count > 0)
            {
                return(Json("The relation that you are trying to create already exists for this entity"));
            }

            string sql = @"SELECT entitysettings.addrelationtoentity(
	                            @p_entityid, 
	                            @p_entityname, 
	                            @p_synapsenamespaceid, 
	                            @p_synapsenamespacename,     
                                @p_parententityid,
                                @p_parententityname,
                                @p_parentsynapsenamespaceid, 
	                            @p_parentsynapsenamespacename, 
                                @p_attributeid,
	                            @p_attributename,                            
	                            CAST(@p_ordinal_position AS integer),
	                            @p_entityversionid,
                                @p_username,
                                @p_localentityattributeid,
                                @p_localentityattributename
                            )";



            DataTable dt                  = SynapseHelpers.GetEntityDSFromID(namespaceId);
            DataTable dtParent            = SynapseHelpers.GetEntityDSFromID(model.EntityId);
            DataTable dtKey               = SynapseHelpers.GetEntityKeyAttributeFromID(model.EntityId);
            string    entityName          = SynapseHelpers.GetEntityNameFromID(model.EntityId);
            string    localAttributeName  = string.Empty;
            string    attributename       = dtKey.Rows[0]["attributename"].ToString();
            string    nextOrdinalPosition = SynapseHelpers.GetNextOrdinalPositionFromID(namespaceId);

            if (model.AttributeId != "0" && !string.IsNullOrWhiteSpace(model.AttributeId))
            {
                localAttributeName = SynapseHelpers.GetAttributeNameFromAttributeID(model.AttributeId);
                attributename     += "_" + localAttributeName;
            }


            var paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("p_entityid", namespaceId),
                new KeyValuePair <string, string>("p_entityname", SynapseHelpers.GetEntityNameFromID(namespaceId)),
                new KeyValuePair <string, string>("p_synapsenamespaceid", dt.Rows[0]["synapsenamespaceid"].ToString()),
                new KeyValuePair <string, string>("p_synapsenamespacename", dt.Rows[0]["synapsenamespacename"].ToString()),
                new KeyValuePair <string, string>("p_parententityid", model.EntityId),
                new KeyValuePair <string, string>("p_parententityname", entityName),
                new KeyValuePair <string, string>("p_parentsynapsenamespaceid", dtParent.Rows[0]["synapsenamespaceid"].ToString()),
                new KeyValuePair <string, string>("p_parentsynapsenamespacename", dtParent.Rows[0]["synapsenamespacename"].ToString()),
                new KeyValuePair <string, string>("p_attributeid", dtKey.Rows[0]["attributeid"].ToString()),
                new KeyValuePair <string, string>("p_attributename", attributename),
                new KeyValuePair <string, string>("p_ordinal_position", nextOrdinalPosition),
                new KeyValuePair <string, string>("p_entityversionid", SynapseHelpers.GetCurrentEntityVersionFromID(namespaceId)),
                new KeyValuePair <string, string>("p_username", HttpContext.Session.GetString(SynapseSession.FullName)),
                new KeyValuePair <string, string>("p_localentityattributeid", model.AttributeId),
                new KeyValuePair <string, string>("p_localentityattributename", localAttributeName)
            };

            DataServices.ExcecuteNonQueryFromSQL(sql, paramList);
            return(Json(namespaceId));
        }
コード例 #4
0
        public IActionResult EntityManagerAttributeView(string id)
        {
            namespaceId           = SynapseHelpers.GetEntityIDFromAttributeID(id);
            ViewBag.Id            = namespaceId;
            ViewBag.AttributeId   = id;
            ViewBag.Heading       = SynapseHelpers.GetAttributeNameFromAttributeID(id);
            ViewBag.AttributeName = SynapseHelpers.GetAttributeNameFromAttributeID(id);

            ViewBag.Summary = SynapseHelpers.GetEntityNameAndNamespaceFromID(namespaceId);

            string sql       = "SELECT * FROM entitysettings.v_attributedetailsummary WHERE attributeid = @attributeid ORDER BY orderby";
            var    paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("attributeid", id)
            };

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

            ViewBag.Error = "";
            foreach (DataRow drow in dt.Rows)
            {
                string colName = drow["entitydetail"].ToString();
                string colVal  = drow["entitydescription"].ToString();

                if (colName == "Is Key Attribute")
                {
                    if (colVal == "1")
                    {
                        ViewBag.Error = "Drop Attribute button not available as it is not possible to delete a key attribute";
                    }
                }

                if (colName == "Is System Attribute")
                {
                    if (colVal == "1")
                    {
                        ViewBag.Error = "Drop Attribute button not available as it is not possible to delete a system attribute";
                    }
                }

                if (colName == "Is Relation Attribute")
                {
                    if (colVal == "1")
                    {
                        ViewBag.Error = "Drop Attribute button not available as it is not possible to delete a relation attribute from this screen";
                    }
                }
            }


            DataTable          dtBVs       = SynapseHelpers.GetEntityBaseviewsDT(namespaceId);
            Int16              bvCount     = System.Convert.ToInt16(dtBVs.Rows.Count);
            DetailModel        detailModel = new DetailModel();
            List <DetailDto>   detailDto   = dt.ToList <DetailDto>();
            List <BaseViewDto> baseViewDto = dtBVs.ToList <BaseViewDto>();

            detailModel.DetailDto   = detailDto;
            detailModel.BaseViewDto = baseViewDto;
            return(View(detailModel));
        }
コード例 #5
0
        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.hdnAttributeID.Value = id;

                this.hdnEntityID.Value = SynapseHelpers.GetEntityIDFromAttributeID(id);

                this.lblHeading.Text = SynapseHelpers.GetAttributeNameFromAttributeID(id);

                this.lblAttributeName.Text = SynapseHelpers.GetAttributeNameFromAttributeID(id);


                try
                {
                }
                catch { }

                try
                {
                    this.hdnUserName.Value = Session["userFullName"].ToString();
                }
                catch { }


                this.lblSummaryType.Text          = SynapseHelpers.GetEntityNameAndNamespaceFromID(id);
                this.hdnNextOrdinalPosition.Value = SynapseHelpers.GetNextOrdinalPositionFromID(id);

                BindGrid();

                this.btnDropAttribute.Attributes.Add("onclick", "if(confirm('Are you sure that you want to delete this attribute? This cannot be undone!!')){return true;} else {return false;};");


                DataTable dtBVs   = SynapseHelpers.GetEntityBaseviewsDT(this.hdnEntityID.Value);
                Int16     bvCount = System.Convert.ToInt16(dtBVs.Rows.Count);
                this.lblDependentBaseviewCount.Text = bvCount.ToString();
                this.lblHasDepencies.Text           = bvCount.ToString();

                if (bvCount > 0)
                {
                    this.pnlHasDepencies.Visible = true;
                }
                else
                {
                    this.pnlHasDepencies.Visible = false;
                }

                this.dgBaseViewDependancies.DataSource = dtBVs;
                this.dgBaseViewDependancies.DataBind();
            }
        }