示例#1
0
        private async Task SeedArticle()
        {
            var col = await InitCollection <Article>("article");

            var articles = new List <Article>()
            {
                new Article()
                {
                    Code = "XC10<3", Type = "TO", Densite = 8.0f, Prix = 0.75f
                },
                new Article()
                {
                    Code = "XC10>=3", Type = "TO", Densite = 8.0f, Prix = 0.68f
                },
                new Article()
                {
                    Code = "215", Type = "MO", Designation = "Laser Bystronic", TxPrep = 70, TxOpe = 110, TpPrep = 0.0f, TpBase = 0.0f
                },
                new Article()
                {
                    Code = "300", Type = "MO", Designation = "Pliage", TxPrep = 60, TxOpe = 80, TpPrep = 0.0f, TpBase = 0.0f
                },
                new Article()
                {
                    Code = "ARTICLE TEST", Designation = "Designation test", Type = "CH"
                }
            };
            await col.InsertManyAsync(articles);

            var art = await ArticleRepo.GetAsync(art => art.Code == "ARTICLE TEST");

            var nome = await ArticleRepo.GetAsync(art => art.Code == "XC10>=3");

            var ope = await ArticleRepo.GetAsync(art => art.Code == "215");

            var ope1 = await ArticleRepo.GetAsync(art => art.Code == "300");

            art.Nomenclatures = new List <Nomenclature>()
            {
                new Nomenclature()
                {
                    Code = nome.Id, Operation = 10, Quantite = 0.5f
                }
            };
            art.Operations = new List <Operation>()
            {
                new Operation()
                {
                    Code = ope.Id, Ordre = 10, Nombre = 2, TxPrep = ope.TxPrep, TxOpe = ope.TxOpe, TpPrep = ope.TpPrep, TpOpe = ope.TpOpe, BaseOpe = 0.5f
                },
                new Operation()
                {
                    Code = ope1.Id, Ordre = 20, Nombre = 5, TxPrep = ope1.TxPrep, TxOpe = ope1.TxOpe, TpPrep = ope1.TpPrep, TpOpe = ope1.TpOpe, BaseOpe = 0.003f
                }
            };
            await ArticleRepo.UpdateAsync(art);
        }