コード例 #1
0
        public void UpdateVendor(skvendors VendorObj)
        {
            dtVendor Vendor = DB.dtVendors.Single(x => x.vID == VendorObj.VendorID);

            Vendor.VendorsName      = VendorObj.VendorsName;
            Vendor.VendorsDescption = VendorObj.VendorsDescption;
            Vendor.OnlineVender     = VendorObj.onlineVendor;
            Vendor.AddresseID       = VendorObj.CurrentAddress.AddressID;

            DB.SubmitChanges();
        }
コード例 #2
0
        public void AddNewAddress(skAddresses AddressObject, int ObjectID, Type ObjectType)
        {
            if (ObjectType.Name == "skPerson")
            {
                dtAddress NewAdress = new dtAddress
                {
                    AddressLine1 = AddressObject.AddressLine1,
                    AddressLine2 = AddressObject.AddressLine2,
                    AddressLine3 = AddressObject.AddressLine3,
                    Country      = AddressObject.Country,
                    County       = AddressObject.County,
                    PostCode     = AddressObject.PostCode,
                    Town         = AddressObject.Town,
                    isActive     = true,
                    Created      = DateTime.Now,
                    Updated      = DateTime.Now
                };

                dtAddressPersonRelationShip relationship = new dtAddressPersonRelationShip
                {
                    dtAddress = NewAdress,
                    PersonID  = ObjectID
                };

                DB.dtAddressPersonRelationShips.InsertOnSubmit(relationship);
                DB.SubmitChanges();
            }
            else
            {
                dtAddress NewAdress = new dtAddress
                {
                    AddressLine1 = AddressObject.AddressLine1,
                    AddressLine2 = AddressObject.AddressLine2,
                    AddressLine3 = AddressObject.AddressLine3,
                    Country      = AddressObject.Country,
                    County       = AddressObject.County,
                    PostCode     = AddressObject.PostCode,
                    Town         = AddressObject.Town,
                    isActive     = true,
                    Created      = DateTime.Now,
                    Updated      = DateTime.Now
                };


                DB.dtAddresses.InsertOnSubmit(NewAdress);
                DB.SubmitChanges();

                dtVendor vendor = DB.dtVendors.Where(x => x.vID == ObjectID).Single();
                vendor.AddresseID = DB.dtAddresses.OrderByDescending(x => x.Created).Single().aID;

                DB.SubmitChanges();
            }
        }
コード例 #3
0
        public bool AddNewVendor(skvendors VendorObj)
        {
            if (VendorObj != null)
            {
                dtVendor NewVendor = new dtVendor
                {
                    VendorsName      = VendorObj.VendorsName,
                    VendorsDescption = VendorObj.VendorsDescption,
                    OnlineVender     = VendorObj.onlineVendor,
                    AddresseID       = Convert.ToInt32(VendorObj.AddresseID)
                };

                DB.dtVendors.InsertOnSubmit(NewVendor);
                DB.SubmitChanges();

                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        public bool AddNewVendor(skvendors VendorObj, skAddresses AddressObject)
        {
            if (VendorObj != null)
            {
                dtVendor NewVendor = new dtVendor
                {
                    VendorsName      = VendorObj.VendorsName,
                    VendorsDescption = VendorObj.VendorsDescption,
                    OnlineVender     = VendorObj.onlineVendor,
                };

                dtAddress NewAdress = new dtAddress
                {
                    AddressLine1 = AddressObject.AddressLine1,
                    AddressLine2 = AddressObject.AddressLine2,
                    AddressLine3 = AddressObject.AddressLine3,
                    Country      = AddressObject.Country,
                    County       = AddressObject.County,
                    PostCode     = AddressObject.PostCode,
                    Town         = AddressObject.Town,
                    isActive     = true
                };

                NewAdress.dtVendors.Add(NewVendor);


                DB.dtAddresses.InsertOnSubmit(NewAdress);
                DB.SubmitChanges();

                return(true);
            }
            else
            {
                return(false);
            }
        }