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;
            }
        }
        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;
            }
        }
        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;
            }
        }
        public void DeleteGallery(int galleryId)
        {
            try
            {

                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var remove = (from aremove in vdc.Galleries
                                  where aremove.GalleryId == galleryId
                                  select aremove).FirstOrDefault();

                    if (remove != null)
                    {
                        vdc.Galleries.DeleteOnSubmit(remove);
                        vdc.SubmitChanges();
                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        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;
            }
        }
        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;
            }
        }
        public ContactModel GenerateContactModel()
        {
            try
            {

                ContactModel model = new ContactModel();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {

                    var table = from p in vdc.Contacts.ToList()
                                  select p;

                    model = new ContactModel();
                    model.CompanyName = table.FirstOrDefault().CompanyName;
                    model.ContactId = table.FirstOrDefault().ContactId;

                    return model;
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        public ContactAdditionalModel GenerateContactAdditionalModelById(int id)
        {
            try
            {

                ContactAdditionalModel model = new ContactAdditionalModel();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {

                    var table = from p in vdc.ContactAdditionals.ToList()
                                where p.ContactAdditionalId == id
                                select p;

                    model = new ContactAdditionalModel();
                    model.ContactAdditionalId = table.FirstOrDefault().ContactAdditionalId;
                    model.ContactTitle = table.FirstOrDefault().ContactTitle;
                    model.ContactDescription = table.FirstOrDefault().ContactDescription;
                    return model;
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #9
0
        public void DeleteHeader(int productLabelId)
        {
            try
            {

                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var remove = (from aremove in vdc.ProductHeaders
                                  where aremove.ProductLabelId == productLabelId
                                  select aremove).FirstOrDefault();

                    if (remove != null)
                    {
                        vdc.ProductHeaders.DeleteOnSubmit(remove);
                        vdc.SubmitChanges();
                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #10
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;
            }
        }
        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;
            }
        }
Example #12
0
        public void UpdatePromo(PromoModel model)
        {
            try
            {
                Promo table = new Promo();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table = vdc.Promos.Single(a => a.PromoId == model.PromoId);
                    table.PromoId = model.PromoId;
                    table.PromoTitle = model.PromoTitle;
                    table.PromoDescription = model.PromoDescription;
                    table.ImageString = model.ImageString;
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #13
0
        public AboutUsModel GenerateAboutUsModel()
        {
            AboutUsModel aum = new AboutUsModel();
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var aboutus = from about in vdc.AboutUs.ToList()
                                  orderby about.AboutUsId ascending
                                  select about;
                    aum = new AboutUsModel();
                    aum.AboutUsId = aboutus.FirstOrDefault().AboutUsId;
                    aum.AboutUsParagraph = aboutus.FirstOrDefault().AboutUsParagraph;
                    aum.AboutUsTitle = aboutus.FirstOrDefault().AboutUsTitle;
                    aum.ImageUrl = aboutus.FirstOrDefault().ImageUrl;
                    return aum;
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #14
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;
            }
        }
Example #15
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;
            }
        }
Example #16
0
        public void InsertPriceList(PriceListModel model)
        {
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    PriceList table = new PriceList();
                    table.ProductCategoryId = model.ProductCategoryId;
                    table.ProductName = model.ProductName;
                    table.ProductDescription = model.ProductDescription;
                    table.Price = model.Price;

                    vdc.PriceLists.InsertOnSubmit(table);
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #17
0
        public List<ProductHeaderModel> GetProductHeaderByProductCategoryId(int productCategoryId)
        {
            List<ProductHeaderModel> modelList = new List<ProductHeaderModel>();
            ProductHeaderModel model = new ProductHeaderModel();
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.ProductHeaders.ToList()
                                       where p.ProductCategoryId == productCategoryId
                                       orderby p.ProductLabelId ascending
                                       select p;

                    foreach (var item in list)
                    {
                        model = new ProductHeaderModel();
                        model.ProductLabelId = item.ProductLabelId;
                        model.ProductCategoryId = item.ProductCategoryId;
                        model.ProductTableTitleDescription = item.ProductTableTitleDescription;
                        modelList.Add(model);
                    }

                    return modelList;

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #18
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;
            }
        }
Example #19
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;
            }
        }
Example #20
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;
            }
        }
Example #21
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;
            }
        }
Example #22
0
        public ContactNumbersModel GenerateContactNumbersModelById(int contactNumberId)
        {
            try
            {

                ContactNumbersModel model = new ContactNumbersModel();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {

                    var table = from p in vdc.ContactNumbers.ToList()
                                where p.ContactNumberId == contactNumberId
                                  select p;

                    model = new ContactNumbersModel();
                    model.ContactNumber = table.FirstOrDefault().ContactNumber1;
                    model.ContactNumberId = table.FirstOrDefault().ContactNumberId;

                    return model;
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #23
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;
            }
        }
Example #24
0
        public void UpdateAboutUs(AboutUsModel aum)
        {
            try
            {
                AboutUs au = new AboutUs();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    au = vdc.AboutUs.Single(a => a.AboutUsId == aum.AboutUsId);
                    au.AboutUsId = aum.AboutUsId;
                    au.AboutUsParagraph = aum.AboutUsParagraph;
                    au.AboutUsTitle = aum.AboutUsTitle;

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

                throw ex;
            }
        }
Example #25
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;
            }
        }
Example #26
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;
            }
        }
Example #27
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;
            }
        }
Example #28
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;
            }
        }
Example #29
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;
            }
        }
Example #30
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;
            }
        }