当前位置: 首页>>代码示例>>C#>>正文


C# Manufacturer类代码示例

本文整理汇总了C#中Manufacturer的典型用法代码示例。如果您正苦于以下问题:C# Manufacturer类的具体用法?C# Manufacturer怎么用?C# Manufacturer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Manufacturer类属于命名空间,在下文中一共展示了Manufacturer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveInfo

    public Manufacturer SaveInfo()
    {
        if (!Page.IsValid)
            return null;
        if (ctrlSelectCountry.SelectedCountryId == Guid.Empty)
            return null;

        Manufacturer manufacturer = BasicService<Manufacturer, Guid>.GetByID(this.ManufacturerID);

        if (manufacturer == null)
        {
            manufacturer = new Manufacturer();
        }

        Address address = null;
        if (manufacturer.Address == null)
            address = new Address();
        else
            address = manufacturer.Address;
        address.Street = txtUlica.Text;
        address.HouseNr = txtNrDomu.Text;
        address.ApartmentNr = txtNrMieszkania.Text;
        address.ZipCode = txtKodPocztowy.Text;
        address.City = CityService.GetCityOrCreateNew(txtMiasto.Text);
        address.Country = BasicService<Country, Guid>.GetByID(ctrlSelectCountry.SelectedCountryId);

        manufacturer.Name = txtName.Text;
        manufacturer.Description = txtDescription.Text;
        manufacturer.Email = txtEmail.Text;
        manufacturer.Phone = txtPhone.Text;
        manufacturer.Address = address;

        BasicService<Manufacturer, Guid>.SaveOrUpdate(manufacturer);
        return manufacturer;
    }
开发者ID:tsubik,项目名称:SFASystem,代码行数:35,代码来源:ManufacturerInfo.ascx.cs

示例2: Main

        static void Main(string[] args)
        {
            try
            {
                Manufacturer m = new Manufacturer();
                m.Name = "Roland";
                m.Create();

                Product p = new Product();
                p.Manufacturer = m;
                p.Name = "Juno G";
                p.Create();

                //create a different date updated
                System.Threading.Thread.Sleep(2000);

                p.Name = "Juno D 61 Key Pro Keyboard";
                p.Update();

                Product[] products = Product.FindAll();

                foreach (Product product in products)
                {
                    Console.WriteLine("{0} by {1} was last modified on {2}",
                            product.Name, product.Manufacturer.Name, product.ModifiedDate);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.GetBaseException().Message);
            }
        }
开发者ID:mdrubin,项目名称:codevoyeur-samples,代码行数:33,代码来源:Program.cs

示例3: CarInstance

        public void CarInstance()
        {
            //Arrange
            string manufacturerNameEx = "NewManufacturer";
            Manufacturer manuEx = new Manufacturer { Name = manufacturerNameEx };
            string modelNameEx = "NewModel";
            double engineEx = 2;
            EnumCategory catEx = EnumCategory.Intermediate;
            Model model = new Model { Name = modelNameEx, Manufacturer = manuEx, Engine = engineEx, Category = catEx };
            EnumColor colorEx = EnumColor.White;
            string plateEx = "qwe1234";
            decimal priceEx = 50;

            //Act
            Car found = new Car
            {
                CarColor = colorEx,
                LicensePlate = plateEx,
                Model = model,
                Price = priceEx
            };

            //Assert
            Assert.AreEqual(colorEx, found.CarColor);
            Assert.AreEqual(plateEx, found.LicensePlate);
            Assert.AreEqual(priceEx, found.Price);
        }
开发者ID:Hartur,项目名称:Car-Rent-Webapp,代码行数:27,代码来源:CarTests.cs

示例4: Delete

 public ActionResult Delete(int ManufacturerID)
 {
     myHandler = new BusinessLogicHandler();
     manufacturer = new Manufacturer();
     manufacturer.ManufacturerID = ManufacturerID;
     manufacturer = myHandler.GetManufacturer(ManufacturerID);
     return View(manufacturer);
 }
开发者ID:Gcobani,项目名称:urbanbooks,代码行数:8,代码来源:ManufacturerController.cs

示例5: UpdateManufacturer

 public Manufacturer UpdateManufacturer(Manufacturer manufacturer)
 {
     if (manufacturer != null && manufacturer.ID > 0 && !String.IsNullOrEmpty(manufacturer.Name))
     {
         return this.Data.Update<Manufacturer>(manufacturer);
     }
     return null;
 }
开发者ID:hacikaraa,项目名称:Orvis,代码行数:8,代码来源:Facade.cs

示例6: Car

 public Car(Manufacturer manufacturer, String name, double engineCapacity, Fuel fuel, int width, int height, int length)
 {
     this.manufacturer = manufacturer;
     this.name = name;
     this.engineCapacity = engineCapacity;
     this.fuel = fuel;
     this.dimension = new Dimension(width, height, length);
 }
开发者ID:davidbedok,项目名称:oeprog3,代码行数:8,代码来源:Car.cs

示例7: EditAsync

 public async Task<ActionResult> EditAsync(Manufacturer manufacturer) {
     if (ModelState.IsValid) {
         _db.Entry(manufacturer).State = EntityState.Modified;
         await _db.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     return View(manufacturer);
 }
开发者ID:kburnell,项目名称:EfCodeFirstMagicUnicornAndBeyond,代码行数:8,代码来源:HomeController.cs

示例8: CreateManufacturer

 public Manufacturer CreateManufacturer(Manufacturer manufacturer)
 {
     if (manufacturer != null && manufacturer.ID == 0 && !String.IsNullOrEmpty(manufacturer.Name))
     {
         return this.Data.Insert<Manufacturer>(manufacturer);
     }
     return null;
 }
开发者ID:hacikaraa,项目名称:Orvis,代码行数:8,代码来源:Facade.cs

示例9: InsertManufacturer

 public void InsertManufacturer()
 {
     var manufacturer = new Manufacturer();
     manufacturer.Name = "Manufacturer1";
     ManufacturerDAO.Instance.Save(manufacturer);
     var brand = new Brand {Name = "Brand1", Manufacturer = manufacturer};
     BrandDAO.Instance.Save(brand);
 }
开发者ID:vincentzh,项目名称:nhibernate-burrow-with-dapper,代码行数:8,代码来源:DapperTest.cs

示例10: Main

 static void Main()
 {
     var xmlDoc = XDocument.Load("../../manufacturers-and-lenses.xml");
     var xManufacturers = xmlDoc.XPathSelectElements("manufacturers-and-lenses/manufacturer");
     var contex = new PhotographySystemEntities();
     int processing = 1;
     foreach (var manufacturerXml in xManufacturers)
     {
         Console.WriteLine("Processing manufacturer #{0} ...", processing++);
         var manufacturer = new Manufacturer();
         var manufacturerName = manufacturerXml.Element("manufacturer-name");
         if (manufacturerName != null)
         {
             if (!contex.Manufacturers.Any(m => m.Name == manufacturerName.Value))
             {
                 contex.Manufacturers.Add(new Manufacturer()
                 {
                     Name = manufacturerName.Value
                 });
                 contex.SaveChanges();
                 Console.WriteLine("Created manufacturer: {0}", manufacturerName.Value);
             }
             else
             {
                 Console.WriteLine("Existing manufacturer: {0}", manufacturerName.Value);
                 manufacturer = contex.Manufacturers.FirstOrDefault(m => m.Name == manufacturerName.Value);
             }
         }
         var xLenses = manufacturerXml.XPathSelectElements("lenses/lens");
         foreach (var lensXml in xLenses)
         {
             var model = lensXml.Attribute("model");
             var type = lensXml.Attribute("type");
             var price = lensXml.Attribute("price");
             var lens = contex.Lenses.FirstOrDefault(l => l.Model == model.Value);
             if (lens != null)
             {
                 Console.WriteLine("Existing lens: {0}", model.Value);
             }
             else
             {
                 contex.Lenses.Add(new Lens()
                 {
                     Model = model.Value,
                     Type = type.Value,
                     Price = (price != null) ? decimal.Parse(price.Value) : default(decimal?),
                     ManufacturerId = manufacturer.Id
                 });
                 contex.SaveChanges();
                 Console.WriteLine("Created lens: {0}", model.Value);
             }
         }
         Console.WriteLine();
     }
 }
开发者ID:Aleksandyr,项目名称:Software-University,代码行数:55,代码来源:Program.cs

示例11: Update

 /// <inheritdoc />
 public void Update(Manufacturer manufacturer)
 {
     using(ISession session = NHibernateHelper.OpenSession())
     {
         using(ITransaction transaction = session.BeginTransaction())
         {
             session.Update(manufacturer);
             transaction.Commit();
         }
     }
 }
开发者ID:karldickman,项目名称:BikeLog,代码行数:12,代码来源:ManufacturerRepository.cs

示例12: ManufacturerInstance

        public void ManufacturerInstance()
        {
            //Arrange
            string nameEx = "NewManufacturer";

            //Act
            Manufacturer found = new Manufacturer { Name = nameEx };

            //Assert
            Assert.AreEqual(nameEx, found.Name);
        }
开发者ID:Hartur,项目名称:Car-Rent-Webapp,代码行数:11,代码来源:ManufacturerTests.cs

示例13: UpdateManufacturer

 public int UpdateManufacturer(Manufacturer C)
 {
     try
     {
         db.Entry(C).State = EntityState.Modified;
         return db.SaveChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
开发者ID:htphongqn,项目名称:B2C_EC,代码行数:12,代码来源:ManufacturerRepo.cs

示例14: CreateManufacturer

 public int CreateManufacturer(Manufacturer C)
 {
     try
     {
         this.db.Manufacturers.Add(C);
         return db.SaveChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
开发者ID:htphongqn,项目名称:B2C_EC,代码行数:12,代码来源:ManufacturerRepo.cs

示例15: Create

 public ActionResult Create(Manufacturer manufacturer)
 {
     try
     {
         BusinessLogicHandler myHandler = new BusinessLogicHandler();
         myHandler.AddManufacturer(manufacturer);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
开发者ID:Gcobani,项目名称:urbanbooks,代码行数:13,代码来源:ManufacturerController.cs


注:本文中的Manufacturer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。