コード例 #1
0
        public ProductsListModel GetProductsListModelByProductId(int productId)
        {
            ProductsListModel model = new ProductsListModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var productsList = from p in vdc.ProductsLists.ToList()
                                       where p.ProductId == productId
                                       select p;

                    model                    = new ProductsListModel();
                    model.ProductsId         = productsList.FirstOrDefault().ProductId;
                    model.MainDescription    = productsList.FirstOrDefault().MainDescription;
                    model.DetailsDescription = productsList.FirstOrDefault().DetailsDescription;

                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public List <ProductsListModel> GenerateProductsListModel()
        {
            List <ProductsListModel> plmList = new List <ProductsListModel>();
            ProductsListModel        plm     = new ProductsListModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var productsList = from p in vdc.ProductsLists.ToList()
                                       orderby p.ProductId ascending
                                       select p;

                    foreach (var item in productsList)
                    {
                        plm                    = new ProductsListModel();
                        plm.ProductsId         = item.ProductId;
                        plm.MainDescription    = item.MainDescription;
                        plm.DetailsDescription = item.DetailsDescription;
                        plmList.Add(plm);
                    }

                    return(plmList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public ProductHeaderModel GetProductHeaderByHeaderId(int productLabelId)
        {
            ProductHeaderModel model = new ProductHeaderModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.ProductHeaders.ToList()
                               where p.ProductLabelId == productLabelId
                               select p;
                    if (list != null)
                    {
                        model.ProductCategoryId            = list.FirstOrDefault().ProductCategoryId;
                        model.ProductLabelId               = list.FirstOrDefault().ProductLabelId;
                        model.ProductTableTitleDescription = list.FirstOrDefault().ProductTableTitleDescription;
                    }

                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        public ProductsMainModel GenerateProductsMainModel()
        {
            ProductsMainModel pmm = new ProductsMainModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var productsMain = from p in vdc.ProductsMains.ToList()
                                       orderby p.ProductsMainId ascending
                                       select p;
                    if (productsMain.FirstOrDefault() != null)
                    {
                        pmm = new ProductsMainModel();
                        pmm.ProductsMainId            = productsMain.FirstOrDefault().ProductsMainId;
                        pmm.ImageURLString            = productsMain.FirstOrDefault().ImageURLString;
                        pmm.ProductMainParagraph      = productsMain.FirstOrDefault().ProductMainParagraph;
                        pmm.ProductSubParagraph       = productsMain.FirstOrDefault().ProductSubParagraph;
                        pmm.ProductMainParagraphTitle = productsMain.FirstOrDefault().ProductMainParagraphTitle;
                        pmm.ProductSubParagraphTitle  = productsMain.FirstOrDefault().ProductSubParagraphTitle;
                    }

                    return(pmm);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        public List <ProductCategoryModel> GenerateProductCategoryModel()
        {
            List <ProductCategoryModel> modelList = new List <ProductCategoryModel>();
            ProductCategoryModel        model     = new ProductCategoryModel();
            ProductHeaderModel          model2    = new ProductHeaderModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.ProductCategories.ToList()
                               orderby p.ProductCategoryId ascending
                               select p;

                    foreach (var item in list)
                    {
                        model = new ProductCategoryModel();
                        model.ProductCategoryId = item.ProductCategoryId;
                        model.ProductCategory   = item.ProductCategory1;
                        //model.ProductHeaderModel = GetProductHeaderByProductCategoryId(item.ProductCategoryId);
                        model.PriceListModel = GetPriceListByProductCategoryId(item.ProductCategoryId);
                        modelList.Add(model);
                    }

                    return(modelList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        public ServicesModel GetServicesModelByServiceId(int id)
        {
            ServicesModel model = new ServicesModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var tableList = from p in vdc.Services.ToList()
                                    where p.ServicesId == id
                                    select p;

                    model                    = new ServicesModel();
                    model.ServicesId         = tableList.FirstOrDefault().ServicesId;
                    model.ServiceName        = tableList.FirstOrDefault().ServiceName;
                    model.ServiceSubTitle    = tableList.FirstOrDefault().ServiceSubTitle;
                    model.ServiceDescription = tableList.FirstOrDefault().ServiceDescription;
                    model.ImageString        = tableList.FirstOrDefault().ImageString;

                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
        public List <ServicesModel> GenerateServiceModelByServicesIds(int[] servicesIds)
        {
            try
            {
                List <ServicesModel> modelList = new List <ServicesModel>();
                ServicesModel        model     = new ServicesModel();
                foreach (var item in servicesIds)
                {
                    using (VenturadaDataContext vdc = new VenturadaDataContext())
                    {
                        var tableList = from p in vdc.Services.ToList()
                                        where p.ServicesId == (int)item
                                        select p;

                        model                    = new ServicesModel();
                        model.ServicesId         = tableList.FirstOrDefault().ServicesId;
                        model.ServiceName        = tableList.FirstOrDefault().ServiceName;
                        model.ServiceSubTitle    = tableList.FirstOrDefault().ServiceSubTitle;
                        model.ServiceDescription = tableList.FirstOrDefault().ServiceDescription;
                        model.ImageString        = tableList.FirstOrDefault().ImageString;
                    }
                    modelList.Add(model);
                }
                return(modelList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        public List <ServicesModel> GenerateServicesModel()
        {
            List <ServicesModel> modelList = new List <ServicesModel>();
            ServicesModel        model     = new ServicesModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var tableList = from p in vdc.Services.ToList()
                                    orderby p.ServicesId ascending
                                    select p;

                    foreach (var item in tableList)
                    {
                        model                    = new ServicesModel();
                        model.ServicesId         = item.ServicesId;
                        model.ServiceName        = item.ServiceName;
                        model.ServiceSubTitle    = item.ServiceSubTitle;
                        model.ServiceDescription = item.ServiceDescription;
                        model.ImageString        = item.ImageString;
                        modelList.Add(model);
                    }

                    return(modelList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #9
0
        public GalleryModel GetGalleryById(int id)
        {
            GalleryModel model = new GalleryModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var tableList = from p in vdc.Galleries.ToList()
                                    where p.GalleryId == id
                                    orderby p.GalleryId ascending
                                    select p;

                    model                    = new GalleryModel();
                    model.GalleryId          = tableList.FirstOrDefault().GalleryId;
                    model.GalleryDescription = tableList.FirstOrDefault().GalleryDescription;
                    model.GalleryTitle       = tableList.FirstOrDefault().GalleryTitle;
                    model.ImageString        = tableList.FirstOrDefault().ImageString;

                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #10
0
        public List <GalleryModel> GenerateGalleryByRow(int row)
        {
            List <GalleryModel> modelList = new List <GalleryModel>();
            GalleryModel        model     = new GalleryModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var tableList = from p in vdc.Galleries.ToList()
                                    where p.Row == row
                                    orderby p.GalleryId ascending
                                    select p;
                    foreach (var item in tableList)
                    {
                        model                    = new GalleryModel();
                        model.GalleryId          = item.GalleryId;
                        model.GalleryDescription = item.GalleryDescription;
                        model.GalleryTitle       = item.GalleryTitle;
                        model.Row                = item.Row;
                        model.ImageString        = item.ImageString;
                        modelList.Add(model);
                    }


                    return(modelList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #11
0
        public List <PriceListModel> GetPriceListByProductCategoryId(int productCategoryId)
        {
            List <PriceListModel> modelList = new List <PriceListModel>();
            PriceListModel        model     = new PriceListModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.PriceLists.ToList()
                               where p.ProductCategoryId == productCategoryId
                               orderby p.PriceListId ascending
                               select p;

                    foreach (var item in list)
                    {
                        model                    = new PriceListModel();
                        model.PriceListId        = item.PriceListId;
                        model.ProductCategoryId  = item.ProductCategoryId;
                        model.ProductName        = item.ProductName;
                        model.ProductDescription = item.ProductDescription;
                        model.Price              = item.Price;
                        modelList.Add(model);
                    }


                    return(modelList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #12
0
        public List <PartnersModel> GeneratePartnerModel()
        {
            try
            {
                List <PartnersModel> pmList = new List <PartnersModel>();
                PartnersModel        pm     = new PartnersModel();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var partner = from p in vdc.Partners.ToList()
                                  orderby p.PartnerId ascending
                                  select p;

                    foreach (var item in partner)
                    {
                        pm             = new PartnersModel();
                        pm.PartnerId   = item.PartnerId;
                        pm.ImageUrl    = item.ImageUrl;
                        pm.Description = item.Description;
                        pm.Sequence    = item.Sequence;
                        pmList.Add(pm);
                    }
                    return(pmList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #13
0
        public ProductCategoryModel GetProductCategoryModelByProductCategoryId(int productCategoryId)
        {
            ProductCategoryModel model = new ProductCategoryModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.ProductCategories.ToList()
                               where p.ProductCategoryId == productCategoryId
                               select p;
                    if (list != null)
                    {
                        model.ProductCategoryId = list.FirstOrDefault().ProductCategoryId;
                        model.ProductCategory   = list.FirstOrDefault().ProductCategory1;
                    }



                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #14
0
        public PromoModel GeneratePromoModel()
        {
            PromoModel model = new PromoModel();

            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var tableList = from p in vdc.Promos.ToList()
                                    orderby p.PromoId ascending
                                    select p;
                    if (tableList != null)
                    {
                        if (tableList.FirstOrDefault() != null)
                        {
                            model                  = new PromoModel();
                            model.PromoId          = tableList.FirstOrDefault().PromoId;
                            model.PromoTitle       = tableList.FirstOrDefault().PromoTitle;
                            model.PromoDescription = tableList.FirstOrDefault().PromoDescription;
                            model.ImageString      = tableList.FirstOrDefault().ImageString;
                        }
                    }

                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #15
0
        public AddressModel GenerateAddressModel()
        {
            try
            {
                AddressModel model = new AddressModel();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var table = from p in vdc.Addresses.ToList()
                                select p;

                    model              = new AddressModel();
                    model.AddressId    = table.FirstOrDefault().AddressId;
                    model.AddressLine1 = table.FirstOrDefault().AddressLine1;
                    model.AddressLine2 = table.FirstOrDefault().AddressLine2;
                    model.Country      = table.FirstOrDefault().Country;
                    model.PostCode     = table.FirstOrDefault().PostCode;

                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #16
0
        public void InsertPartner(string imageURL)
        {
            try
            {
                int sequence = 0;

                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var partner = from p in vdc.Partners.ToList()
                                  orderby p.Sequence descending
                                  select p;
                    if (partner.Count() > 0)
                    {
                        sequence = partner.First().Sequence + 1;
                    }
                    else
                    {
                        sequence = 1;
                    }
                }
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    Partner receivedPM = new Partner();
                    receivedPM.ImageUrl = imageURL;
                    receivedPM.Sequence = sequence;

                    vdc.Partners.InsertOnSubmit(receivedPM);
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #17
0
 public void UpdateHeader(ProductHeaderModel model)
 {
     try
     {
         ProductHeader table = new ProductHeader();
         using (VenturadaDataContext vdc = new VenturadaDataContext())
         {
             table = vdc.ProductHeaders.Single(a => a.ProductLabelId == model.ProductLabelId);
             table.ProductTableTitleDescription = model.ProductTableTitleDescription;
             vdc.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #18
0
        public void UpdateEmailAddress(int emailAddressId, string emailAddress)
        {
            try
            {
                EmailAddress table = new EmailAddress();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table = vdc.EmailAddresses.Single(a => a.EmailAddressId == emailAddressId);
                    table.EmailAddress1 = emailAddress;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #19
0
        public void UpdateContactNumbers(int contactNumberId, string contactNumber)
        {
            try
            {
                ContactNumber table = new ContactNumber();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table = vdc.ContactNumbers.Single(a => a.ContactNumberId == contactNumberId);
                    table.ContactNumber1 = contactNumber;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #20
0
        public void UpdateCompanyName(int contactId, string companyName)
        {
            try
            {
                Contact table = new Contact();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table             = vdc.Contacts.Single(a => a.ContactId == contactId);
                    table.CompanyName = companyName;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #21
0
 public void UpdateProductCategory(ProductCategoryModel pcm)
 {
     try
     {
         ProductCategory table = new ProductCategory();
         using (VenturadaDataContext vdc = new VenturadaDataContext())
         {
             table = vdc.ProductCategories.Single(a => a.ProductCategoryId == pcm.ProductCategoryId);
             table.ProductCategoryId = pcm.ProductCategoryId;
             table.ProductCategory1  = pcm.ProductCategory;
             vdc.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #22
0
        public void InsertProductCategory(ProductCategoryModel pcm)
        {
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    ProductCategory receivedPM = new ProductCategory();
                    receivedPM.ProductCategory1 = pcm.ProductCategory;

                    vdc.ProductCategories.InsertOnSubmit(receivedPM);
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #23
0
        public void UpdateShoppingHours(int id, string description)
        {
            try
            {
                ShoppingHour table = new ShoppingHour();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table = vdc.ShoppingHours.Single(a => a.ShoppingHoursId == id);
                    table.ShoppingHours = description;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #24
0
        public void UpdateAboutUsImage(int aboutUsId, string imageUrl)
        {
            try
            {
                AboutUs au = new AboutUs();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    au          = vdc.AboutUs.Single(a => a.AboutUsId == aboutUsId);
                    au.ImageUrl = imageUrl;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #25
0
        public void UpdateProductsMainImage(int id, string imageUrl)
        {
            try
            {
                ProductsMain au = new ProductsMain();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    au = vdc.ProductsMains.Single(a => a.ProductsMainId == id);
                    au.ImageURLString = imageUrl;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #26
0
        public void UpdateSocialMedia(int id, string description)
        {
            try
            {
                SocialMedia table = new SocialMedia();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table = vdc.SocialMedias.Single(a => a.SocialMediaId == id);
                    table.SocialMediaUrl = description;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #27
0
        public void InsertProductHeader(ProductHeaderModel model)
        {
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    ProductHeader table = new ProductHeader();
                    table.ProductTableTitleDescription = model.ProductTableTitleDescription;
                    table.ProductCategoryId            = model.ProductCategoryId;

                    vdc.ProductHeaders.InsertOnSubmit(table);
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #28
0
        public void InsertProductList(ProductsListModel plm)
        {
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    ProductsList receivedPM = new ProductsList();
                    receivedPM.MainDescription    = plm.MainDescription;
                    receivedPM.DetailsDescription = plm.DetailsDescription;

                    vdc.ProductsLists.InsertOnSubmit(receivedPM);
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #29
0
 public void UpdatePriceList(PriceListModel model)
 {
     try
     {
         PriceList table = new PriceList();
         using (VenturadaDataContext vdc = new VenturadaDataContext())
         {
             table = vdc.PriceLists.Single(a => a.PriceListId == model.PriceListId);
             table.ProductDescription = model.ProductDescription;
             table.ProductName        = model.ProductName;
             table.Price = model.Price;
             vdc.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #30
0
        public void UpdateContactAdditional(int id, string title, string description)
        {
            try
            {
                ContactAdditional table = new ContactAdditional();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table = vdc.ContactAdditionals.Single(a => a.ContactAdditionalId == id);
                    table.ContactDescription = description;
                    table.ContactTitle       = title;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }