• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Manufacturer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AddOrUpdate

 public ActionResult AddOrUpdate(Manufacturer model, HttpPostedFileBase file)
 {
     var exist = this.ManufacturerService.GetOneByLINQ(c => c.Name.Equals(model.Name));
     if (exist != null && model.ID == 0)
     {
         return Content("exist");
     }
     model.Image = PathUpload;
     var id = this.ManufacturerService.Save(model);
     PathUpload = "";
     var data = this.ManufacturerService.GetByID(id);
     return Json(data, JsonRequestBehavior.AllowGet);
 }
开发者ID:chutinhha,项目名称:portal-cuocthianh,代码行数:13,代码来源:ManufacturerManagementController.cs


示例17: Create

        public Car Create(Manufacturer manufacturer, string model)
        {
            UnitOfWork uow = this.uowf.CurrentUnitOfWork;

            EntityBuilder<Car> builder = uow.NewEntityBuilder<Car>();

            Car prototype = builder.StateFor();

            prototype.Manufacturer.Set(manufacturer);
            prototype.Model = model;

            return builder.NewInstance();
        }
开发者ID:attila3453,项目名称:alsing,代码行数:13,代码来源:Factory.cs


示例18: GetByName

 public void GetByName()
 {
     Manufacturer trek = new Manufacturer(1, "Trek");
     Manufacturer specialized = new Manufacturer(2, "Specialized");
     Manufacturer cannondale = new Manufacturer(3, "Cannondale");
     IManufacturerRepository repository = new ManufacturerRepository();
     repository.Add(trek);
     repository.Add(specialized);
     repository.Add(cannondale);
     Manufacturer actual = repository.GetByName("specialized");
     Assert.IsNotNull(actual);
     Assert.AreNotSame(specialized, actual);
     Assert.AreEqual(specialized.ID, actual.ID);
 }
开发者ID:karldickman,项目名称:BikeLog,代码行数:14,代码来源:ManufacterRepositoryFixture.cs


示例19: find

 public Car find(Manufacturer manufacturer, String name)
 {
     Car ret = null;
     IEnumerable<Car> results = this.items.Where(x => x.Manufacturer == manufacturer && x.Name.Equals(name));
     if (results.Count() > 0)
     {
         ret = results.First();
     }
     else
     {
         throw CarNotFoundError.create(manufacturer, name);
     }
     return ret;
 }
开发者ID:davidbedok,项目名称:oeprog3,代码行数:14,代码来源:Cars.cs


示例20: RemoveExisting

 public void RemoveExisting()
 {
     Manufacturer manufacturer = new Manufacturer(1, "Trek");
     IManufacturerRepository repository = new ManufacturerRepository();
     repository.Add(manufacturer);
     using(ISession session = SessionFactory.OpenSession())
     {
         Assert.IsNotNull(session.Get<Manufacturer>(manufacturer.ID));
     }
     repository.Remove(manufacturer);
     using(ISession session = SessionFactory.OpenSession())
     {
         Assert.IsNull(session.Get<Manufacturer>(manufacturer.ID));
     }
 }
开发者ID:karldickman,项目名称:BikeLog,代码行数:15,代码来源:ManufacterRepositoryFixture.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ManufacturerModel类代码示例发布时间:2022-05-24
下一篇:
C# ManualResetEvent类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap