Exemplo n.º 1
0
        public void DeleteData(int IDDetail)
        {
            DetailDocument de = db.DetailDocuments.Where(x => x.IDDetail == IDDetail).SingleOrDefault();

            db.DetailDocuments.DeleteOnSubmit(de);
            db.SubmitChanges();
        }
Exemplo n.º 2
0
        public static MasterDocument BuildSimpleMasterAndDetail(out DetailDocument detail)
        {
            var master = new MasterDocument
            {
                Id   = 1,
                Name = "Chips",
                DetailPlaceHolders = new DocumentPlaceholderCollection <DetailDocument, WhatMasterNeedsToKnowAboutDetail>()
            };

            var masterData = new WhatDetailNeedsToKnowAboutMaster {
                Name = master.Name
            };

            detail = new DetailDocument
            {
                Id   = 25,
                Name = "Cheetos"
            };
            var detailData = new WhatMasterNeedsToKnowAboutDetail {
                Name = detail.Name
            };


            detail.MasterDocumentPointer =
                DocumentPlaceholder <MasterDocument, WhatDetailNeedsToKnowAboutMaster>
                .CreatePlaceholderAndUpdateReverseCollection(master.Id, masterData, master.DetailPlaceHolders, detail.Id, detailData);

            return(master);
        }
Exemplo n.º 3
0
        private static void AssertPointIdAndKeyOnCollectionReverse(DetailDocument detail)
        {
            var placeholder = detail.MasterDocumentPointer;

            Assert.IsNotNull(placeholder);
            Assert.AreEqual("MasterDocuments/1", placeholder.DocKey);
            Assert.AreEqual("Chips", placeholder.Data.Name);
        }
Exemplo n.º 4
0
        public void Should_serialize_collection_pointers_reversely()
        {
            DetailDocument detail;

            Helpers.BuildSimpleMasterAndDetail(out detail);
            DetailDocument detail2 = Helpers.SerializeCopyWithJSON(detail);

            AssertPointIdAndKeyOnCollectionReverse(detail2);
        }
Exemplo n.º 5
0
        public void UpdateData(int IDDetail, string StyleNo, string MaterialStyle, string MaterialDetails, string Unit, float NumberRequest, float NumberReceived, decimal price, decimal TotalAmount)
        {
            DetailDocument de = db.DetailDocuments.Where(x => x.IDDetail == IDDetail).SingleOrDefault();

            de.StyleNo         = StyleNo;
            de.MaterialStyle   = MaterialStyle;
            de.MaterialDetails = MaterialDetails;
            de.Unit            = Unit;
            de.NumberRequest   = NumberRequest;
            de.NumberReceived  = NumberReceived;
            de.Price           = price;
            de.TotalAmount     = TotalAmount;
            db.SubmitChanges();
        }
Exemplo n.º 6
0
        public void InsertData(int IDDocument, string StyleNo, string MaterialStyle, string MaterialDetails, string Unit, float NumberRequest, float NumberReceived, decimal price, decimal TotalAmount)
        {
            DetailDocument de = new DetailDocument();

            de.IDDocument      = IDDocument;
            de.StyleNo         = StyleNo;
            de.MaterialStyle   = MaterialStyle;
            de.MaterialDetails = MaterialDetails;
            de.Unit            = Unit;
            de.NumberRequest   = NumberRequest;
            de.NumberReceived  = NumberReceived;
            de.Price           = price;
            de.TotalAmount     = TotalAmount;
            db.DetailDocuments.InsertOnSubmit(de);
            db.SubmitChanges();
        }
 private static void AssertPointIdAndKeyOnCollectionReverse(DetailDocument detail)
 {
     var placeholder = detail.MasterDocumentPointer;
     Assert.IsNotNull(placeholder);
     Assert.AreEqual("MasterDocuments/1", placeholder.DocKey);
     Assert.AreEqual("Chips", placeholder.Data.Name);
 }