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); }
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); } }
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; }
public Manufacturer UpdateManufacturer(Manufacturer manufacturer) { if (manufacturer != null && manufacturer.ID > 0 && !String.IsNullOrEmpty(manufacturer.Name)) { return this.Data.Update<Manufacturer>(manufacturer); } return null; }
public ActionResult Delete(int ManufacturerID) { myHandler = new BusinessLogicHandler(); manufacturer = new Manufacturer(); manufacturer.ManufacturerID = ManufacturerID; manufacturer = myHandler.GetManufacturer(ManufacturerID); return View(manufacturer); }
public Manufacturer CreateManufacturer(Manufacturer manufacturer) { if (manufacturer != null && manufacturer.ID == 0 && !String.IsNullOrEmpty(manufacturer.Name)) { return this.Data.Insert<Manufacturer>(manufacturer); } return null; }
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); }
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); }
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); }
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(); } }
/// <inheritdoc /> public void Update(Manufacturer manufacturer) { using(ISession session = NHibernateHelper.OpenSession()) { using(ITransaction transaction = session.BeginTransaction()) { session.Update(manufacturer); transaction.Commit(); } } }
public void ManufacturerInstance() { //Arrange string nameEx = "NewManufacturer"; //Act Manufacturer found = new Manufacturer { Name = nameEx }; //Assert Assert.AreEqual(nameEx, found.Name); }
public int UpdateManufacturer(Manufacturer C) { try { db.Entry(C).State = EntityState.Modified; return db.SaveChanges(); } catch (Exception e) { throw new Exception(e.Message); } }
public int CreateManufacturer(Manufacturer C) { try { this.db.Manufacturers.Add(C); return db.SaveChanges(); } catch (Exception e) { throw new Exception(e.Message); } }
public ActionResult Create(Manufacturer manufacturer) { try { BusinessLogicHandler myHandler = new BusinessLogicHandler(); myHandler.AddManufacturer(manufacturer); return RedirectToAction("Index"); } catch { return View(); } }
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(); }
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); }
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); }
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; }
public int? AddManufacturer(string name) { if (name == null) return null; int? id = Repository.CheckManufacturer(name); if (id == 0) { Manufacturer insence = new Manufacturer() { Name = name }; Repository.CreateManufacturer(insence); id = insence.ID; } return id; }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { try { Manufacturer manufacturer = new Manufacturer(); manufacturer.Name = txtName.Text; manufacturer.Save(WebUtility.GetUserName()); Reset(); LoadManufacturers(); Master.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblManufacturerSaved")); } catch (Exception ex) { Logger.Error(typeof(manufacturers).Name + ".btnSave_Click", ex); Master.MessageCenter.DisplayCriticalMessage(ex.Message); } }
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)); } }
protected void btnAddSupplier_Click(object sender, EventArgs e) { Manufacturer manufacturer = new Manufacturer(); manufacturer.name = txtSupplierName.Text; manufacturer.address = txtSupplierAddress.Text; bool success = PurchaseManager.addManaufacturer(manufacturer); if(success) { lblSupplierMsg.Text = "Supplier added successfully."; } else { lblSupplierMsg.Text = "Sorry, there was an error. Please try again."; } }
private void MigrateManufacturers(MongoDbHandler mongoHandler) { var manufacturers = mongoHandler.ReadCollection("Manufacturers").Result; using (var db = new CarPartsDbContext()) { foreach (var manufacturer in manufacturers) { var sqlManufacturer = new Manufacturer(); sqlManufacturer.Id = manufacturer["_id"].AsInt32; sqlManufacturer.Name = manufacturer["Name"].AsString; db.Manufacturers.Add(sqlManufacturer); } db.SaveChanges(); } }
public ActionResult Delete(int ManufacturerID, FormCollection collection) { try { myHandler = new BusinessLogicHandler(); manufacturer = new Manufacturer(); manufacturer.ManufacturerID = ManufacturerID; myHandler.DeleteManufacturer(ManufacturerID); TempData["Alert Message"] = "Device Successfully Deleted"; return RedirectToAction("Index", "Manufacturer"); } catch { return View(); } }
public static void Reset() { _products.Clear(); _manufacturers.Clear(); var insignia = new Manufacturer { Id = 1, Name = "Insignia" }; var dynex = new Manufacturer { Id = 2, Name = "Dynex" }; _manufacturers.Add(insignia); _products.Add(new Product { Id = 1, Name = "Insignia® - 26\" Class / 720p / 60Hz / LCD HDTV DVD Combo", Model = "NS-LDVD26Q-10A", Sku = "9154764", Price = 359.99m, Manufacturer = insignia }); _products.Add(new Product { Id = 2, Name = "Insignia® - 19\" Class / 720p / 60Hz / LCD HDTV", Model = "NS-L19Q-10A", Sku = "9182715", Price = 189.99m, Manufacturer = insignia }); _products.Add(new Product { Id = 3, Name = "Dynex® - 15\" Class / 720p / 60Hz / LCD HDTV", Model = "DX-L15-10A", Sku = "9135376", Price = 159.99m, Manufacturer = dynex }); }
public void ModelInstance() { //Arrange string manufacturerNameEx = "NewManufacturer"; Manufacturer manuEx = new Manufacturer { Name = manufacturerNameEx }; string modelNameEx = "NewModel"; double engineEx = 2; EnumCategory catEx = EnumCategory.Intermediate; //Act Model found = new Model { Name = modelNameEx, Manufacturer = manuEx, Engine = engineEx, Category = catEx }; //Assert Assert.AreEqual(modelNameEx, found.Name); Assert.AreEqual(engineEx, found.Engine); Assert.AreEqual(catEx, found.Category); Assert.AreEqual(manufacturerNameEx, found.Manufacturer.Name); }
public static IList<Manufacturer> GetManufacturers() { _ferrari = new Manufacturer { Name = "Ferrari", Country = "Italy", Models = new List<Model>() }; _ferrari.Models.Add(new Model { Name = "458 Italia", BasePrice = 220000, Year = 2012, Manufacturer = _ferrari, AvailableEngines = new List<Engine> { _ferrariV8, _ferrariV12 }, EngineLocation = EngineLocationType.Mid }); _ferrari.Models.Add(new Model { Name = "Scaglietti", BasePrice = 313000, Year = 2012, Manufacturer = _ferrari, AvailableEngines = new List<Engine> { _ferrariV12 }, EngineLocation = EngineLocationType.Front }); _lamborghini = new Manufacturer { Name = "Lamborghini", Country = "Italy", Models = new List<Model>() }; _lamborghini.Models.Add(new Model { Name = "Gallardo LP 570-4 Superleggera", BasePrice = 237600, Year = 2012, Manufacturer = _lamborghini, AvailableEngines = new List<Engine> { _lamborghiniV10 }, EngineLocation = EngineLocationType.Mid }); _lamborghini.Models.Add(new Model { Name = "Aventador LP 700-4", BasePrice = 387000, Year = 2012, Manufacturer = _lamborghini, AvailableEngines = new List<Engine> { _lamborghiniV12 }, EngineLocation = EngineLocationType.Mid }); _astonMartin = new Manufacturer { Name = "Aston Martin", Country = "United Kingdom", Models = new List<Model>() }; _astonMartin.Models.Add(new Model { Name = "DB9", BasePrice = 185000, Year = 2012, Manufacturer = _astonMartin, AvailableEngines = new List<Engine> { _astonMartinV12 }, EngineLocation = EngineLocationType.Front }); _astonMartin.Models.Add(new Model { Name = "V12 Vantage", BasePrice = 180000, Year = 2012, Manufacturer = _astonMartin, AvailableEngines = new List<Engine> { _astonMartinV12 }, EngineLocation = EngineLocationType.Mid }); _porsche = new Manufacturer { Name = "Porsche", Country = "Germany", Models = new List<Model> { new Model { Name = "911 GT2 R2", BasePrice = 245000, Year = 2012, Manufacturer = _porsche, AvailableEngines = new List<Engine> { _porscheStraight6 }, EngineLocation = EngineLocationType.Rear } } }; _ferrari.Location = DbGeography.Parse("POINT(44.53244 10.86412)"); _lamborghini.Location = DbGeography.Parse("POINT (44.65934 11.12693)"); _astonMartin.Location = DbGeography.Parse("POINT (52.18708 -1.48351)"); _porsche.Location = DbGeography.Parse("POINT (48.83498 9.15231)"); return new List<Manufacturer> { _ferrari, _lamborghini, _astonMartin, _porsche }; }
protected void btnSubmit_Click(object sender, EventArgs e) { ManufacturerAdmin ManuAdmin = new ManufacturerAdmin(); Manufacturer _manufacturer = new Manufacturer(); if (ItemId > 0) { _manufacturer = ManuAdmin.GetByManufactureId(ItemId); } _manufacturer.PortalID = ZNodeConfigManager.SiteConfig.PortalID; _manufacturer.Name = Name.Text; _manufacturer.Description = Description.Text; _manufacturer.ActiveInd = CheckActiveInd.Checked; _manufacturer.IsDropShipper = DropShipInd.Checked; _manufacturer.EmailID = EmailId.Text.Trim(); _manufacturer.EmailNotificationTemplate = NotificationTemplate.Text.Trim(); _manufacturer.Custom1 = Custom1.Text.Trim(); _manufacturer.Custom2 = Custom2.Text.Trim(); _manufacturer.Custom3 = Custom3.Text.Trim(); bool check = false; if (ItemId > 0) { check = ManuAdmin.Update(_manufacturer); } else { check = ManuAdmin.Insert(_manufacturer); } if (check) { //redirect to main page Response.Redirect("list.aspx"); } else { //display error message lblError.Text = "An error occurred while updating. Please try again."; } }
public void DeletesRecords() { var newManufacturer = new Manufacturer { Name = "Test Manufacturer" }; var manufacturerId = _manufacturerStore.InsertWithIdentity(newManufacturer); var allManufacturers = _manufacturerStore.Get(); Assert.Equal(1, allManufacturers.Count()); var deleted = _manufacturerStore.Delete(manufacturerId); Assert.Equal(1, deleted); allManufacturers = _manufacturerStore.Get(); Assert.Equal(0, allManufacturers.Count()); }
public override Task <CategoriesResult> GetCategories(Manufacturer manufacturer) { throw new System.NotImplementedException(); }
public void Add(Manufacturer entity) { db.Manufacturers.Add(entity); db.SaveChanges(); }
public Manufacturer SaveInfo() { var manufacturer = this.ManufacturerService.GetManufacturerById(this.ManufacturerId); if (manufacturer != null) { Picture manufacturerPicture = manufacturer.Picture; HttpPostedFile manufacturerPictureFile = fuManufacturerPicture.PostedFile; if ((manufacturerPictureFile != null) && (!String.IsNullOrEmpty(manufacturerPictureFile.FileName))) { byte[] manufacturerPictureBinary = manufacturerPictureFile.GetPictureBits(); if (manufacturerPicture != null) { manufacturerPicture = this.PictureService.UpdatePicture(manufacturerPicture.PictureId, manufacturerPictureBinary, manufacturerPictureFile.ContentType, true); } else { manufacturerPicture = this.PictureService.InsertPicture(manufacturerPictureBinary, manufacturerPictureFile.ContentType, true); } } int manufacturerPictureId = 0; if (manufacturerPicture != null) { manufacturerPictureId = manufacturerPicture.PictureId; } manufacturer.Name = txtName.Text; manufacturer.Description = txtDescription.Value; manufacturer.TemplateId = int.Parse(this.ddlTemplate.SelectedItem.Value); manufacturer.PictureId = manufacturerPictureId; manufacturer.PriceRanges = txtPriceRanges.Text; manufacturer.Published = cbPublished.Checked; manufacturer.DisplayOrder = txtDisplayOrder.Value; manufacturer.UpdatedOn = DateTime.UtcNow; this.ManufacturerService.UpdateManufacturer(manufacturer); } else { Picture manufacturerPicture = null; HttpPostedFile manufacturerPictureFile = fuManufacturerPicture.PostedFile; if ((manufacturerPictureFile != null) && (!String.IsNullOrEmpty(manufacturerPictureFile.FileName))) { byte[] manufacturerPictureBinary = manufacturerPictureFile.GetPictureBits(); manufacturerPicture = this.PictureService.InsertPicture(manufacturerPictureBinary, manufacturerPictureFile.ContentType, true); } int manufacturerPictureId = 0; if (manufacturerPicture != null) { manufacturerPictureId = manufacturerPicture.PictureId; } DateTime nowDt = DateTime.UtcNow; manufacturer = new Manufacturer() { Name = txtName.Text, Description = txtDescription.Value, TemplateId = int.Parse(this.ddlTemplate.SelectedItem.Value), PictureId = manufacturerPictureId, PageSize = 10, PriceRanges = txtPriceRanges.Text, Published = cbPublished.Checked, DisplayOrder = txtDisplayOrder.Value, CreatedOn = nowDt, UpdatedOn = nowDt }; this.ManufacturerService.InsertManufacturer(manufacturer); } SaveLocalizableContent(manufacturer); return(manufacturer); }
protected void BindExpandResultPanel() { Trace.Write(this.GetType().ToString(), "Begin BindExpandResultPanel"); //START WITH THE PANEL VISIBLE ExpandResultPanel.Visible = true; //BIND THE EXPAND CATEGORY LINKS IList <CatalogPathNode> currentPath = CatalogDataSource.GetPath(this._categoryId, false); if (_isCategoryPage && currentPath.Count > 0 && currentPath[0].CatalogNodeType == CatalogNodeType.Category) { currentPath.RemoveAt(0); } if (currentPath.Count > 0) { ExpandCategoryLinks.Visible = true; ExpandCategoryLinks.DataSource = currentPath; ExpandCategoryLinks.DataBind(); } else { ExpandCategoryLinks.Visible = false; } //BIND THE EXPAND MANUFACTURER LINK Manufacturer m = ManufacturerDataSource.Load(this._manufacturerId); if (m != null) { ExpandManufacturerLink.Text = string.Format("{0} (X)", m.Name); ExpandManufacturerLink.NavigateUrl = RemoveQueryStringParameter("m"); ExpandManufacturerListItem.Visible = true; } else { ExpandManufacturerListItem.Visible = false; ExpandManufacturerLink.NavigateUrl = "#"; } //BIND THE EXPAND KEYWORD LINK if (!string.IsNullOrEmpty(this._keyword)) { ExpandKeywordLink.Text = string.Format("Remove Keyword: {0}", Server.HtmlEncode(this._keyword)); ExpandKeywordLink.NavigateUrl = RemoveQueryStringParameter("k"); ExpandKeywordListItem.Visible = true; } else { ExpandKeywordListItem.Visible = false; } IList <ShopByChoice> choices = PageHelper.GetShopByChoices(); if (choices != null && choices.Count > 0) { ExpandShopByLinks.DataSource = choices; ExpandShopByLinks.DataBind(); ExpandShopByLinks.Visible = true; } else { ExpandShopByLinks.Visible = false; } //SET VISIBILITY OF EXPAND PANEL BASED ON CHILD CONTROLS VISIBILITY ExpandResultPanel.Visible = (ExpandCategoryLinks.Visible || ExpandManufacturerListItem.Visible || ExpandKeywordListItem.Visible) || ExpandShopByLinks.Visible; Trace.Write(this.GetType().ToString(), "End BindExpandResultPanel"); }
public ElectricBuilder SetManufacturer(Manufacturer manufacturer) { _electric.Manufacturer = manufacturer; return(this); }
public List <IRequestResponse> SyncAll(SnipeItApi snipe, Asset currentAsset, Model currentModel, Manufacturer currentManufacturer, Category currentCategory, Company currentCompany, StatusLabel currentStatusLabel, Location currentLocation) { // Let's try to simplify the logic into a repeatable structure: // Each of these categories (Asset, Model, Location, etc.) has a single // value that uniquely specifies it, which must be: // a) Uniquely associated to it in the physical world // b) Not the database unique ID // Why can't it be the database unique ID? Because the uniqueID is not something that // is inherently associated to the computer's hardware, it's just a number that SnipeIT // uses internally. // By category: Unique identifiers // Asset: computer serial (string) // Model: model full name (string) // Category: model types, as given by the WMIC fullnames (string) // Manufacturer: full name (string) // Company: full name (string) // StatusLabel: full name (string) // Location: full name (string) // Really, we only need the update functionality for the assets, as the computer name can change, // along with its location, etc. // However we are not in change of things like a computer manufacturer changing the name of // its company. So those have a simpler functionality. List <IRequestResponse> messages = new List <IRequestResponse>(); messages.Add(snipe.ManufacturerManager.Create(currentManufacturer)); SearchFilter manufacturerFilter = new SearchFilter(currentManufacturer.Name); Manufacturer updatedManufacturer = snipe.ManufacturerManager.FindOne(manufacturerFilter); messages.Add(snipe.CategoryManager.Create(currentCategory)); SearchFilter categoryFilter = new SearchFilter(currentCategory.Name); Category updatedCategory = snipe.CategoryManager.FindOne(categoryFilter); currentModel.Manufacturer = updatedManufacturer; currentModel.Category = updatedCategory; messages.Add(snipe.ModelManager.Create(currentModel)); SearchFilter modelFilter = new SearchFilter(currentModel.Name); Model updatedModel = snipe.ModelManager.FindOne(modelFilter); messages.Add(snipe.CompanyManager.Create(currentCompany)); SearchFilter companyFilter = new SearchFilter(currentCompany.Name); Company updatedCompany = snipe.CompanyManager.FindOne(companyFilter); messages.Add(snipe.StatusLabelManager.Create(currentStatusLabel)); SearchFilter statusLabelFilter = new SearchFilter(currentStatusLabel.Name); StatusLabel updatedStatusLabel = snipe.StatusLabelManager.FindOne(statusLabelFilter); messages.Add(snipe.LocationManager.Create(currentLocation)); SearchFilter locationFilter = new SearchFilter(currentLocation.Name); Location updatedLocation = snipe.LocationManager.FindOne(locationFilter); currentAsset.Model = updatedModel; currentAsset.Company = updatedCompany; currentAsset.StatusLabel = updatedStatusLabel; currentAsset.Location = updatedLocation; string currentSerial = currentAsset.Serial; Asset dbAsset = snipe.AssetManager.FindBySerial(currentSerial); if (dbAsset == null) { Console.WriteLine("Asset does not exist in database, creating..."); snipe.AssetManager.Create(currentAsset); } else { Console.WriteLine("Asset already exists in db. Checking for consistency."); bool isIdentical = IsIdentical(currentAsset, dbAsset); if (isIdentical) { Console.WriteLine("No changes required! Asset already exists and is up-to-date."); } else { Console.WriteLine("Changes in asset detected. Updating:"); // Setting old ID for consistency currentAsset.Id = dbAsset.Id; currentAsset.LastCheckout = dbAsset.LastCheckout; currentAsset.AssignedTo = dbAsset.AssignedTo; messages.Add(snipe.AssetManager.Update(currentAsset)); } } return(messages); }
internal static extern int BthReadRemoteVersion(byte[] pba, out LmpVersion plmp_version, out ushort plmp_subversion, out Manufacturer pmanufacturer, out LmpFeatures plmp_features);
public static ManufacturerModel ToModel(this Manufacturer entity) { return(Mapper.Map <Manufacturer, ManufacturerModel>(entity)); }
private void EditReceived_Load(object sender, EventArgs e) { BLL.ItemManufacturer im = new BLL.ItemManufacturer(); im.LoadManufacturersFor(rDoc.ItemID); lkManufacturer.Properties.DataSource = im.DefaultView; if (BLL.Settings.UseNewUserManagement && this.HasPermission("Edit-Quantity") && (rDoc.IsColumnNull("Confirmed") || (!rDoc.IsColumnNull("Confirmed") && !rDoc.Confirmed))) { txtQuanitity.Enabled = true; } else if ((!rDoc.IsColumnNull("Confirmed") && !rDoc.Confirmed)) { txtQuanitity.Enabled = true; } else { txtQuanitity.Enabled = false; } Supplier supplier = new Supplier(); supplier.LoadAll(); lkSupplier.Properties.DataSource = supplier.DefaultView; lkAccount.SetupActivityEditor().SetDefaultActivity(); BLL.ItemUnit iu = new ItemUnit(); iu.LoadAllForItem(rDoc.ItemID); lkUnit.Properties.DataSource = iu.DefaultView; // Bind the variables) if (rDoc.RowCount > 0) { this.txtRefNo.Text = rDoc.RefNo; this.txtQuanitity.Text = Convert.ToInt32(Convert.ToDouble(rDoc.Quantity) / rDoc.QtyPerPack).ToString("#,##0"); this.txtManufacturer.Text = Manufacturer.GetName(rDoc.ManufacturerId); this.txtItemName.Text = Item.GetName(rDoc.ItemID); this.txtGrvNo.Text = rDoc.RefNo; this.lkManufacturer.EditValue = rDoc.ManufacturerId; this.lkAccount.EditValue = rDoc.StoreID; this.lkUnit.EditValue = rDoc.UnitID; if (!rDoc.IsColumnNull("SupplierID")) { lkSupplier.EditValue = rDoc.SupplierID; } // Editable controls txtPrice.Text = rDoc.IsColumnNull("Cost") ? "0" : rDoc.Cost.ToString(); if (!rDoc.IsColumnNull("ExpDate")) { dtExpiry.EditValue = rDoc.ExpDate; } if (!rDoc.IsColumnNull("BatchNo")) { txtBatchNo.Text = rDoc.BatchNo; } BLL.Item itm = new Item(); itm.LoadByPrimaryKey(rDoc.ItemID); if (BLL.Settings.UseNewUserManagement && this.HasPermission("Edit-Batch-Expiry")) { } else if (!itm.NeedExpiryBatch && (CurrentContext.LoggedInUser.UserType == UserType.Constants.ADMIN || CurrentContext.LoggedInUser.UserType == UserType.Constants.SUPER_ADMINISTRATOR)) { btnRemoveExpiry.Enabled = true; txtBatchNo.Enabled = true; } } }
/// <summary> /// Prepare paged manufacturer product list model /// </summary> /// <param name="searchModel">Manufacturer product search model</param> /// <param name="manufacturer">Manufacturer</param> /// <returns>Manufacturer product list model</returns> public virtual ManufacturerProductListModel PrepareManufacturerProductListModel(ManufacturerProductSearchModel searchModel, Manufacturer manufacturer) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } if (manufacturer == null) { throw new ArgumentNullException(nameof(manufacturer)); } //get product manufacturers var productManufacturers = _manufacturerService.GetProductManufacturersByManufacturerId(showHidden: true, manufacturerId: manufacturer.Id, pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize); //prepare grid model var model = new ManufacturerProductListModel { //fill in model values from the entity Data = productManufacturers.Select(productManufacturer => new ManufacturerProductModel { Id = productManufacturer.Id, ManufacturerId = productManufacturer.ManufacturerId, ProductId = productManufacturer.ProductId, ProductName = _productService.GetProductById(productManufacturer.ProductId)?.Name, IsFeaturedProduct = productManufacturer.IsFeaturedProduct, DisplayOrder = productManufacturer.DisplayOrder }), Total = productManufacturers.TotalCount }; return(model); }
public static Manufacturer ToEntity(this ManufacturerModel model, Manufacturer destination) { return(Mapper.Map(model, destination)); }
/// <summary> /// Prepare manufacturer product search model /// </summary> /// <param name="searchModel">Manufacturer product search model</param> /// <param name="manufacturer">Manufacturer</param> /// <returns>Manufacturer product search model</returns> protected virtual ManufacturerProductSearchModel PrepareManufacturerProductSearchModel(ManufacturerProductSearchModel searchModel, Manufacturer manufacturer) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } if (manufacturer == null) { throw new ArgumentNullException(nameof(manufacturer)); } searchModel.ManufacturerId = manufacturer.Id; //prepare page parameters searchModel.SetGridPageSize(); return(searchModel); }
private void buttonSearch_Click(object sender, EventArgs e) { List <Product> theProducts = new List <Product>(); foreach (var order in Order.GetAll().Where(x => x.OrderStatus.ID == 5 || x.OrderStatus.ID == 8)) { foreach (var item in order.OrderProducts) { for (int i = 0; i < item.Count; i++) { theProducts.Add(item.Product); } } } if (this.radioButtonSearchCategory.Checked) { Category theCategory = this.comboBoxCategory.SelectedItem as Category; foreach (var item in theProducts.Where(x => x.Category.ID == theCategory.ID)) { this.listBoxSearchResult.Items.Add(item.created_at.ToString() + " " + item.Name); } } if (this.radioButtonSearchManufacturer.Checked) { Manufacturer theManufacturer = this.comboBoxManufacturer.SelectedItem as Manufacturer; foreach (var item in theProducts.Where(x => x.Manufacturer.ID == theManufacturer.ID)) { this.listBoxSearchResult.Items.Add(item.created_at.ToString() + " " + item.Name); } } if (this.radioButtonSearchPrice.Checked) { foreach (var item in theProducts.Where(x => x.Price < 250)) { this.listBoxSearchResult.Items.Add(item.created_at.ToString() + " " + item.Name); } } if (this.radioButton1.Checked) { foreach (var item in theProducts.Where(x => x.Price > 250 && x.Price < 500)) { this.listBoxSearchResult.Items.Add(item.created_at.ToString() + " " + item.Name); } } if (this.radioButtonSearchPrice.Checked) { foreach (var item in theProducts.Where(x => x.Price > 500)) { this.listBoxSearchResult.Items.Add(item.created_at.ToString() + " " + item.Name); } } }
/// <summary> /// Carry out the example as described in the instructions. /// </summary> private void PerformExample() { var vehicleBusiness = container.Resolve <VehicleBusiness>(); // NOTE: See Manufacturer.cs and VehicleRepository.Create for explanations of how Manufacturer instances would be handled in a real implementation var tesla = new Manufacturer { Name = "Tesla", Country = "USA", Comment = "(Batteries Included!)" }; var bmw = new Manufacturer { Name = "BMW", Country = "Germany", Comment = "\u00a9 BMW AG, Munich, Germany" }; var mazda = new Manufacturer { Name = "Mazda", Country = "Japan", Comment = "Zoom Zoom!" }; // Add some Teslas to our inventory for (var i = 0; i < 5; ++i) { vehicleBusiness.AddVehicle(new Vehicle { Model = "S", Year = 2018, Color = "Red", VIN = Utils.GenerateVIN(), Manufacturer = tesla }); } // Add some BMWs to our inventory for (var i = 0; i < 5; ++i) { vehicleBusiness.AddVehicle(new Vehicle { Model = "i3", Year = 2017, Color = "Blue", VIN = Utils.GenerateVIN(), Manufacturer = bmw }); } // Add some Mazdas to our inventory for (var i = 0; i < 5; ++i) { vehicleBusiness.AddVehicle(new Vehicle { Model = "3", Year = 2016, Color = "Black", VIN = Utils.GenerateVIN(), Manufacturer = mazda }); } var allVehicles = vehicleBusiness.GetAllVehicles(); Console.WriteLine("Here are all of the vehicles in inventory:"); Utils.PrintVehicles(allVehicles); // var teslas = vehicleBusiness.GetVehiclesByManufacturer("Tesla"); var bmws = vehicleBusiness.GetVehiclesByManufacturer("BMW"); Console.WriteLine("\nHere are just the BMWs:"); Utils.PrintVehicles(bmws); Console.WriteLine("\nPress any key to exit"); //var s = new System.Diagnostics.Stopwatch(); //s.Start(); //for (var i = 0; i < 10000; ++i) //{ // vehicleBusiness.GenerateCar(); //} //s.Stop(); //Console.WriteLine("ms: " + (s.ElapsedMilliseconds)); //var mazdas = vehicleBusiness.GetVehiclesByManufacturer("Mazda"); //foreach (var car in mazdas) //{ // Console.WriteLine(car.ToString()); // Console.ReadKey(); //} }
public static void Initialize(InventoryContext context) { // if(context.Database.EnsureCreated()) context.Database.Migrate(); //Look for existance of any items in DB. if (context.Items.Any()) { return; //Db has been seeded. } var calibers = new Caliber[] { new Caliber { Name = "223", DecimalSize = .224M, MetricSize = "5.56 X 45" }, new Caliber { Name = "308", DecimalSize = .308M, MetricSize = "7.62 X 51" }, new Caliber { Name = "9mm Luger", DecimalSize = .355M, MetricSize = "9 X 19" } }; context.Caliber.AddRange(calibers); //foreach (Caliber c in calibers) { // context.Caliber.Add(c); //} context.SaveChanges(); var locations = new Location[] { new Location { Name = "Fort Knox" }, new Location { Name = "Sportsman Steel" } }; foreach (Location l in locations) { context.Location.Add(l); } context.SaveChanges(); var manufacturers = new Manufacturer[] { new Manufacturer { Name = "Daniel Defence", Website = "https://www.danieldefense.com/" }, new Manufacturer { Name = "Aero Precision", Website = "https://aeroprecisionusa.com/" }, new Manufacturer { Name = "Spikes Tactical", Website = "https://www.spikestactical.com/" }, new Manufacturer { Name = "Self" } }; foreach (Manufacturer m in manufacturers) { context.Manufacturer.Add(m); } context.SaveChanges(); var categories = new Category[] { new Category { Name = "Firearm", ParentId = null }, new Category { Name = "Pistol", ParentId = 1 }, new Category { Name = "Rifle", ParentId = 1 } }; foreach (Category c in categories) { context.Category.Add(c); } context.SaveChanges(); var actions = new FiringAction[] { new FiringAction { Name = "Semi-Automatic" }, new FiringAction { Name = "Bolt" }, new FiringAction { Name = "Single Action" }, new FiringAction { Name = "Double Action" } }; foreach (FiringAction f in actions) { context.FiringAction.Add(f); } context.SaveChanges(); var platforms = new Platform[] { new Platform { Name = "AR-10" }, new Platform { Name = "AR-15" } }; foreach (Platform p in platforms) { context.Platform.Add(p); } context.SaveChanges(); var retailers = new Retailer[] { new Retailer { Name = "Merchant Firearms", Website = "https://merchantfirearms.com/" }, new Retailer { Name = "Caswell's", Website = "https://caswells.com/" } }; foreach (Retailer r in retailers) { context.Retailer.Add(r); } context.SaveChanges(); var items = new Item[] { new Item { ManufacturerId = 1, Model = "DDM4V11", CaliberId = 1, CategoryId = 1, FiringActionId = 1, PlatformId = 2, Color = "Ghost Grey", LocationId = 1, PurchaseDate = new DateTime(2016, 4, 13), PurchasePrice = 1795.00M, RetailerId = 1 }, new Item { ManufacturerId = 4, Model = "Self Build", CaliberId = 2, CategoryId = 1, FiringActionId = 2, PlatformId = 2, Color = "Black", LocationId = 2, PurchaseDate = new DateTime(2015, 6, 11), PurchasePrice = 1875.00M } }; foreach (Item i in items) { context.Items.Add(i); } context.SaveChanges(); var parts = new Part[] { new Part { Name = "Barrel", ManufacturerId = 2, Cost = 189.45M, ItemId = 2 }, new Part { Name = "Lower", ManufacturerId = 3, Cost = 115, ItemId = 2 } }; foreach (Part p in parts) { context.Parts.Add(p); } context.SaveChanges(); }
protected override void Seed(MyStoreContext context) { var manufacturers = new Manufacturer[] { new Manufacturer { Id = 1, Name = "Roda" }, new Manufacturer { Id = 2, Name = "Termomont" }, new Manufacturer { Id = 3, Name = "Honeywell" }, new Manufacturer { Id = 4, Name = "Spirotech" } }; foreach (var manufacturer in manufacturers) { context.Manufacturers.Add(manufacturer); } // Или можно вот так: // Array.ForEach(authors, author => context.Authors.Add(author)); var clients = new Client[] { new Client { Id = 1, Name = "Ник лтд", Adrress = "Одесса, ул.Небесной сотни 15", Bonus = 15 }, new Client { Id = 2, Name = "ТелеКом", Adrress = "Одесса, ул.Решельевская 3", Bonus = 7.5 }, new Client { Id = 3, Name = "УкрЭнерго", Adrress = "Херсон, ул.Бориспольская 7", Bonus = 22.5 }, new Client { Id = 4, Name = "АрмТек", Adrress = "Киев, ул.Черноморская 6", Bonus = 15 }, new Client { Id = 5, Name = "Энергия сервис", Adrress = "Чернигов, ул.Гончая 51", Bonus = 10 }, new Client { Id = 6, Name = "Овк комплект", Adrress = "Киев, ул.Институтская 16", Bonus = 13 }, }; foreach (var client in clients) { context.Clients.Add(client); } // Или можно вот так: // Array.ForEach(presses, press => context.Presses.Add(press)); var parts = new Part[] { new Part { Id = 1, Name = "Электрический котел Roda Storm SL 8 - 7,5 кВт", Cost = 499, ManufacturerFk = manufacturers[0].Id }, new Part { Id = 2, Name = "Электрический котел Roda Storm SL 18 - 18 кВт", Cost = 527, ManufacturerFk = manufacturers[0].Id }, new Part { Id = 3, Name = "Электрический котел Roda Storm SL 15 - 15 кВт", Cost = 527, ManufacturerFk = manufacturers[0].Id }, new Part { Id = 4, Name = "Твердотопливный котёл Termomont ТКК3-25 кВт", Cost = 1453, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 5, Name = "Твердотопливный котёл Termomont ТКU3-20 кВт", Cost = 1514, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 6, Name = "Твердотопливный котёл Termomont ТКК3-30 кВт", Cost = 1574, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 7, Name = "Твердотопливный котёл Termomont ТКU3-25 кВт", Cost = 1635, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 8, Name = "Пеллетный котел Termomont TOBY 12В 12 кВт", Cost = 3269, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 9, Name = "Пеллетный котел Termomont TOBY 12Н 12 кВт", Cost = 3451, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 10, Name = "Пеллетная горелка Termomont Biotermec 50 (10-50 кВт)", Cost = 1639, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 11, Name = "Пеллетная горелка Termomont Biotermec 100 (50-100 кВт)", Cost = 2795, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 12, Name = "Пеллетная горелка Termomont Agrotermec 50 кВт", Cost = 3255, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 13, Name = "Топливная емкость MAFA MINI-300", Cost = 605, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 14, Name = "Топливная емкость MAFA MIDI-730", Cost = 1090, ManufacturerFk = manufacturers[1].Id }, new Part { Id = 15, Name = "Автоматический воздухоотводчик Honeywell E121-3/8A", Cost = 9, ManufacturerFk = manufacturers[2].Id }, new Part { Id = 16, Name = "Автоматический воздухоотводчик Honeywell E121-1/2A", Cost = 10, ManufacturerFk = manufacturers[2].Id }, new Part { Id = 17, Name = "Автоматический воздухоотводчик Spirovent Spirotop AAV AB050", Cost = 76, ManufacturerFk = manufacturers[3].Id }, new Part { Id = 18, Name = "Автоматический воздухоотводчик Spirotop AAV AB050/008", Cost = 115, ManufacturerFk = manufacturers[3].Id }, new Part { Id = 19, Name = "Автоматический воздухоотводчик Spirotop AAV AB050/002", Cost = 115, ManufacturerFk = manufacturers[3].Id }, new Part { Id = 20, Name = "Сепаратор воздуха SpiroVent Air AA075 3/4", Cost = 134, ManufacturerFk = manufacturers[3].Id }, new Part { Id = 21, Name = "Сепаратор воздуха Spirovent Air AA100 1", Cost = 142, ManufacturerFk = manufacturers[3].Id }, new Part { Id = 22, Name = "Гидравлическая стрелка SpiroCross DN50 (под приварку - сталь)", Cost = 1526, ManufacturerFk = manufacturers[3].Id }, new Part { Id = 23, Name = "Гидравлическая стрелка SpiroCross DN50 (фланец - сталь)", Cost = 1777, ManufacturerFk = manufacturers[3].Id }, new Part { Id = 24, Name = "Гидравлическая стрелка SpiroCross DN65 (под приварку - сталь)", Cost = 1780, ManufacturerFk = manufacturers[3].Id }, new Part { Id = 25, Name = "Гидравлическая стрелка SpiroCross DN65 (фланец - сталь)", Cost = 2062, ManufacturerFk = manufacturers[3].Id } }; foreach (var part in parts) { context.Parts.Add(part); } // Или можно вот так: // Array.ForEach(books, book => context.Books.Add(book)); var partsCountHave = new PartCountHave[] { new PartCountHave { Id = 1, Count = 24, PartFk = 1 }, new PartCountHave { Id = 2, Count = 24, PartFk = 2 }, new PartCountHave { Id = 3, Count = 24, PartFk = 3 }, new PartCountHave { Id = 4, Count = 24, PartFk = 4 }, new PartCountHave { Id = 5, Count = 24, PartFk = 5 }, new PartCountHave { Id = 6, Count = 24, PartFk = 6 }, new PartCountHave { Id = 7, Count = 24, PartFk = 7 }, new PartCountHave { Id = 8, Count = 24, PartFk = 8 }, new PartCountHave { Id = 9, Count = 24, PartFk = 9 }, new PartCountHave { Id = 10, Count = 24, PartFk = 10 }, new PartCountHave { Id = 11, Count = 24, PartFk = 11 }, new PartCountHave { Id = 12, Count = 24, PartFk = 12 }, new PartCountHave { Id = 13, Count = 24, PartFk = 13 }, new PartCountHave { Id = 14, Count = 24, PartFk = 14 }, new PartCountHave { Id = 15, Count = 24, PartFk = 15 }, new PartCountHave { Id = 16, Count = 24, PartFk = 16 }, new PartCountHave { Id = 17, Count = 24, PartFk = 17 }, new PartCountHave { Id = 18, Count = 24, PartFk = 18 }, new PartCountHave { Id = 19, Count = 24, PartFk = 19 }, new PartCountHave { Id = 20, Count = 24, PartFk = 20 }, new PartCountHave { Id = 21, Count = 24, PartFk = 21 }, new PartCountHave { Id = 22, Count = 24, PartFk = 22 }, new PartCountHave { Id = 23, Count = 24, PartFk = 23 }, new PartCountHave { Id = 24, Count = 24, PartFk = 24 }, new PartCountHave { Id = 25, Count = 24, PartFk = 25 } }; foreach (var partCountHave in partsCountHave) { context.PartsCountHave.Add(partCountHave); } var admins = new Admin[] { new Admin { Id = 1, Login = "******", Password = "******", Name = "Boss" } }; foreach (var admin in admins) { context.Admins.Add(admin); } DateTime date = new DateTime(2000, 3, 3); var orders = new Order[] { new Order { Id = 1, OrderData = date, ClientFk = clients[0].Id }, new Order { Id = 2, OrderData = DateTime.Now, ClientFk = clients[1].Id }, new Order { Id = 3, OrderData = DateTime.Now, ClientFk = clients[1].Id }, new Order { Id = 4, OrderData = DateTime.Now.AddDays(-1), ClientFk = clients[2].Id }, new Order { Id = 5, OrderData = DateTime.Now.AddDays(-2), ClientFk = clients[3].Id }, new Order { Id = 6, OrderData = DateTime.Now.AddDays(-41), ClientFk = clients[4].Id }, new Order { Id = 7, OrderData = DateTime.Now.AddDays(-3), ClientFk = clients[4].Id }, new Order { Id = 8, OrderData = DateTime.Now.AddDays(-4), ClientFk = clients[0].Id } }; foreach (var order in orders) { context.Orders.Add(order); } var partsInOrders = new PartsInOrder[] { new PartsInOrder { Id = 1, PartFk = parts[0].Id, OrderFk = orders[0].Id, Count = 1, TotalCost = 1 * parts[0].Cost }, new PartsInOrder { Id = 2, PartFk = parts[0].Id, OrderFk = orders[5].Id, Count = 2, TotalCost = 2 * parts[0].Cost }, new PartsInOrder { Id = 3, PartFk = parts[2].Id, OrderFk = orders[0].Id, Count = 1, TotalCost = 1 * parts[2].Cost }, new PartsInOrder { Id = 4, PartFk = parts[4].Id, OrderFk = orders[1].Id, Count = 3, TotalCost = 3 * parts[4].Cost }, new PartsInOrder { Id = 5, PartFk = parts[4].Id, OrderFk = orders[1].Id, Count = 1, TotalCost = 1 * parts[4].Cost }, new PartsInOrder { Id = 6, PartFk = parts[5].Id, OrderFk = orders[2].Id, Count = 1, TotalCost = 1 * parts[5].Cost }, new PartsInOrder { Id = 7, PartFk = parts[6].Id, OrderFk = orders[6].Id, Count = 2, TotalCost = 2 * parts[6].Cost }, new PartsInOrder { Id = 8, PartFk = parts[8].Id, OrderFk = orders[3].Id, Count = 1, TotalCost = 1 * parts[8].Cost }, new PartsInOrder { Id = 9, PartFk = parts[9].Id, OrderFk = orders[2].Id, Count = 6, TotalCost = 6 * parts[9].Cost }, new PartsInOrder { Id = 10, PartFk = parts[10].Id, OrderFk = orders[1].Id, Count = 2, TotalCost = 2 * parts[10].Cost }, new PartsInOrder { Id = 11, PartFk = parts[12].Id, OrderFk = orders[4].Id, Count = 5, TotalCost = 5 * parts[12].Cost }, new PartsInOrder { Id = 12, PartFk = parts[15].Id, OrderFk = orders[6].Id, Count = 1, TotalCost = 1 * parts[15].Cost }, new PartsInOrder { Id = 13, PartFk = parts[15].Id, OrderFk = orders[7].Id, Count = 2, TotalCost = 2 * parts[15].Cost }, new PartsInOrder { Id = 14, PartFk = parts[15].Id, OrderFk = orders[2].Id, Count = 1, TotalCost = 1 * parts[15].Cost }, new PartsInOrder { Id = 15, PartFk = parts[17].Id, OrderFk = orders[5].Id, Count = 3, TotalCost = 3 * parts[17].Cost }, new PartsInOrder { Id = 16, PartFk = parts[19].Id, OrderFk = orders[4].Id, Count = 5, TotalCost = 5 * parts[19].Cost }, new PartsInOrder { Id = 17, PartFk = parts[20].Id, OrderFk = orders[1].Id, Count = 4, TotalCost = 4 * parts[20].Cost }, new PartsInOrder { Id = 18, PartFk = parts[21].Id, OrderFk = orders[3].Id, Count = 2, TotalCost = 2 * parts[21].Cost }, new PartsInOrder { Id = 19, PartFk = parts[22].Id, OrderFk = orders[5].Id, Count = 1, TotalCost = 1 * parts[22].Cost }, new PartsInOrder { Id = 20, PartFk = parts[22].Id, OrderFk = orders[4].Id, Count = 1, TotalCost = 1 * parts[22].Cost }, new PartsInOrder { Id = 21, PartFk = parts[23].Id, OrderFk = orders[2].Id, Count = 3, TotalCost = 3 * parts[23].Cost }, new PartsInOrder { Id = 22, PartFk = parts[24].Id, OrderFk = orders[3].Id, Count = 4, TotalCost = 4 * parts[24].Cost } }; foreach (var partsInOrder in partsInOrders) { context.PartsInOrders.Add(partsInOrder); } base.Seed(context); }
public async Task <List <Manufacturer> > Manufacturers() { var imagesPath = _sampleImagesPath; var gridOrLinesTemplate = ManufacturerTemplates().Where(x => x.ViewPath == "ManufacturerTemplate.ProductsInGridOrLines").FirstOrDefault(); var discounts = await _db.Discounts .Where(x => x.DiscountTypeId == (int)DiscountType.AssignedToManufacturers) .ToListAsync(); var manufacturerJackWolfskin = new Manufacturer { Name = "Jack-Wolfskin", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/Jack_Wolfskin.png"), Published = true, DisplayOrder = 1 }; var manufacturerEASports = new Manufacturer { Name = "EA Sports", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/EA_Sports.png"), Published = true, DisplayOrder = 1 }; var manufacturerWarnerHome = new Manufacturer { Name = "Warner Home Video Games", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/wb.png", GetSeName("Warner Home Video Games")), Published = true, DisplayOrder = 1 }; var manufacturerBreitling = new Manufacturer { Name = "Breitling", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/breitling.png"), Published = true, DisplayOrder = 1 }; if (discounts.Any()) { manufacturerBreitling.HasDiscountsApplied = true; manufacturerBreitling.AppliedDiscounts.Add(discounts.First()); } var manufacturerTissot = new Manufacturer { Name = "Tissot", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/Tissot.png"), Published = true, DisplayOrder = 1 }; var manufacturerSeiko = new Manufacturer { Name = "Seiko", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/seiko.png"), Published = true, DisplayOrder = 1 }; if (discounts.Any()) { manufacturerSeiko.HasDiscountsApplied = true; manufacturerSeiko.AppliedDiscounts.Add(discounts.First()); } var manufacturerTitleist = new Manufacturer { Name = "Titleist", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/titleist.png"), Published = true, DisplayOrder = 1 }; var manufacturerPuma = new Manufacturer { Name = "Puma", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/puma.jpg"), Published = true, DisplayOrder = 1 }; var manufacturerNike = new Manufacturer { Name = "Nike", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/nike.png"), Published = true, DisplayOrder = 1 }; var manufacturerAdidas = new Manufacturer { Name = "Adidas", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/adidas.png"), Published = true, DisplayOrder = 1 }; var manufacturerRayban = new Manufacturer { Name = "Ray-Ban", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/ray-ban.jpg"), Published = true, DisplayOrder = 1 }; var manufacturerOakley = new Manufacturer { Name = "Oakley", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/oakley.png"), Published = true, DisplayOrder = 1 }; var manufacturerApple = new Manufacturer { Name = "Apple", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/apple.png"), Published = true, DisplayOrder = 1 }; var manufacturerMicrosoft = new Manufacturer { Name = "Microsoft", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/microsoft-icon.png", GetSeName("Microsoft")), Published = true, DisplayOrder = 6 }; var manufacturerFestina = new Manufacturer { Name = "Festina", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/festina.png"), Published = true, DisplayOrder = 17 }; var manufacturerCertina = new Manufacturer { Name = "Certina", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/certina.png"), Published = true, DisplayOrder = 18 }; var manufacturerSony = new Manufacturer { Name = "Sony", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/sony.png"), Published = true, DisplayOrder = 19 }; var manufacturerUbisoft = new Manufacturer { Name = "Ubisoft", ManufacturerTemplateId = gridOrLinesTemplate.Id, MediaFile = CreatePicture("brand/ubisoft.png"), Published = true, DisplayOrder = 20 }; //var manufacturerMeyAndEdlich = new Manufacturer //{ // Name = "Mey-And-Edlich", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/MeyAndEdlich.jpg", GetSeName("Mey Edlich")), // Published = true, // DisplayOrder = 1 //}; //var manufacturerWilson = new Manufacturer //{ // Name = "Wilson", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/wilson.png"), // Published = true, // DisplayOrder = 1 //}; //var manufacturerAndroid = new Manufacturer //{ // Name = "Android", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/android.png"), // Published = true, // DisplayOrder = 2 //}; //var manufacturerLG = new Manufacturer //{ // Name = "LG", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/lg.png"), // Published = true, // DisplayOrder = 3 //}; //var manufacturerDell = new Manufacturer //{ // Name = "Dell", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/dell.png"), // Published = true, // DisplayOrder = 4 //}; //var manufacturerHP = new Manufacturer //{ // Name = "HP", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/hp.png"), // Published = true, // DisplayOrder = 5 //}; //var manufacturerSamsung = new Manufacturer //{ // Name = "Samsung", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/samsung.png"), // Published = true, // DisplayOrder = 7 //}; //var manufacturerAcer = new Manufacturer //{ // Name = "Acer", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/acer.jpg"), // Published = true, // DisplayOrder = 8 //}; //var manufacturerTrekStor = new Manufacturer //{ // Name = "TrekStor", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/trekstor.png"), // Published = true, // DisplayOrder = 9 //}; //var manufacturerWesternDigital = new Manufacturer //{ // Name = "Western Digital", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/westerndigital.png"), // Published = true, // DisplayOrder = 10 //}; //var manufacturerMSI = new Manufacturer //{ // Name = "MSI", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/msi.png"), // Published = true, // DisplayOrder = 11 //}; //var manufacturerCanon = new Manufacturer //{ // Name = "Canon", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/canon.png"), // Published = true, // DisplayOrder = 12 //}; //var manufacturerCasio = new Manufacturer //{ // Name = "Casio", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/casio.png"), // Published = true, // DisplayOrder = 13 //}; //var manufacturerPanasonic = new Manufacturer //{ // Name = "Panasonic", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/panasonic.png"), // Published = true, // DisplayOrder = 14 //}; //var manufacturerBlackBerry = new Manufacturer //{ // Name = "BlackBerry", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/blackberry.png"), // Published = true, // DisplayOrder = 15 //}; //var manufacturerHTC = new Manufacturer //{ // Name = "HTC", // ManufacturerTemplateId = manufacturerTemplateInGridAndLines.Id, // MediaFile = CreatePicture("brand/htc.png"), // Published = true, // DisplayOrder = 16 //}; var entities = new List <Manufacturer> { manufacturerEASports, manufacturerWarnerHome, manufacturerBreitling, manufacturerTissot, manufacturerSeiko, manufacturerTitleist, manufacturerApple, manufacturerFestina, manufacturerCertina, manufacturerSony, manufacturerUbisoft, manufacturerOakley, manufacturerRayban, manufacturerAdidas, manufacturerPuma, manufacturerNike, manufacturerJackWolfskin, manufacturerMicrosoft, }; Alter(entities); return(entities); }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Identifier != null) && (Identifier.Count != 0)) { writer.WritePropertyName("identifier"); writer.WriteStartArray(); foreach (Identifier valIdentifier in Identifier) { valIdentifier.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Code != null) { writer.WritePropertyName("code"); Code.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Status)) { writer.WriteString("status", (string)Status !); } if (_Status != null) { writer.WritePropertyName("_status"); _Status.SerializeJson(writer, options); } if (Manufacturer != null) { writer.WritePropertyName("manufacturer"); Manufacturer.SerializeJson(writer, options); } if (Form != null) { writer.WritePropertyName("form"); Form.SerializeJson(writer, options); } if (Amount != null) { writer.WritePropertyName("amount"); Amount.SerializeJson(writer, options); } if ((Ingredient != null) && (Ingredient.Count != 0)) { writer.WritePropertyName("ingredient"); writer.WriteStartArray(); foreach (MedicationIngredient valIngredient in Ingredient) { valIngredient.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Batch != null) { writer.WritePropertyName("batch"); Batch.SerializeJson(writer, options); } if (includeStartObject) { writer.WriteEndObject(); } }
/// <summary> /// Prepare paged manufacturer product list model /// </summary> /// <param name="searchModel">Manufacturer product search model</param> /// <param name="manufacturer">Manufacturer</param> /// <returns>Manufacturer product list model</returns> public virtual ManufacturerProductListModel PrepareManufacturerProductListModel(ManufacturerProductSearchModel searchModel, Manufacturer manufacturer) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } if (manufacturer == null) { throw new ArgumentNullException(nameof(manufacturer)); } //get product manufacturers var productManufacturers = _manufacturerService.GetProductManufacturersByManufacturerId(showHidden: true, manufacturerId: manufacturer.Id, pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize); //prepare grid model var model = new ManufacturerProductListModel().PrepareToGrid(searchModel, productManufacturers, () => { return(productManufacturers.Select(productManufacturer => { //fill in model values from the entity var manufacturerProductModel = productManufacturer.ToModel <ManufacturerProductModel>(); //fill in additional values (not existing in the entity) manufacturerProductModel.ProductName = _productService.GetProductById(productManufacturer.ProductId)?.Name; return manufacturerProductModel; })); }); return(model); }
public static Manufacturer ToEntity(this ManufacturerModel model, Manufacturer destination) { return(model.MapTo(destination)); }
public NetworkCard(Manufacturer manufacturer, int price) : base(manufacturer, price) { }
public static ManufacturerModel ToModel(this Manufacturer entity) { return(entity.MapTo <Manufacturer, ManufacturerModel>()); }
public Case(Manufacturer manufacturer, int price) : base(manufacturer, price) { }
public SuperIOHardware(Mainboard mainboard, ISuperIO superIO, Manufacturer manufacturer, Model model, ISettings settings) { this.mainboard = mainboard; this.superIO = superIO; this.name = ChipName.GetName(superIO.Chip); List <Voltage> v = new List <Voltage>(); List <Temperature> t = new List <Temperature>(); List <Fan> f = new List <Fan>(); switch (superIO.Chip) { case Chip.IT8712F: case Chip.IT8716F: case Chip.IT8718F: case Chip.IT8720F: case Chip.IT8726F: switch (manufacturer) { case Manufacturer.ASUS: switch (model) { case Model.Crosshair_III_Formula: // IT8720F v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("CPU", 0)); for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; case Model.M2N_SLI_DELUXE: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("+3.3V", 1)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 4, 30, 10)); v.Add(new Voltage("+5VSB", 7, 6.8f, 10)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Motherboard", 1)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("Chassis Fan #1", 1)); f.Add(new Fan("Power Fan", 2)); break; case Model.M4A79XTD_EVO: // IT8720F v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Motherboard", 1)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("Chassis Fan #1", 1)); f.Add(new Fan("Chassis Fan #2", 2)); break; default: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("Voltage #3", 2, true)); v.Add(new Voltage("Voltage #4", 3, true)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("Voltage #8", 7, true)); v.Add(new Voltage("VBat", 8)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } break; case Manufacturer.DFI: switch (model) { case Model.LP_BI_P45_T2RS_Elite: // IT8718F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("FSB VTT", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 4, 30, 10)); v.Add(new Voltage("NB Core", 5)); v.Add(new Voltage("VDIMM", 6)); v.Add(new Voltage("+5VSB", 7, 6.8f, 10)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("System", 1)); t.Add(new Temperature("Chipset", 2)); f.Add(new Fan("Fan #1", 0)); f.Add(new Fan("Fan #2", 1)); f.Add(new Fan("Fan #3", 2)); break; case Model.LP_DK_P55_T3eH9: // IT8720F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("VTT", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 4, 30, 10)); v.Add(new Voltage("CPU PLL", 5)); v.Add(new Voltage("DRAM", 6)); v.Add(new Voltage("+5VSB", 7, 6.8f, 10)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("Chipset", 0)); t.Add(new Temperature("CPU PWM", 1)); t.Add(new Temperature("CPU", 2)); f.Add(new Fan("Fan #1", 0)); f.Add(new Fan("Fan #2", 1)); f.Add(new Fan("Fan #3", 2)); break; default: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("VTT", 1, true)); v.Add(new Voltage("+3.3V", 2, true)); v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true)); v.Add(new Voltage("+12V", 4, 30, 10, 0, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("DRAM", 6, true)); v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true)); v.Add(new Voltage("VBat", 8)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } break; case Manufacturer.Gigabyte: switch (model) { case Model._965P_S3: // IT8718F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 7, 27, 9.1f)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("System", 0)); t.Add(new Temperature("CPU", 1)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan", 1)); break; case Model.EP45_DS3R: // IT8718F case Model.EP45_UD3R: case Model.X38_DS5: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 7, 27, 9.1f)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("System", 0)); t.Add(new Temperature("CPU", 1)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan #2", 1)); f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("System Fan #1", 3)); break; case Model.EX58_EXTREME: // IT8720F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("System", 0)); t.Add(new Temperature("CPU", 1)); t.Add(new Temperature("Northbridge", 2)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan #2", 1)); f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("System Fan #1", 3)); break; case Model.P35_DS3: // IT8718F case Model.P35_DS3L: // IT8718F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 7, 27, 9.1f)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("System", 0)); t.Add(new Temperature("CPU", 1)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan #1", 1)); f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("Power Fan", 3)); break; case Model.P55_UD4: // IT8720F case Model.P55M_UD4: // IT8720F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 5, 27, 9.1f)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("System", 0)); t.Add(new Temperature("CPU", 2)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan #2", 1)); f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("System Fan #1", 3)); break; case Model.GA_MA770T_UD3: // IT8720F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 4, 27, 9.1f)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("System", 0)); t.Add(new Temperature("CPU", 1)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan #1", 1)); f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("Power Fan", 3)); break; case Model.GA_MA785GMT_UD2H: // IT8718F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 4, 27, 9.1f)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("System", 0)); t.Add(new Temperature("CPU", 1)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan", 1)); f.Add(new Fan("NB Fan", 2)); break; case Model.X58A_UD3R: // IT8720F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1)); v.Add(new Voltage("+3.3V", 2)); v.Add(new Voltage("+5V", 3, 6.8f, 10)); v.Add(new Voltage("+12V", 5, 27, 9.1f)); v.Add(new Voltage("VBat", 8)); t.Add(new Temperature("System", 0)); t.Add(new Temperature("CPU", 1)); t.Add(new Temperature("Northbridge", 2)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan #2", 1)); f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("System Fan #1", 3)); break; default: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("DRAM", 1, true)); v.Add(new Voltage("+3.3V", 2, true)); v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("+12V", 7, 27, 9.1f, 0, true)); v.Add(new Voltage("VBat", 8)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } break; default: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("Voltage #3", 2, true)); v.Add(new Voltage("Voltage #4", 3, true)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("Voltage #8", 7, true)); v.Add(new Voltage("VBat", 8)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } break; case Chip.IT8721F: switch (manufacturer) { case Manufacturer.ECS: switch (model) { case Model.A890GXM_A: // IT8721F v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("VDIMM", 1)); v.Add(new Voltage("NB Voltage", 2)); v.Add(new Voltage("Analog +3.3V", 3, 10, 10)); // v.Add(new Voltage("VDIMM", 6, true)); v.Add(new Voltage("Standby +3.3V", 7, 10, 10)); v.Add(new Voltage("VBat", 8, 10, 10)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("System", 1)); t.Add(new Temperature("Northbridge", 2)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan", 1)); f.Add(new Fan("Power Fan", 2)); break; default: v.Add(new Voltage("Voltage #1", 0, true)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("Voltage #3", 2, true)); v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true)); v.Add(new Voltage("VBat", 8, 10, 10)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } break; default: v.Add(new Voltage("Voltage #1", 0, true)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("Voltage #3", 2, true)); v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true)); v.Add(new Voltage("VBat", 8, 10, 10)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } break; case Chip.F71858: v.Add(new Voltage("VCC3V", 0, 150, 150)); v.Add(new Voltage("VSB3V", 1, 150, 150)); v.Add(new Voltage("Battery", 2, 150, 150)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; case Chip.F71862: case Chip.F71869: case Chip.F71882: case Chip.F71889ED: case Chip.F71889F: switch (manufacturer) { case Manufacturer.EVGA: switch (model) { case Model.X58_SLI_Classified: // F71882 v.Add(new Voltage("VCC3V", 0, 150, 150)); v.Add(new Voltage("CPU VCore", 1, 47, 100)); v.Add(new Voltage("DIMM", 2, 47, 100)); v.Add(new Voltage("CPU VTT", 3, 24, 100)); v.Add(new Voltage("IOH Vcore", 4, 24, 100)); v.Add(new Voltage("+5V", 5, 51, 12)); v.Add(new Voltage("+12V", 6, 56, 6.8f)); v.Add(new Voltage("3VSB", 7, 150, 150)); v.Add(new Voltage("VBat", 8, 150, 150)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("VREG", 1)); t.Add(new Temperature("System", 2)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("Power Fan", 1)); f.Add(new Fan("Chassis Fan", 2)); break; default: v.Add(new Voltage("VCC3V", 0, 150, 150)); v.Add(new Voltage("CPU VCore", 1)); v.Add(new Voltage("Voltage #3", 2, true)); v.Add(new Voltage("Voltage #4", 3, true)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("VSB3V", 7, 150, 150)); v.Add(new Voltage("VBat", 8, 150, 150)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } break; default: v.Add(new Voltage("VCC3V", 0, 150, 150)); v.Add(new Voltage("CPU VCore", 1)); v.Add(new Voltage("Voltage #3", 2, true)); v.Add(new Voltage("Voltage #4", 3, true)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("VSB3V", 7, 150, 150)); v.Add(new Voltage("VBat", 8, 150, 150)); for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } break; case Chip.W83627EHF: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("AVCC", 2, 34, 34)); v.Add(new Voltage("3VCC", 3, 34, 34)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("3VSB", 7, 34, 34)); v.Add(new Voltage("VBAT", 8, 34, 34)); v.Add(new Voltage("Voltage #10", 9, true)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Auxiliary", 1)); t.Add(new Temperature("System", 2)); f.Add(new Fan("System Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); break; case Chip.W83627DHG: case Chip.W83627DHGP: case Chip.W83667HG: case Chip.W83667HGB: switch (manufacturer) { case Manufacturer.ASRock: switch (model) { case Model._880GMH_USB3: // W83627DHG-P v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("+3.3V", 3, 34, 34)); v.Add(new Voltage("+5V", 5, 15, 7.5f)); v.Add(new Voltage("+12V", 6, 56, 10)); v.Add(new Voltage("Standby +3.3V", 7, 34, 34)); v.Add(new Voltage("VBAT", 8, 34, 34)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Motherboard", 2)); f.Add(new Fan("Chassis Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Power Fan", 2)); break; default: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("AVCC", 2, 34, 34)); v.Add(new Voltage("3VCC", 3, 34, 34)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("3VSB", 7, 34, 34)); v.Add(new Voltage("VBAT", 8, 34, 34)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Auxiliary", 1)); t.Add(new Temperature("System", 2)); f.Add(new Fan("System Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); break; } break; case Manufacturer.ASUS: switch (model) { case Model.P6X58D_E: // W83667HG case Model.Rampage_II_GENE: // W83667HG v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("+12V", 1, 11.5f, 1.91f)); v.Add(new Voltage("Analog +3.3V", 2, 34, 34)); v.Add(new Voltage("+3.3V", 3, 34, 34)); v.Add(new Voltage("+5V", 4, 15, 7.5f)); v.Add(new Voltage("Standby +3.3V", 7, 34, 34)); v.Add(new Voltage("VBAT", 8, 34, 34)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Motherboard", 2)); f.Add(new Fan("Chassis Fan #1", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("Chassis Fan #2", 3)); f.Add(new Fan("Chassis Fan #3", 4)); break; case Model.Rampage_Extreme: // W83667HG v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("+12V", 1, 12, 2)); v.Add(new Voltage("Analog +3.3V", 2, 34, 34)); v.Add(new Voltage("+3.3V", 3, 34, 34)); v.Add(new Voltage("+5V", 4, 15, 7.5f)); v.Add(new Voltage("Standby +3.3V", 7, 34, 34)); v.Add(new Voltage("VBAT", 8, 34, 34)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Motherboard", 2)); f.Add(new Fan("Chassis Fan #1", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("Chassis Fan #2", 3)); f.Add(new Fan("Chassis Fan #3", 4)); break; default: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("AVCC", 2, 34, 34)); v.Add(new Voltage("3VCC", 3, 34, 34)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("3VSB", 7, 34, 34)); v.Add(new Voltage("VBAT", 8, 34, 34)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Auxiliary", 1)); t.Add(new Temperature("System", 2)); f.Add(new Fan("System Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); break; } break; default: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("AVCC", 2, 34, 34)); v.Add(new Voltage("3VCC", 3, 34, 34)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("Voltage #6", 5, true)); v.Add(new Voltage("Voltage #7", 6, true)); v.Add(new Voltage("3VSB", 7, 34, 34)); v.Add(new Voltage("VBAT", 8, 34, 34)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Auxiliary", 1)); t.Add(new Temperature("System", 2)); f.Add(new Fan("System Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); break; } break; case Chip.W83627HF: case Chip.W83627THF: case Chip.W83687THF: v.Add(new Voltage("CPU VCore", 0)); v.Add(new Voltage("Voltage #2", 1, true)); v.Add(new Voltage("Voltage #3", 2, true)); v.Add(new Voltage("AVCC", 3, 34, 51)); v.Add(new Voltage("Voltage #5", 4, true)); v.Add(new Voltage("5VSB", 5, 34, 51)); v.Add(new Voltage("VBAT", 6)); t.Add(new Temperature("CPU", 0)); t.Add(new Temperature("Auxiliary", 1)); t.Add(new Temperature("System", 2)); f.Add(new Fan("System Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Auxiliary Fan", 2)); break; default: for (int i = 0; i < superIO.Voltages.Length; i++) { v.Add(new Voltage("Voltage #" + (i + 1), i, true)); } for (int i = 0; i < superIO.Temperatures.Length; i++) { t.Add(new Temperature("Temperature #" + (i + 1), i)); } for (int i = 0; i < superIO.Fans.Length; i++) { f.Add(new Fan("Fan #" + (i + 1), i)); } break; } const string formula = "Voltage = value + (value - Vf) * Ri / Rf."; foreach (Voltage voltage in v) { if (voltage.Index < superIO.Voltages.Length) { Sensor sensor = new Sensor(voltage.Name, voltage.Index, voltage.Hidden, SensorType.Voltage, this, new [] { new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + formula, voltage.Ri), new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + formula, voltage.Rf), new ParameterDescription("Vf [V]", "Reference voltage.\n" + formula, voltage.Vf) }, settings); voltages.Add(sensor); } } foreach (Temperature temperature in t) { if (temperature.Index < superIO.Temperatures.Length) { Sensor sensor = new Sensor(temperature.Name, temperature.Index, SensorType.Temperature, this, new [] { new ParameterDescription("Offset [°C]", "Temperature offset.", 0) }, settings); temperatures.Add(sensor); } } foreach (Fan fan in f) { if (fan.Index < superIO.Fans.Length) { Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan, this, settings); fans.Add(sensor); } } }
public void AddManufacturer(Manufacturer manufacturer) { throw new NotImplementedException(); }
public async Task <ServiceResponse <GetWarehouseTransactionDto> > CreateWarehouseTransactionAsync(CreateWarehouseTransactionDto dto) { var response = new ServiceResponse <GetWarehouseTransactionDto>(); try { var userIdentifier = _httpCtxAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier); var user = await _context.Users.SingleOrDefaultAsync(x => x.Email == userIdentifier); if (user == null) { throw new UserNotFoundException(); } Manufacturer dbManufacturer = null; if (dto.TransactionType == WarehouseTransactionType.Import) { dbManufacturer = await _context.Manufacturers.FirstOrDefaultAsync(x => x.Id == dto.ManufacturerId); if (dbManufacturer == null) { throw new ManufacturerNotFoundException(); } } var newTransaction = new WarehouseTransaction() { TransactionType = dto.TransactionType, CreatedAt = dto.CreatedAt, Status = WarehouseTransactionStatus.Processing, // new warehouse transaction has processing status as default Manufacturer = dbManufacturer, CreatedBy = user, Description = dto.Description, }; await _context.WarehouseTransactions.AddAsync(newTransaction); var dbWarehouseTransactionItems = dto.WarehouseTransactionItems.Select(item => new WarehouseTransactionItem { WarehouseTransaction = newTransaction, ProductId = item.ProductId, Cost = item.Cost, Quantity = item.Quantity }); await _context.WarehouseTransactionItems.AddRangeAsync(dbWarehouseTransactionItems); await _context.SaveChangeWithValidationAsync(); response.Data = _mapper.Map <GetWarehouseTransactionDto>(newTransaction); return(response); } catch (BaseServiceException ex) { response.Success = false; response.Message = ex.ErrorMessage; response.Code = ex.Code; _logger.LogError(ex.Message, ex.StackTrace); return(response); } catch (Exception ex) { response.Success = false; response.Message = ex.Message; response.Code = ErrorCode.WAREHOUSE_TRANSACTION_UNEXPECTED_ERROR; _logger.LogError(ex.Message, ex.StackTrace); return(response); } }
public async Task Save(Manufacturer manufacturer) { await _manufacturerRepo.Save(); }
public TechEquipment(Guid serialNumber, string description, DateTime dateOfPurchase, int warrantyInMonths, double priceWhenBought, Manufacturer manufacturer, bool batteries) : base(serialNumber, description, dateOfPurchase, warrantyInMonths, priceWhenBought, manufacturer) { Batteries = batteries; }
public async Task Insert(Manufacturer manufacturer) { _manufacturerRepo.InsertManufacturer(manufacturer); await _manufacturerRepo.Save(); }
public async Task <ActionResult> ExportToExcelWl(LotMaterialListViewModel model) { DataTable dt = new DataTable(); MethodReturnResult <DataSet> result = new MethodReturnResult <DataSet>(); using (LotQueryServiceClient client = new LotQueryServiceClient()) { RPTLotMateriallistParameter param = new RPTLotMateriallistParameter(); param.LotNumber = model.LotNumber; param.PageSize = model.PageSize; param.PageNo = -1; await Task.Run(() => { PagingConfig cfg = new PagingConfig() { OrderBy = "Key.LotNumber,ItemNo", Where = GetQueryCondition(model) }; MethodReturnResult <DataSet> ds = client.GetRPTLotMaterialList(ref param); dt = ds.Data.Tables[0]; }); } //创建工作薄。 IWorkbook wb = new HSSFWorkbook(); //设置EXCEL格式 ICellStyle style = wb.CreateCellStyle(); style.FillForegroundColor = 10; //有边框 style.BorderBottom = BorderStyle.Thin; style.BorderLeft = BorderStyle.Thin; style.BorderRight = BorderStyle.Thin; style.BorderTop = BorderStyle.Thin; IFont font = wb.CreateFont(); font.Boldweight = 10; style.SetFont(font); ISheet ws = null; for (int j = 0; j < dt.Rows.Count; j++) { if (j % 65535 == 0) { ws = wb.CreateSheet(); IRow row = ws.CreateRow(0); ICell cell = null; #region //列名 foreach (DataColumn dc in dt.Columns) { cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(dc.Caption); } #endregion font.Boldweight = 5; } IRow rowData = ws.CreateRow(j + 1); #region //数据 ICell cellData = null; foreach (DataColumn dc in dt.Columns) { System.Data.DataRow obj = dt.Rows[j]; Manufacturer mf = null; using (SupplierToManufacturerServiceClient clients = new SupplierToManufacturerServiceClient()) { PagingConfig cfg0 = new PagingConfig() { Where = string.Format(@"Key.MaterialCode='{0}' AND Key.SupplierCode='{1}'" , obj["MATERIAL_CODE"] , obj["SUPPLIER_CODE"]) }; MethodReturnResult <IList <SupplierToManufacturer> > results = clients.Gets(ref cfg0); if (results.Code <= 0 && results.Data.Count > 0) { if (results.Data[0].Key.OrderNumber == "*") { using (ManufacturerServiceClient clientss = new ManufacturerServiceClient()) { MethodReturnResult <Manufacturer> rsts = clientss.Get(results.Data[0].ManufacturerCode); if (rsts.Data != null) { mf = rsts.Data; } } } else { PagingConfig cfg1 = new PagingConfig() { Where = string.Format(@"Key.MaterialCode='{0}' AND Key.OrderNumber='{1}' AND Key.SupplierCode='{2}'" , obj["MATERIAL_CODE"] , obj["ORDER_NUMBER"] , obj["SUPPLIER_CODE"]) }; MethodReturnResult <IList <SupplierToManufacturer> > resultss = clients.Gets(ref cfg1); if (resultss.Code <= 0 && resultss.Data.Count > 0) { using (ManufacturerServiceClient clientss = new ManufacturerServiceClient()) { MethodReturnResult <Manufacturer> rsts = clientss.Get(resultss.Data[0].ManufacturerCode); if (rsts.Data != null) { mf = rsts.Data; } } } } } } cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; if (dc.DataType == typeof(double) || dc.DataType == typeof(float)) { if (dc.ColumnName == "SUPPLIER_CODE") { cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Key); } else if (dc.ColumnName == "SUPPLIER_NAME") { cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Name); } else { cellData.SetCellValue(Convert.ToDouble(dt.Rows[j][dc])); } } else if (dc.DataType == typeof(int)) { if (dc.ColumnName == "SUPPLIER_CODE") { cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Key); } else if (dc.ColumnName == "SUPPLIER_NAME") { cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Name); } else { cellData.SetCellValue(Convert.ToInt32(dt.Rows[j][dc])); } } else { if (dc.ColumnName == "SUPPLIER_CODE") { cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Key); } else if (dc.ColumnName == "SUPPLIER_NAME") { cellData.SetCellValue(mf == null ? Convert.ToString(dt.Rows[j][dc]) : mf.Name); } else { cellData.SetCellValue(Convert.ToString(dt.Rows[j][dc])); } } } #endregion } MemoryStream ms = new MemoryStream(); wb.Write(ms); ms.Flush(); ms.Position = 0; return(File(ms, "application/vnd.ms-excel", "LotMaterialData.xls")); }