コード例 #1
0
        public void UpdateMarkerCat(MarkerCategory markerCategory)
        {
            var repo           = new MarkerRespository(Properties.Settings.Default.ManufacturingConStr);
            var prodRepo       = new ProductionRespository(Properties.Settings.Default.ManufacturingConStr);
            var originalMarker = repo.GetMarkerCategory(markerCategory.Id);

            prodRepo.AddNewUpdateHistory(originalMarker, markerCategory.Deleted ? "deleted" : null);
            repo.UpdateMarkerCat(originalMarker.SetOrginalDbObjToUpdated(markerCategory));
        }
コード例 #2
0
        public void AddNewMarkerCat(MarkerCategory markerCategory, Marker defaltMarker)
        {
            var repo = new MarkerRespository(Properties.Settings.Default.ManufacturingConStr);

            repo.AddMarkerCat(markerCategory);
            if (defaltMarker.NotNull())
            {
                defaltMarker.MarkerCatId = markerCategory.Id;
                AddNewMarker(defaltMarker, true);
            }
        }
コード例 #3
0
        public void AddNewMarker(Marker marker, bool makeDefalt)
        {
            var repo = new MarkerRespository(Properties.Settings.Default.ManufacturingConStr);

            repo.AddMarker(marker);
            if (makeDefalt)
            {
                UpdateMarkerCat(new MarkerCategory
                {
                    Id             = marker.MarkerCatId,
                    DefaltMarkerId = marker.Id
                });
            }
        }
コード例 #4
0
        public ActionResult GetMarkerCategory(int id)
        {
            var repo = new MarkerRespository(Properties.Settings.Default.ManufacturingConStr);
            var mc   = repo.GetMarkerCategoryWithMarkers(id);

            return(Json(new
            {
                mc.Id,
                mc.Name,
                mc.CreatedOn,
                mc.BodyStyleId,
                BodyStyle = new
                {
                    mc.BodyStyle.Id,
                    mc.BodyStyle.Name
                },
                mc.DepartmentId,
                Department = new
                {
                    mc.Department.Id,
                    mc.Department.Name
                },
                mc.SleeveId,
                Sleeve = new
                {
                    mc.Sleeve.Id,
                    mc.Sleeve.Name
                },
                mc.ModifiedOn,
                mc.DefaltMarkerId,
                DefaltMarker = mc.Marker != null ? new
                {
                    mc.Marker.Id,
                    mc.Marker.CreatedOn,
                    mc.Marker.ModifiedOn,
                    MarkerDetails = mc.Marker.MarkerDetails.Select(mmd =>
                    {
                        return new
                        {
                            mmd.Id,
                            mmd.SizeId,
                            mmd.AmountPerLayer,
                            Size = new
                            {
                                mmd.Size.Id,
                                mmd.Size.Name
                            },
                        };
                    }),
                    mc.Marker.Length,
                    mc.Marker.PercentWaste
                } :null,
                Markers = mc.Markers != null ? mc.Markers.Select(m =>
                {
                    return new
                    {
                        m.Id,
                        m.CreatedOn,
                        m.ModifiedOn,
                        m.Length,
                        m.PercentWaste,
                        MarkerDetails = m.MarkerDetails.Select(mmd =>
                        {
                            return new
                            {
                                mmd.Id,
                                mmd.SizeId,
                                mmd.AmountPerLayer,
                                Size = new
                                {
                                    mmd.Size.Id,
                                    mmd.Size.Name
                                },
                            };
                        })
                    };
                }):null
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public ActionResult GetMarkeCatsWithMarkers()
        {
            var repo = new MarkerRespository(Properties.Settings.Default.ManufacturingConStr);
            var item = repo.GetMarkerCategoriesWithAllMarkers().Select(mc =>
            {
                //var markerCat = mc.GetObjectBasePropertiesOnDbObject();
                return(new
                {
                    mc.Id,
                    mc.Name,
                    mc.CreatedOn,
                    mc.BodyStyleId,
                    BodyStyle = new
                    {
                        mc.BodyStyle.Id,
                        mc.BodyStyle.Name
                    },
                    mc.DepartmentId,
                    Department = new
                    {
                        mc.Department.Id,
                        mc.Department.Name
                    },
                    mc.SleeveId,
                    Sleeve = new
                    {
                        mc.Sleeve.Id,
                        mc.Sleeve.Name
                    },
                    mc.ModifiedOn,
                    mc.DefaltMarkerId,
                    DefaltMarker = mc.Marker != null ? new
                    {
                        mc.Marker.Id,
                        mc.Marker.CreatedOn,
                        mc.Marker.ModifiedOn,
                        MarkerDetails = mc.Marker.MarkerDetails.Select(mmd =>
                        {
                            return new
                            {
                                mmd.Id,
                                mmd.SizeId,
                                mmd.AmountPerLayer,
                                Size = new
                                {
                                    mmd.Size.Id,
                                    mmd.Size.Name
                                },
                            };
                        }),
                        mc.Marker.Length,
                        mc.Marker.PercentWaste
                    } : null,
                    Markers = mc.Markers != null ?  mc.Markers.Select(m =>
                    {
                        return new
                        {
                            m.Id,
                            m.CreatedOn,
                            m.ModifiedOn,
                            m.Length,
                            m.PercentWaste,
                            MarkerDetails = m.MarkerDetails.Select(mmd =>
                            {
                                return new
                                {
                                    mmd.Id,
                                    mmd.SizeId,
                                    mmd.AmountPerLayer,
                                    Size = new
                                    {
                                        mmd.Size.Id,
                                        mmd.Size.Name
                                    },
                                };
                            })
                        };
                    }) : null
                });

                //markerCat.Marker = mc.Marker.GetObjectBasePropertiesOnDbObject();
                //markerCat.Marker.MarkerCategories = null;
                //markerCat.Markers = mc.Markers.Select(m =>
                //{
                //    var marker = m.GetObjectBasePropertiesOnDbObject();
                //    marker.MarkerCategories = null;
                //    marker.MarkerDetails = m.MarkerDetails.Select(md =>
                //    {
                //        var markerDetails = md.GetObjectBasePropertiesOnDbObject();
                //        markerDetails.Marker = null;
                //        markerDetails.Size = md.Size.GetObjectBasePropertiesOnDbObject();
                //        markerDetails.Size.MarkerDetails = null;
                //        return markerDetails;
                //    }).ToEntitySet();
                //    return marker;
                //}).ToEntitySet();
                //return markerCat;
            }).ToList();
            var x = item;

            return(Json(item, JsonRequestBehavior.AllowGet));
        }