本文整理汇总了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;
}
示例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);
}
}
示例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);
}
示例4: Delete
public ActionResult Delete(int ManufacturerID)
{
myHandler = new BusinessLogicHandler();
manufacturer = new Manufacturer();
manufacturer.ManufacturerID = ManufacturerID;
manufacturer = myHandler.GetManufacturer(ManufacturerID);
return View(manufacturer);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
}
示例11: Update
/// <inheritdoc />
public void Update(Manufacturer manufacturer)
{
using(ISession session = NHibernateHelper.OpenSession())
{
using(ITransaction transaction = session.BeginTransaction())
{
session.Update(manufacturer);
transaction.Commit();
}
}
}
示例12: ManufacturerInstance
public void ManufacturerInstance()
{
//Arrange
string nameEx = "NewManufacturer";
//Act
Manufacturer found = new Manufacturer { Name = nameEx };
//Assert
Assert.AreEqual(nameEx, found.Name);
}
示例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);
}
}
示例14: CreateManufacturer
public int CreateManufacturer(Manufacturer C)
{
try
{
this.db.Manufacturers.Add(C);
return db.SaveChanges();
}
catch (Exception e)
{
throw new Exception(e.Message);
}
}
示例15: Create
public ActionResult Create(Manufacturer manufacturer)
{
try
{
BusinessLogicHandler myHandler = new BusinessLogicHandler();
myHandler.AddManufacturer(manufacturer);
return RedirectToAction("Index");
}
catch
{
return View();
}
}