Пример #1
0
        async Task ReloadCategory(RawCategory value)
        {
            var entry = DbContext.Entry(value);
            await entry.ReloadAsync();

            await entry.Collection(x => x.Items).LoadAsync();
        }
Пример #2
0
        public async Task <RawCategory> AddCategory(RawCategoryMutation value)
        {
            var category = new RawCategory
            {
                Id     = value.Id ?? Guid.NewGuid().ToString(),
                Name   = value.Name ?? "",
                Domain = value.Domain ?? "",
            };

            DbContext.Categories.Add(category);
            await DbContext.SaveChangesAsync();

            await ReloadCategory(category);

            return(category);
        }
Пример #3
0
        public TableMappingDiagram()
        {
            InitializeComponent();

            this.BackColor = Color.Black;

            CategoryFont               = new Font(Font.FontFamily, 7.5F, FontStyle.Regular);
            PropertyFont               = new Font(Font.FontFamily, 7F, FontStyle.Regular);
            CategoryColumns            = new RawCategory("Columns", CategoryFont, PropertyFont, MainShape);
            CategoryColumns.IsExpanded = true;

            shapeCanvas1.MouseClick += new MouseEventHandler(shapeCanvas1_MouseClick);
            shapeCanvas1.LineEndWithFocusChanged += new Slyce.Common.Controls.Diagramming.Shapes.ShapeCanvas.LineEndWithFocusChangedDelegate(this.shapeCanvas1_LineEndWithFocusChanged);
            shapeCanvas1.MouseMove += new MouseEventHandler(shapeCanvas1_MouseMove);

            //PopulateTableToolstrip();
            //PopulateEntityToolstrip();

            MappingEditor.Visible         = false;
            MappingEditor.VisibleChanged += new EventHandler(MappingEditor_VisibleChanged);

            this.Controls.Add(MappingEditor);
        }
Пример #4
0
        public string SaveRawCategory(AddRawCategoryModel model)
        {
            RawCategory tb        = new RawCategory();
            var         duplicate = _entities.RawCategories.Where(o => o.Name.Equals(model.Name) && o.Active.Equals(model.Active)).SingleOrDefault();

            if (duplicate == null)
            {
                try
                {
                    if (model.RawCategoryId != 0)
                    {
                        tb        = _entities.RawCategories.Where(x => x.RawCategoryID == model.RawCategoryId).SingleOrDefault();
                        tb.Name   = model.Name;
                        tb.Active = model.Active;
                        _entities.SaveChanges();
                        return("Record Updated Successfully...");
                    }
                    else
                    {
                        tb.Name   = model.Name;
                        tb.Active = model.Active;
                        _entities.RawCategories.Add(tb);
                        _entities.SaveChanges();
                        return("Record Saved Successfully...");
                    }
                }
                catch
                {
                    return("something Wrong try Agian !");
                }
            }
            else
            {
                return(model.Name + "Already Exits");
            }
        }
        private void Draw()
        {
            if (ComponentSpecification == null)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;
            Font boldFont = new Font(Font, FontStyle.Bold);

            MainShape = new RawComponent(shapeCanvas1, ComponentSpecification.Name, boldFont, ComponentSpecification);
            MainShape.Categories.Clear();

            RawCategory cat = new RawCategory("Properties", Font, MainShape);

            MainShape.Categories.Add(cat);

            foreach (var x in ComponentSpecification.Properties)
            {
                //RawProperty prop = new RawProperty(string.Format("{0} [{1}]", x.Name, x.Type), x);
                RawProperty prop = new RawProperty(x.Name, x);
                cat.Properties.Add(prop);
            }

            //centreShape.Icon = EntityImage;
            //centreShape.Enter += new EventHandler(centreShape_Enter);
            //centreShape.Leave += new EventHandler(centreShape_Leave);
            Font            boldUnderlineFont  = new Font(Font, FontStyle.Bold | FontStyle.Underline);
            List <RawShape> topLevelShapes     = new List <RawShape>();
            List <RawShape> rightAlignedShapes = new List <RawShape>();

            #region References

            foreach (ComponentImpl component in ComponentSpecification.ImplementedComponents)
            {
                RawEntity     referencedEntityShape;
                CustomLineCap startCap;
                CustomLineCap endCap;

                referencedEntityShape = new RawEntity(shapeCanvas1, component.ParentEntity.Name, boldFont, component.ParentEntity);
                //string end1 = ArchAngel.Interfaces.Cardinality.One.Equals(reference.Cardinality2) ? "1" : "m";
                //startCap = ArchAngel.Interfaces.Cardinality.One.Equals(reference.Cardinality2) ? LineCaps.One : LineCaps.Many;
                //endCap = ArchAngel.Interfaces.Cardinality.One.Equals(reference.Cardinality1) ? LineCaps.One : LineCaps.Many;
                referencedEntityShape.OriginatingLineStyle.EndTextDataMember = "Name";
                //referencedEntityShape.OriginatingLineStyle.EndTextDataMember = "End2Name";
                //referencedEntityShape.OriginatingLineStyle.StartImageClick += new LinkLine.MouseEndDelegate(OriginatingLineStyle_StartImageClick);
                //referencedEntityShape.OriginatingLineStyle.EndImageClick += new LinkLine.MouseEndDelegate(OriginatingLineStyle_EndImageClick);
                //referencedEntityShape.OriginatingLineStyle.MouseOverEnd1 += new LinkLine.MouseOverEndDelegate(OriginatingLineStyle_MouseOverEnd2);
                //referencedEntityShape.OriginatingLineStyle.MouseOverEnd2 += new LinkLine.MouseOverEndDelegate(OriginatingLineStyle_MouseOverEnd1);


                referencedEntityShape.Icon = EntityImage;
                referencedEntityShape.OriginatingLineStyle.LineStyle = DashStyle.Solid;
                //referencedEntityShape.OriginatingLineStyle.StartCap = startCap;
                //referencedEntityShape.OriginatingLineStyle.EndCap = endCap;
                referencedEntityShape.OriginatingLineStyle.DataObject     = component;
                referencedEntityShape.OriginatingLineStyle.ForeColor      = Color.White;
                referencedEntityShape.OriginatingLineStyle.DefaultEndText = "";
                //referencedEntityShape.OriginatingLineStyle.StartImage = EditImage;
                //referencedEntityShape.OriginatingLineStyle.EndImage = EditImage;
                referencedEntityShape.OriginatingLineStyle.MiddleImage       = InfoImage;
                referencedEntityShape.OriginatingLineStyle.MiddleImageClick += new MouseEventHandler(OriginatingLineStyle_MiddleImageClick);
                referencedEntityShape.MouseDoubleClick += new MouseEventHandler(referencedEntityShape_MouseDoubleClick);
                referencedEntityShape.MouseClick       += new MouseEventHandler(referencedEntityShape_MouseClick);
                referencedEntityShape.Cursor            = Cursors.Hand;
                topLevelShapes.Add(referencedEntityShape);
            }
            // Add empty reference
            RawShape emptyReference = new RawShape(shapeCanvas1, "Add entity...", boldUnderlineFont)
            {
                BackColor1           = Color.White,
                BackColor2           = Color.White,
                BorderColor          = Color.Gray,
                ForeColor            = Color.Gray,
                FocusForeColor       = Color.Blue,
                FocusBackColor1      = Color.WhiteSmoke,
                FocusBackColor2      = Color.White,
                FocusBorderColor     = Color.DarkGray,
                Cursor               = Cursors.Hand,
                OriginatingLineStyle = null,                // new LinkLine(boldFont, DashStyle.Dot, "", "", "", LineCaps.None, LineCaps.SolidArrow),
                Tag = null
            };
            //emptyReference.OriginatingLineStyle.ForeColor = Color.White;
            emptyReference.MouseClick += new MouseEventHandler(emptyReference_MouseClick);
            topLevelShapes.Add(emptyReference);
            #endregion

            shapeCanvas1.SwimLane1 = new ShapeCanvas.SwimLaneStyle(Color.Gray, Color.Black, Color.White, 180F, "Used By (Entities)", ShapeCanvas.SwimLaneStyle.Styles.Fill);
            //shapeCanvas1.SwimLane3 = new ShapeCanvas.SwimLaneStyle(Color.FromArgb(79, 124, 205), Color.Black, Color.White, 0F, "Mapped Tables", ShapeCanvas.SwimLaneStyle.Styles.Fill);

            shapeCanvas1.BackColor             = this.BackColor;
            shapeCanvas1.Height                = this.Height;
            shapeCanvas1.KeepMainShapeCentered = true;
            shapeCanvas1.DrawThreeLayerHorizontal(MainShape, topLevelShapes, rightAlignedShapes, KeepMainShapeFull);
            Cursor = Cursors.Default;
        }
Пример #6
0
 public Category(RawCategory rawCategory)
 {
     FoursquareId = rawCategory.Id;
     Name         = rawCategory.Name;
 }