void ansynWrite_Completed(object sender, Db.WriteUnitsCompletedEventArgs e) { BusinessObjects.OutputCollection col = new BusinessObjects.OutputCollection(); col = e.OutPut; this.dataGridView3.DataSource = col; MessageBox.Show("Done :" + e.OutPut.Count.ToString() + " Units Completed"); }
private void btn_Click(object sender, EventArgs e) { col = new BusinessObjects.OutputCollection(); string filter = tbOptimizerFilter.Text.Trim(); sumOfItems = float.Parse("0.0"); int partID; if (int.TryParse(filter, out partID)) { BusinessObjects.OutputQuery qry = new BusinessObjects.OutputQuery(); qry.Select(qry.CutlistID, qry.Qnty, qry.Length, qry.SourceDescription, qry.PartIdentifier); qry.Where(qry.PartID == partID); col.Load(qry); this.dgOptimizerItems.DataSource = col; } foreach (BusinessObjects.Output o in col) { if (o.Length.HasValue) { sumOfItems += (float)o.Length.Value; } } float totalFeet = sumOfItems / 12.0f; lbSumofParts.Text = totalFeet.ToString() + " ft"; //col = Db.OutParts(); }
private void btnWrite_Click(object sender, EventArgs e) { //if (buildUnits != null && buildUnits.Count > 0) //{ // this.dataGridView3.DataSource = Db.Write(buildUnits); BusinessObjects.OutputCollection colOutParts = new BusinessObjects.OutputCollection(); BusinessObjects.OutputQuery qry = new BusinessObjects.OutputQuery(); colOutParts.LoadAll(); this.dataGridView3.DataSource = colOutParts; col = colOutParts; //} }
/// <summary> /// Outparts /// </summary> /// <returns></returns> public static BusinessObjects.OutputCollection OutParts() { BusinessObjects.OutputCollection result = null; if (esConfigSettings.DefaultConnection.Name == "MSaccess") { result = new BusinessObjects.OutputCollection(); result.LoadAll(); } return(result); }
/// <summary> /// Write Parts /// </summary> /// <param name="units"></param> /// <param name="bworker"></param> /// <returns></returns> public BusinessObjects.OutputCollection WriteParts(List <FrameWorks.AssemblyBase> units, System.ComponentModel.BackgroundWorker bworker) { //BusinessObjects.OutputCollection _outParts = Db.OutParts(); BusinessObjects.OutputCollection _outParts = new BusinessObjects.OutputCollection(); _outParts.MarkAllAsDeleted(); int jobid = ProjectData().JobNumber.Value; int counter = 0; int step = units.Count / 100; foreach (FrameWorks.Unit un in units) { foreach (FrameWorks.SubAssemblyBase sub in un.SubAssemblies) { foreach (FrameWorks.Part prt in sub.Parts) { string ptype = prt.GetType().ToString(); switch (ptype) { // Labor Part case "FrameWorks.LPart": { BusinessObjects.Output newPart = _outParts.AddNew(); //number the parts starting at 1 counter += 1; newPart.PartIdentifier = prt.ContainerAssembly.Parent.UnitID.ToString() + "-" + prt.ContainerAssembly.ID.ToString() + "-" + counter.ToString(); newPart.PartType = prt.PartType; newPart.UnitPrice = prt.LaborAmount; newPart.PartLabel = prt.PartLabel; //newPart.Price = prt.CalculatedCost; //newPart.Qnty = prt.Qnty; newPart.Rate = prt.Rate; newPart.LaborAmount = prt.LaborAmount; //newPart.Markup = prt.MarkUp; newPart.FunctionalName = prt.FunctionalName; newPart.SubAssemblyGUID = prt.ContainerAssembly.Name; newPart.SourceDescription = prt.Source.MaterialDescription; newPart.SourceName = prt.Source.MaterialName; //newPart.Width = prt.PartWidth; //newPart.Length = prt.PartLength; //newPart.Thick = prt.PartThick; newPart.AssemblyID = prt.ContainerAssembly.Parent.UnitID; newPart.AssemblyName = prt.ContainerAssembly.Parent.UnitName; //newPart.PartID = prt.Source.ItemID; //newPart.Tax = Math.Round((prt.CalculatedCost * 0.0875m), 2); //newPart.Weight = Convert.ToDecimal(prt.Weight.ToString()); //newPart.Waste = prt.Waste; //newPart.Area = prt.Area; newPart.AssemblyArea = prt.ContainerAssembly.Parent.Area; newPart.AssemblyDepth = prt.ContainerAssembly.Parent.UnitDepth; newPart.AssemblyWidth = prt.ContainerAssembly.Parent.UnitWidth; newPart.AssemblyHieght = prt.ContainerAssembly.Parent.UnitHeight; newPart.SubAssemblyWidth = prt.ContainerAssembly.SubAssemblyWidth; newPart.SubAssemblyHieght = prt.ContainerAssembly.SubAssemblyHieght; newPart.SubAssemblyDepth = prt.ContainerAssembly.SubAssemblyDepth; newPart.SubAssemblyArea = prt.ContainerAssembly.Area; newPart.JobID = (short)jobid; break; } // Standard Material Part case "FrameWorks.Part": { BusinessObjects.Output newPart = _outParts.AddNew(); //number the parts starting at 1 counter += 1; newPart.PartIdentifier = prt.ContainerAssembly.Parent.UnitID.ToString() + "-" + prt.ContainerAssembly.ID.ToString() + "-" + counter.ToString(); newPart.PartType = prt.PartType; newPart.UnitPrice = prt.UnitPrice; newPart.PartLabel = prt.PartLabel; newPart.Price = prt.CalculatedCost; newPart.Qnty = prt.Qnty; newPart.Rate = prt.Rate; newPart.Markup = prt.MarkUp; newPart.FunctionalName = prt.FunctionalName; newPart.SubAssemblyGUID = prt.ContainerAssembly.Name; newPart.SourceDescription = prt.Source.MaterialDescription; newPart.SourceName = prt.Source.MaterialName; newPart.Width = prt.PartWidth; newPart.Length = prt.PartLength; newPart.Thick = prt.PartThick; newPart.AssemblyID = prt.ContainerAssembly.Parent.UnitID; newPart.AssemblyName = prt.ContainerAssembly.Parent.UnitName; newPart.PartID = prt.Source.ItemID; newPart.Tax = Math.Round((prt.CalculatedCost * 0.0875m), 2); newPart.Weight = Convert.ToDecimal(prt.Weight.ToString()); newPart.Waste = prt.Waste; newPart.Area = prt.Area; newPart.AssemblyArea = prt.ContainerAssembly.Parent.Area; newPart.AssemblyDepth = prt.ContainerAssembly.Parent.UnitDepth; newPart.AssemblyWidth = prt.ContainerAssembly.Parent.UnitWidth; newPart.AssemblyHieght = prt.ContainerAssembly.Parent.UnitHeight; newPart.SubAssemblyWidth = prt.ContainerAssembly.SubAssemblyWidth; newPart.SubAssemblyHieght = prt.ContainerAssembly.SubAssemblyHieght; newPart.SubAssemblyDepth = prt.ContainerAssembly.SubAssemblyDepth; newPart.SubAssemblyArea = prt.ContainerAssembly.Area; newPart.Uom = Convert.ToInt16(prt.UOM.ToString()); newPart.JobID = (short)jobid; break; } default: break; } // } } bworker.ReportProgress(counter += step); } _outParts.Save(); return(_outParts); }
public WriteUnitsCompletedEventArgs(BusinessObjects.OutputCollection OutPut) { this.output = OutPut; }
protected override void DoTask() { //BusinessObjects.OutputCollection _outParts = Db.OutParts(); BusinessObjects.OutputCollection _outParts = new BusinessObjects.OutputCollection(); _outParts.MarkAllAsDeleted(); int counter = 0; foreach (FrameWorks.Unit un in _units) { foreach (FrameWorks.SubAssemblyBase sub in un.SubAssemblies) { foreach (FrameWorks.Part prt in sub.Parts) { string ptype = prt.GetType().ToString(); switch (ptype) { // Labor Part case "FrameWorks.LPart": { BusinessObjects.Output newPart = _outParts.AddNew(); //number the parts starting at 1 counter += 1; newPart.PartIdentifier = prt.ContainerAssembly.Parent.UnitID.ToString() + "-" + prt.ContainerAssembly.ID.ToString() + "-" + counter.ToString(); newPart.PartType = prt.PartType; //newPart.UnitPrice = prt.UnitPrice; newPart.PartLabel = prt.PartLabel; //newPart.Price = prt.CalculatedCost; //newPart.Qnty = prt.Qnty; newPart.Rate = prt.Rate; newPart.LaborAmount = prt.LaborAmount; //newPart.Markup = prt.MarkUp; newPart.FunctionalName = prt.FunctionalName; newPart.SubAssemblyGUID = prt.ContainerAssembly.Name; newPart.SourceDescription = prt.Source.MaterialDescription; newPart.SourceName = prt.Source.MaterialName; //newPart.Width = prt.PartWidth; //newPart.Length = prt.PartLength; //newPart.Thick = prt.PartThick; newPart.AssemblyID = prt.ContainerAssembly.Parent.UnitID; newPart.AssemblyName = prt.ContainerAssembly.Parent.UnitName; //newPart.PartID = prt.Source.ItemID; //newPart.Tax = Math.Round((prt.CalculatedCost * 0.0875m), 2); //newPart.Weight = Convert.ToDecimal(prt.Weight.ToString()); //newPart.Waste = prt.Waste; //newPart.Area = prt.Area; newPart.AssemblyArea = prt.ContainerAssembly.Parent.Area; newPart.AssemblyDepth = prt.ContainerAssembly.Parent.UnitDepth; newPart.AssemblyWidth = prt.ContainerAssembly.Parent.UnitWidth; newPart.AssemblyHieght = prt.ContainerAssembly.Parent.UnitHeight; newPart.SubAssemblyWidth = prt.ContainerAssembly.SubAssemblyWidth; newPart.SubAssemblyHieght = prt.ContainerAssembly.SubAssemblyHieght; newPart.SubAssemblyDepth = prt.ContainerAssembly.SubAssemblyDepth; newPart.SubAssemblyArea = prt.ContainerAssembly.Area; break; } // Standard Material Part case "FrameWorks.Part": { BusinessObjects.Output newPart = _outParts.AddNew(); //number the parts starting at 1 counter += 1; newPart.PartIdentifier = prt.ContainerAssembly.Parent.UnitID.ToString() + "-" + prt.ContainerAssembly.ID.ToString() + "-" + counter.ToString(); newPart.PartType = prt.PartType; newPart.UnitPrice = prt.UnitPrice; newPart.PartLabel = prt.PartLabel; newPart.Price = prt.CalculatedCost; newPart.Qnty = prt.Qnty; newPart.Rate = prt.Rate; newPart.Markup = prt.MarkUp; newPart.FunctionalName = prt.FunctionalName; newPart.SubAssemblyGUID = prt.ContainerAssembly.Name; newPart.SourceDescription = prt.Source.MaterialDescription; newPart.SourceName = prt.Source.MaterialName; newPart.Width = prt.PartWidth; newPart.Length = prt.PartLength; newPart.Thick = prt.PartThick; newPart.AssemblyID = prt.ContainerAssembly.Parent.UnitID; newPart.AssemblyName = prt.ContainerAssembly.Parent.UnitName; newPart.PartID = prt.Source.ItemID; newPart.Tax = Math.Round((prt.CalculatedCost * 0.0875m), 2); newPart.Weight = Convert.ToDecimal(prt.Weight.ToString()); newPart.Waste = prt.Waste; newPart.Area = prt.Area; newPart.AssemblyArea = prt.ContainerAssembly.Parent.Area; newPart.AssemblyDepth = prt.ContainerAssembly.Parent.UnitDepth; newPart.AssemblyWidth = prt.ContainerAssembly.Parent.UnitWidth; newPart.AssemblyHieght = prt.ContainerAssembly.Parent.UnitHeight; newPart.SubAssemblyWidth = prt.ContainerAssembly.SubAssemblyWidth; newPart.SubAssemblyHieght = prt.ContainerAssembly.SubAssemblyHieght; newPart.SubAssemblyDepth = prt.ContainerAssembly.SubAssemblyDepth; newPart.SubAssemblyArea = prt.ContainerAssembly.Area; newPart.Uom = Convert.ToInt16(prt.UOM.ToString()); break; } default: break; } // } } } _outParts.Save(); unitCollection = _outParts; }