private List <ProductManufacturerMappingHelperClass> GetProductManufacturerMappings(ProductManufacturerCollection ExistingProductManufacturerCollection)
        {
            ManufacturerCollection manufacturerCollection       = ManufacturerManager.GetAllManufacturers();
            List <ProductManufacturerMappingHelperClass> result = new List <ProductManufacturerMappingHelperClass>();

            for (int i = 0; i < manufacturerCollection.Count; i++)
            {
                Manufacturer        manufacturer = manufacturerCollection[i];
                ProductManufacturer existingProductManufacturer = null;
                if (ExistingProductManufacturerCollection != null)
                {
                    existingProductManufacturer = ExistingProductManufacturerCollection.FindProductManufacturer(this.ProductId, manufacturer.ManufacturerId);
                }
                ProductManufacturerMappingHelperClass pmm = new ProductManufacturerMappingHelperClass();
                if (existingProductManufacturer != null)
                {
                    pmm.ProductManufacturerId = existingProductManufacturer.ProductManufacturerId;
                    pmm.IsMapped     = true;
                    pmm.IsFeatured   = existingProductManufacturer.IsFeaturedProduct;
                    pmm.DisplayOrder = existingProductManufacturer.DisplayOrder;
                }
                else
                {
                    pmm.DisplayOrder = 1;
                }
                pmm.ManufacturerId   = manufacturer.ManufacturerId;
                pmm.ManufacturerInfo = manufacturer.Name;

                MapState(manufacturer.ManufacturerId, pmm);

                result.Add(pmm);
            }

            return(result);
        }
Beispiel #2
0
        protected void BindGrid()
        {
            ManufacturerCollection manufacturers = ManufacturerManager.GetAllManufacturers();

            gvManufacturers.DataSource = manufacturers;
            gvManufacturers.DataBind();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var carController          = new CarController();
            var detailController       = new DetailController();
            var manufacturerController = new ManufacturerCollection();
            var manufacturerService    = new ManufacturerService();

            var allDetailsController = detailController.GetAll();
            //detailController.Add(null);
            //detailController.Delete(24);
            //var fifthDetail = detailController.GetById(9);
            //detailController.Update(null);

            //var allCarViewModels = carController.GetAll();
            //carController.Add(null);
            //carController.Delete(6);
            //var secondCar = carController.GetCarById(1);
            //carController.Update(null);

            var allManuf      = manufacturerController.GetAll();
            var mostexpensive = manufacturerService.GetMostExpensive();


            Console.ReadKey();
        }
 public ManufacturerCollection FetchAll()
 {
     ManufacturerCollection coll = new ManufacturerCollection();
     Query qry = new Query(Manufacturer.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Beispiel #5
0
 private void WriteManufacturers(StringBuilder sb, ManufacturerCollection manufacturerCollection)
 {
     foreach (Manufacturer manufacturer in manufacturerCollection)
     {
         sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", SEOHelper.GetManufacturerUrl(manufacturer), Server.HtmlEncode(manufacturer.Name));
     }
 }
Beispiel #6
0
        public static ManufacturerCollection LoadInternal()
        {
            Assembly asm    = Assembly.GetExecutingAssembly();
            Stream   stream = asm.GetManifestResourceStream("OpenSkipperApplication.Resources.Manufacturers.N2kDfn.xml");

            ManufacturerCollection newDefns = XmlFileSerializer.Deserialize(stream);

            newDefns.FileType = FileTypeEnum.Internal; // No filename set, instead we set type to internal
            return(newDefns);
        }
        private void WriteManufacturers()
        {
            ManufacturerCollection manufacturers = ManufacturerManager.GetAllManufacturers(false);

            foreach (Manufacturer manufacturer in manufacturers)
            {
                string          url             = SEOHelper.GetManufacturerURL(manufacturer);
                UpdateFrequency updateFrequency = UpdateFrequency.weekly;
                DateTime        updateTime      = manufacturer.UpdatedOn;
                WriteUrlLocation(url, updateFrequency, updateTime);
            }
        }
        private static ManufacturerCollection DBMapping(DBManufacturerCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            ManufacturerCollection collection = new ManufacturerCollection();
            foreach (DBManufacturer dbItem in dbCollection)
            {
                Manufacturer item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
Beispiel #9
0
        protected void BindData()
        {
            ManufacturerCollection manufacturers = ManufacturerManager.GetAllManufacturers();

            if (manufacturers.Count > 0)
            {
                rptrManufacturers.DataSource = manufacturers;
                rptrManufacturers.DataBind();
            }
            else
            {
                this.Visible = false;
            }
        }
Beispiel #10
0
 protected void btnExportXML_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             ManufacturerCollection manufacturers = ManufacturerManager.GetAllManufacturers();
             string xml      = ExportManager.ExportManufacturersToXml(manufacturers);
             string fileName = string.Format("manufacturers_{0}.xml", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"));
             CommonHelper.WriteResponseXml(xml, fileName);
         }
         catch (Exception exc)
         {
             ProcessException(exc);
         }
     }
 }
        private static ManufacturerCollection DBMapping(DBManufacturerCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            ManufacturerCollection collection = new ManufacturerCollection();

            foreach (DBManufacturer dbItem in dbCollection)
            {
                Manufacturer item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
        protected void FillDropDowns()
        {
            ParentCategory.EmptyItemText = GetLocaleResourceString("Admin.Common.All");
            ParentCategory.BindData();

            this.ddlManufacturer.Items.Clear();
            ListItem itemEmptyManufacturer = new ListItem(GetLocaleResourceString("Admin.Common.All"), "0");

            this.ddlManufacturer.Items.Add(itemEmptyManufacturer);
            ManufacturerCollection manufacturers = ManufacturerManager.GetAllManufacturers();

            foreach (Manufacturer manufacturer in manufacturers)
            {
                ListItem item2 = new ListItem(manufacturer.Name, manufacturer.ManufacturerId.ToString());
                this.ddlManufacturer.Items.Add(item2);
            }
        }
        /// <summary>
        /// Gets all manufacturers
        /// </summary>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Manufacturer collection</returns>
        public static ManufacturerCollection GetAllManufacturers(bool showHidden)
        {
            string key  = string.Format(MANUFACTURERS_ALL_KEY, showHidden);
            object obj2 = NopCache.Get(key);

            if (ManufacturerManager.ManufacturersCacheEnabled && (obj2 != null))
            {
                return((ManufacturerCollection)obj2);
            }

            DBManufacturerCollection dbCollection = DBProviderManager <DBManufacturerProvider> .Provider.GetAllManufacturers(showHidden);

            ManufacturerCollection manufacturerCollection = DBMapping(dbCollection);

            if (ManufacturerManager.ManufacturersCacheEnabled)
            {
                NopCache.Max(key, manufacturerCollection);
            }
            return(manufacturerCollection);
        }
Beispiel #14
0
        // File IO
        public static ManufacturerCollection LoadFromFile()
        {
            string fileName = DefDefnFile;

            if (fileName == "")
            {
                return(LoadInternal());
            }

            ManufacturerCollection manufCol = XmlFileSerializer.Deserialize(fileName);

            if (manufCol != null)
            {
                manufCol.FileName = fileName;
                manufCol.FileType = FileTypeEnum.NativeXMLFile;
                return(manufCol);
            }

            return(LoadInternal());
        }
 public ManufacturerCollection FetchByID(object ManufacturerId)
 {
     ManufacturerCollection coll = new ManufacturerCollection().Where("ManufacturerId", ManufacturerId).Load();
     return coll;
 }
Beispiel #16
0
 static Manufacturers()
 {
     _Manufacturers = ManufacturerCollection.LoadFromFile();
 }
 public GetByIdQuery(ManufacturerCollection collection)
 {
     _collection = collection;
 }
        /// <summary>
        /// Export manufacturer list to xml
        /// </summary>
        /// <returns>Result in XML format</returns>
        public static string ExportManufacturersToXML(ManufacturerCollection manufacturers)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter stringWriter = new StringWriter(sb);
            XmlWriter xmlWriter = new XmlTextWriter(stringWriter);
            xmlWriter.WriteStartDocument();
            xmlWriter.WriteStartElement("Manufacturers");
            xmlWriter.WriteAttributeString("Version", SiteHelper.GetCurrentVersion());

            foreach (Manufacturer manufacturer in manufacturers)
            {
                xmlWriter.WriteStartElement("Manufacturer");
                xmlWriter.WriteElementString("ManufacturerID", null, manufacturer.ManufacturerID.ToString());
                xmlWriter.WriteElementString("Name", null, manufacturer.Name);
                xmlWriter.WriteElementString("Description", null, manufacturer.Description);
                xmlWriter.WriteElementString("TemplateID", null, manufacturer.TemplateID.ToString());
                xmlWriter.WriteElementString("MetaKeywords", null, manufacturer.MetaKeywords);
                xmlWriter.WriteElementString("MetaDescription", null, manufacturer.MetaDescription);
                xmlWriter.WriteElementString("MetaTitle", null, manufacturer.MetaTitle);
                xmlWriter.WriteElementString("SEName", null, manufacturer.SEName);
                xmlWriter.WriteElementString("PictureID", null, manufacturer.PictureID.ToString());
                xmlWriter.WriteElementString("PageSize", null, manufacturer.PageSize.ToString());
                xmlWriter.WriteElementString("PriceRanges", null, manufacturer.PriceRanges);
                xmlWriter.WriteElementString("Published", null, manufacturer.Published.ToString());
                xmlWriter.WriteElementString("Deleted", null, manufacturer.Deleted.ToString());
                xmlWriter.WriteElementString("DisplayOrder", null, manufacturer.DisplayOrder.ToString());
                xmlWriter.WriteElementString("CreatedOn", null, manufacturer.CreatedOn.ToString());
                xmlWriter.WriteElementString("UpdatedOn", null, manufacturer.UpdatedOn.ToString());

                xmlWriter.WriteStartElement("Products");
                ProductManufacturerCollection productManufacturers = manufacturer.ProductManufacturers;
                foreach (ProductManufacturer productManufacturer in productManufacturers)
                {
                    Product product = productManufacturer.Product;
                    if (product != null && !product.Deleted)
                    {
                        xmlWriter.WriteStartElement("ProductManufacturer");
                        xmlWriter.WriteElementString("ProductManufacturerID", null, productManufacturer.ProductManufacturerID.ToString());
                        xmlWriter.WriteElementString("ProductID", null, productManufacturer.ProductID.ToString());
                        xmlWriter.WriteElementString("IsFeaturedProduct", null, productManufacturer.IsFeaturedProduct.ToString());
                        xmlWriter.WriteElementString("DisplayOrder", null, productManufacturer.DisplayOrder.ToString());
                        xmlWriter.WriteEndElement();
                    }
                }
                xmlWriter.WriteEndElement();

                xmlWriter.WriteEndElement();
            }

            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndDocument();
            xmlWriter.Close();
            return stringWriter.ToString();
        }
 public ManufacturerCollection FetchByQuery(Query qry)
 {
     ManufacturerCollection coll = new ManufacturerCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }