public SupplierCollection FetchAll() { SupplierCollection coll = new SupplierCollection(); Query qry = new Query(Supplier.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
private async void LoadSuppliers() { SupplierCollection.Clear(); var collection = await DbHandler.Instance.GetSupplierCollection(); SupplierCollection.AddRange(collection); }
public SupplierDashboard(MainWindow Main, SupplierCollection supps) { InitializeComponent(); SetMainWindowRef(Main); foreach (Supplier Supp in supps) { var refcontrol = new SupplierControl(); try { var suppcount = Supp.Mixdown.Count; var DiscontCount = SQLServer.MSSelectData("SELECT COUNT(*) FROM whldata.sku_supplierdata WHERE SupplierName ='" + Supp.Code + "' AND isDiscontinued='True' ;") as ArrayList; refcontrol.FullSupplierName.Text = Supp.Name; refcontrol.SupplierCode.Text = Supp.Code; refcontrol.TotalLines.Text = suppcount.ToString() + " Lines"; refcontrol.Discontinued.Text = (DiscontCount[0] as ArrayList)[0].ToString() + " Discontinued"; refcontrol.SupplierCodeInternal = Supp.Code; refcontrol.SupplierInternal = Supp; refcontrol.MouseUp += Refcontrol_MouseUp; refcontrol.TouchUp += Refcontrol_TouchUp; } catch (InvalidCastException) { continue; } catch (NullReferenceException) { continue; } finally { SupplierStackPanel.Children.Add(refcontrol); } } }
void _supplierOperationVM_OnSaved(object sender, Supplier e) { SupplierCollection.Remove(e); SupplierCollection.Add(e); _hardwareOperationVM_OnClosed(sender, new EventArgs { }); }
/// <summary> /// Конструктор создает объект с привязкой родительского объекта /// </summary> public Product(Product toCopy) : this() { if (toCopy == null) return; _batchNumber = toCopy.BatchNumber; _costNew = toCopy.CostNew; _costOvehaul = toCopy.CostOverhaul; _costServiceable = toCopy.CostServiceable; _description = toCopy.Description; _manufacturer = toCopy.Manufacturer; _measure = toCopy.Measure; _partNumber = toCopy.PartNumber; _remarks = toCopy.Remarks; _serialNumber = toCopy.SerialNumber; _standart = toCopy.Standart; if (_suppliers == null) _suppliers = new SupplierCollection(); _suppliers.Clear(); foreach (Supplier supplier in toCopy.Suppliers) { _suppliers.Add(supplier); } if (_supplierRelations == null) _supplierRelations = new CommonCollection<KitSuppliersRelation>(); _supplierRelations.Clear(); foreach (KitSuppliersRelation ksr in toCopy.SupplierRelations) { _supplierRelations.Add(new KitSuppliersRelation(ksr) {KitId = ItemId}); } }
public static SupplierCollection ToDtoCollection(this EntityCollection <SupplierEntity> entities) { OnBeforeEntityCollectionToDtoCollection(entities); var seenObjects = new Hashtable(); var collection = new SupplierCollection(); foreach (var entity in entities) { collection.Add(entity.ToDto(seenObjects, new Hashtable())); } OnAfterEntityCollectionToDtoCollection(entities, collection); return(collection); }
/// <summary> /// Loads a collection of Supplier objects from the database. /// </summary> /// <returns>A collection containing all of the Supplier objects in the database.</returns> public static SupplierCollection LoadCollection(string spName, SqlParameter[] parms) { SupplierCollection result = new SupplierCollection(); using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms)) { while (reader.Read()) { Supplier tmp = new Supplier(); tmp.LoadFromReader(reader); result.Add(tmp); } } return(result); }
/// <summary> /// Создает воздушное судно без дополнительной информации /// </summary> public TemplateComponent() { SmartCoreObjectType = SmartCoreType.Component; // Отрицательный индекс свидетельствует о том, что агрегат не сохранен в базе данных ItemId = -1; // Все ресурсы должны быть заполнеными - иначе исключение при сохранении в базу данных Warranty = Lifelength.Null; WarrantyNotify = Lifelength.Null; LifeLimit = Lifelength.Null; LifeLimitNotify = Lifelength.Null; // Задаем Maintenance Type MaintenanceControlProcess = MaintenanceControlProcess.OC; // String тоже не должны быть равны null PartNumber = Description = SerialNumber = Remarks = Manufacturer = ALTPartNumber = MTOGW = HushKit = ShelfLife = BatchNumber = MPDItem; Suppliers = new SupplierCollection(); Kits = new CommonCollection <AccessoryRequired>(); ComponentDirectives = new List <TemplateComponentDirective>(); }
protected override void OnInit(EventArgs e) { base.OnInit(e); cmdSave.Click += new EventHandler(cmdSave_Click); cmdCancel.Click += new EventHandler(cmdCancel_Click); if (!this.IsPostBack) { //Load the suppliers SupplierCollection supplierCollection = SupplierCollection.RunSelect(); cboSupplier.DataTextField = Supplier.FieldNameConstants.CompanyName.ToString(); cboSupplier.DataValueField = Supplier.FieldNameConstants.SupplierId.ToString(); cboSupplier.DataSource = (from x in supplierCollection orderby x.CompanyName select x); cboSupplier.DataBind(); //Load the cateogries CategoryCollection categoryCollection = CategoryCollection.RunSelect(); cboCategory.DataTextField = Category.FieldNameConstants.CategoryName.ToString(); cboCategory.DataValueField = Category.FieldNameConstants.CategoryId.ToString(); cboCategory.DataSource = (from x in categoryCollection orderby x.CategoryName select x); cboCategory.DataBind(); } }
public static SupplierCollection GetSupplierData() { SupplierCollection suppliers = new SupplierCollection(); Supplier supplier = new Supplier("Supplier#1"); suppliers.Add(supplier); supplier.Add(CreateProduct(supplier.SupplierID, "Product#1")); supplier.Add(CreateProduct(supplier.SupplierID, "Product#2")); supplier.Add(CreateProduct(supplier.SupplierID, "Product#3")); supplier = new Supplier("Supplier#2"); suppliers.Add(supplier); supplier.Add(CreateProduct(supplier.SupplierID, "Product@1")); supplier.Add(CreateProduct(supplier.SupplierID, "Product@2")); supplier = new Supplier("Supplier#3"); suppliers.Add(supplier); supplier.Add(CreateProduct(supplier.SupplierID, "Product:1")); supplier.Add(CreateProduct(supplier.SupplierID, "Product:2")); supplier.Add(CreateProduct(supplier.SupplierID, "Product:3")); return(suppliers); }
static partial void OnAfterEntityCollectionToDtoCollection(EntityCollection <SupplierEntity> entities, SupplierCollection dtos);
public void _0001_Test() { SupplierCollection suppliers = new SupplierCollection(); suppliers.Add(new SuplierItem(1, "Lomex")); suppliers.Add(new SuplierItem(2, "TME")); suppliers.Add(new SuplierItem(3, "Farnell")); suppliers.Add(new SuplierItem(4, "CBA")); ProductCollection products = new ProductCollection(); products.Add(new ProductItem(1, "1N4148", "Dióda", 1)); products.Add(new ProductItem(2, "BC128", "Tranzisztor", 1)); products.Add(new ProductItem(3, "AT90CAN128", "Processzor", 2)); products.Add(new ProductItem(4, "ESD szönyeg", "ESD Védelem", 2)); //products.Add(new ProductItem(5, "Henkel On", "Forrasztás", 3)); //products.Add(new ProductItem(6, "Weller WP szürő", "Egészség", 3)); //products.Add(new ProductItem(7, "Banán", "Gyümölcs", 2)); /*Data SET*/ DataSet dataSet = new DataSet("DemoDataSet"); /*Suppliers*/ /*SupplierId-PK,SupplierName*/ DataTable suppliersDt = ToDataTable(suppliers, "Suppliers"); suppliersDt.PrimaryKey = new DataColumn[] { suppliersDt.Columns["SupplierId"] }; dataSet.Tables.Add(suppliersDt); /*Products*/ /*ProductId-PK, ProductName, Description, SupplierId*/ DataTable productsDt = ToDataTable(products, "Products"); suppliersDt.PrimaryKey = new DataColumn[] { suppliersDt.Columns["ProductId"] }; DataColumn supplierNameColumn = new DataColumn("SupplierName", typeof(string)); productsDt.Columns.Add(supplierNameColumn); dataSet.Tables.Add(productsDt); /* */ DataColumn parentColumn = dataSet.Tables["Suppliers"].Columns["SupplierId"]; DataColumn childColumn = dataSet.Tables["Products"].Columns["ProductId"]; ForeignKeyConstraint fKConstraint; fKConstraint = new ForeignKeyConstraint("SupplierFKConstraint", parentColumn, childColumn); fKConstraint.DeleteRule = Rule.SetNull; fKConstraint.UpdateRule = Rule.Cascade; fKConstraint.AcceptRejectRule = AcceptRejectRule.Cascade; dataSet.Tables["Products"].Constraints.Add(fKConstraint); dataSet.EnforceConstraints = true; dataSet.AcceptChanges(); var form = new Form2(); form.dataGridView1.DataSource = dataSet; form.dataGridView1.DataMember = "Products"; form.dataGridView2.DataSource = dataSet; form.dataGridView2.DataMember = "Suppliers"; Application.Run(form); }
private async void DeleteHardwareCommandAction(object obj) { await DbHandler.Instance.DeleteSupplier(obj as Supplier); SupplierCollection.Remove(obj as Supplier); }
/// <summary> /// For testing against a specified DataAccessFacade /// </summary> /// <param name="dataAccessFacade"></param> public SupplierController(IDataAccessFacade dataAccessFacade) { this.dataAccessFacade = dataAccessFacade; supplierCollection = new SupplierCollection(dataAccessFacade); }
public SupplierController() { dataAccessFacade = DataAccessFacade.GetInstance(); supplierCollection = new SupplierCollection(dataAccessFacade); }
public SupplierCollection FetchByID(object SupplierID) { SupplierCollection coll = new SupplierCollection().Where("SupplierID", SupplierID).Load(); return coll; }
public SupplierCollection FetchByQuery(Query qry) { SupplierCollection coll = new SupplierCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
public void _0001_Test() { SupplierCollection suppliers = new SupplierCollection(); suppliers.Add(new SuplierItem(1, "Lomex")); suppliers.Add(new SuplierItem(2, "TME")); suppliers.Add(new SuplierItem(3, "Farnell")); suppliers.Add(new SuplierItem(4, "CBA")); ProductCollection products = new ProductCollection(); products.Add(new ProductItem(1, "1N4148", "Dióda", 1)); products.Add(new ProductItem(2, "BC128", "Tranzisztor", 1)); products.Add(new ProductItem(3, "AT90CAN128", "Processzor", 2)); products.Add(new ProductItem(4, "ESD szönyeg", "ESD Védelem", 2)); //products.Add(new ProductItem(5, "Henkel On", "Forrasztás", 3)); //products.Add(new ProductItem(6, "Weller WP szürő", "Egészség", 3)); //products.Add(new ProductItem(7, "Banán", "Gyümölcs", 2)); /*Data SET*/ DataSet dataSet = new DataSet("DemoDataSet"); /*Suppliers*/ /*SupplierId-PK,SupplierName*/ DataTable suppliersDt = ToDataTable(suppliers, "Suppliers"); suppliersDt.PrimaryKey = new DataColumn[] { suppliersDt.Columns["SupplierId"] }; dataSet.Tables.Add(suppliersDt); /*Products*/ /*ProductId-PK, ProductName, Description, SupplierId*/ DataTable productsDt = ToDataTable(products, "Products"); suppliersDt.PrimaryKey = new DataColumn[] { suppliersDt.Columns["ProductId"] }; DataColumn supplierNameColumn = new DataColumn("SupplierName", typeof(string)); productsDt.Columns.Add(supplierNameColumn); dataSet.Tables.Add(productsDt); /* */ DataRelation productsSuppliersRelation = dataSet.Relations.Add("ProductSuppliers", dataSet.Tables["Suppliers"].Columns["SupplierId"], dataSet.Tables["Products"].Columns["SupplierId"], true); dataSet.AcceptChanges(); DataGrid dg = new DataGrid(); dg.SetDataBinding(dataSet, "Products"); var form = new Form2(); form.dataGridView1.DataSource = dataSet; form.dataGridView1.DataMember = "Products"; form.dataGridView2.DataSource = dataSet; form.dataGridView2.DataMember = "Suppliers"; Application.Run(form); }