Example #1
0
        public bool GetDependentEntities(out List <Mattresses> list)
        {
            list = new List <Mattresses>();
            List <Toppers> innerList = new List <Toppers>();

            using (PgContext context = new PgContext())
            {
                foreach (var item in context.Toppers)
                {
                    if (item.compositionId != null)
                    {
                        if (item.compositionId == compositionId)
                        {
                            innerList.Add(item);
                        }
                    }
                }
                if (innerList.Count == 0)
                {
                    return(false);
                }
                foreach (var item in context.Mattresses)
                {
                    if (item.topperId != null)
                    {
                        if (innerList.Find(i => i.topperId == item.topperId) != null)
                        {
                            list.Add(item);
                        }
                    }
                }
            }
            return(list.Count > 1 /*!= 0*/);
        }
Example #2
0
        public bool GetDependentEntities(out List <Mattresses> list)
        {
            list = new List <Mattresses>();
            List <Cuts> innerList = new List <Cuts>();

            using (PgContext context = new PgContext())
            {
                foreach (var item in context.Cuts)
                {
                    if (item.topSideCompositionId != null & item.botSideCompositionId != null)
                    {
                        if (item.topSideCompositionId == compositionId | item.botSideCompositionId == compositionId)
                        {
                            innerList.Add(item);
                        }
                    }
                }
                if (innerList.Count == 0)
                {
                    return(false);
                }
                //foreach (var item in innerList)
                //    foreach (var innerItem in context.Mattresses)
                //        if (innerItem.cutId == item.cutId) list.Add(innerItem);
                foreach (var item in context.Mattresses)
                {
                    if (innerList.Find(i => i.cutId == item.cutId) != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list.Count > 1 /*!= 0*/);
        }
Example #3
0
 public bool GetDependentEntities(out List <Mattresses> list)
 {
     list = new List <Mattresses>();
     using (PgContext context = new PgContext())
         foreach (var item in context.Mattresses)
         {
             if (item.compositionId == compositionId)
             {
                 list.Add(item);
             }
         }
     return(list.Count > 1 /*!= 0*/);
 }
Example #4
0
 public bool GetDependentEntities(out List <Mattresses> list)
 {
     list = new List <Mattresses>();
     using (PgContext context = new PgContext())
         foreach (Mattresses item in context.Mattresses)
         {
             if (item.burletId != null)
             {
                 if (item.burletId == burletId)
                 {
                     list.Add(item);
                 }
             }
         }
     return(list.Count > 1 /*!= 0*/);
 }
Example #5
0
        public override string ToString()
        {
            string statusStr = null;

            using (PgContext context = new PgContext())
            {
                statusStr += $"{mattressName}\n";
                statusStr += $"Линия: {context.Series.Find(seriesId).seriesName}\n";

                MtrsCompositions composition = context.MtrsCompositions.Find(compositionId);
                statusStr += "Состав: ";
                if (composition.blockId != null)
                {
                    statusStr += $"Блок: {context.Blocks.Find(composition.blockId).blockName}";
                }
                if (composition.additionalBlockId != null)
                {
                    statusStr += $", {context.Blocks.Find(composition.additionalBlockId).blockName}";
                }
                if (composition.generalComposition != null)
                {
                    statusStr += $"\n{composition.generalComposition}";
                }
                //if (composition.topSideCompositionId != null & composition.botSideCompositionId != null)
                //{
                //    if (composition.topSideCompositionId == composition.botSideCompositionId)
                //        statusStr += $"\n2 стороны: {context.MtrsCompositionSides.Find(composition.topSideCompositionId).composition}";
                //    else
                //        statusStr += $"\n1 сторона: {context.MtrsCompositionSides.Find(composition.topSideCompositionId).composition}" +
                //            $"\n2 сторона: {context.MtrsCompositionSides.Find(composition.botSideCompositionId).composition}";
                //}

                Cuts cut = context.Cuts.Find(cutId);
                statusStr += "\nКрой: ";
                if (cut.cutCase != null)
                {
                    statusStr += $"Чехол: {cut.cutCase}";
                }
                if (cut.topSideCompositionId != null & cut.botSideCompositionId != null)
                {
                    if (cut.topSideCompositionId == cut.botSideCompositionId)
                    {
                        statusStr += $"2 стороны: {context.CutCompositionSides.Find(cut.topSideCompositionId).composition}";
                    }
                    else
                    {
                        statusStr += $"1 сторона: {context.CutCompositionSides.Find(cut.topSideCompositionId).composition}" +
                                     $"\n2 сторона: {context.CutCompositionSides.Find(cut.botSideCompositionId).composition}";
                    }
                }

                if (topperId != null)
                {
                    Toppers topper = context.Toppers.Find(topperId);
                    statusStr += $"\nТоппер:"; // -(?)
                    if (topper.compositionId != null)
                    {
                        statusStr += $"Состав топпера: {context.TopperCompositions.Find(topper.compositionId).composition}";
                        if (context.TopperCompositions.Find(topper.compositionId).description != null)
                        {
                            statusStr += $" ({context.TopperCompositions.Find(topper.compositionId).description})";
                        }
                    }
                    TopperCuts topperCut = context.TopperCuts.Find(topper.cutId);
                    if (topperCut.topSideCompositionId != null & topperCut.botSideCompositionId != null)
                    {
                        statusStr += "\nКрой топпера: ";
                        if (topperCut.topSideCompositionId == topperCut.botSideCompositionId)
                        {
                            statusStr += $"2 стороны: {context.TopperCutCompositiont.Find(topperCut.topSideCompositionId).composition}";
                        }
                        else
                        {
                            statusStr += $"1 сторона: {context.TopperCutCompositiont.Find(topperCut.topSideCompositionId).composition}" +
                                         $"\n2 сторона: {context.TopperCutCompositiont.Find(topperCut.botSideCompositionId).composition}";
                        }
                    }
                    if (topperCut.cutCase != null)
                    {
                        statusStr += $"\nЧехол топпера: {topperCut.cutCase}";
                    }
                }

                if (burletId != null)
                {
                    Burlets burlet = context.Burlets.Find(burletId);
                    statusStr += $"\nБурлет: {burlet.composition}";
                    if (burlet.description != null)
                    {
                        statusStr += $" ({burlet.description})";
                    }
                }

                if (perimetrId != null)
                {
                    statusStr += "\nПериметр: ";
                    Perimetrs perimetr = context.Perimetrs.Find(perimetrId);
                    statusStr += perimetr.reinforcmentMattressMaterialName;
                    statusStr += perimetr.reinforcmentBlockMaterialName;
                    if (perimetr.composition != null)
                    {
                        statusStr += $"/{perimetr.composition}";
                    }
                }
            }
            statusStr += "\n*********************************************************************************************************************************************************************";

            return(statusStr);
        }