Esempio n. 1
0
		void initializeDataServices()
		{
			_uow = new Dal.SoheilEdmContext();
			_productGroupDs = new DataServices.ProductGroupDataService(_uow);
			_fpcDs = new DataServices.FPCDataService(_uow);
			_jobDs = new DataServices.JobDataService(_uow);
		}
Esempio n. 2
0
		/// <summary>
		/// Resets all information about this PlanEditor and reloads products
		/// </summary>
		public void Reset()
		{
			SelectedBlock = null;
			SelectedProduct = null;
			BlockList.Clear();

			//initializeDataServices
			var _productGroupDs = new DataServices.ProductGroupDataService(null);

			ProductGroups.Clear();
			var pgList = new DataServices.ProductGroupDataService(null).GetActives();
			foreach (var pg in pgList)
			{
				ProductGroups.Add(new ProductGroupVm(pg));
			}

			initializeCommands();
		}
Esempio n. 3
0
		public void Reload()
		{
			var pgModelList = new DataServices.ProductGroupDataService(null).GetActivesRecursive(Id);

			#region Reload Sync
			int col = 0;
			int row = 0;
			foreach (var pgModel in pgModelList)
			{
				if (!pgModel.Products.Any()) continue;

				//Add ProductGroup To ColumnHeaders
				var cpg = new ProductGroup(pgModel, this, isRowHeader: false);
				cpg.RowIndex = 0;
				cpg.ColumnIndex = col++;//pg itself is a column
				ColumnHeaders.Add(cpg);
				ColumnPGList.Add(cpg);
				foreach (var p in cpg.Products)
				{
					foreach (var r in p.Reworks)
					{
						//Add Rework To ColumnHeaders
						r.RowIndex = 0;
						r.ColumnIndex = col;
						ColumnHeaders.Add(r);
						//...
						col++;
					}
				}

				//Add ProductGroup To RowHeaders
				var rpg = new ProductGroup(pgModel, this, isRowHeader: true);
				rpg.RowIndex = row++;//pg itself is a row
				rpg.ColumnIndex = 0;
				RowHeaders.Add(rpg);
				RowPGList.Add(rpg);
				foreach (var p in rpg.Products)
				{
					foreach (var r in p.Reworks)
					{
						//Add Rework to RowHeaders
						r.RowIndex = row;
						r.ColumnIndex = 0;
						RowHeaders.Add(r);
						//Add Checkbox
						r.Checkbox.RowIndex = row;
						r.Checkbox.ColumnIndex = 1;
						RowHeaders.Add(r.Checkbox);
						//Add Warmup
						r.Warmup.RowIndex = row;
						r.Warmup.ColumnIndex = 2;
						RowHeaders.Add(r.Warmup);

						//...
						row++;
					}
				}
			}

			//				*********
			//use of Context in a non DataService class
			//This is to speed up the reading of changeovers
			//				*********
			using (var context = new Dal.SoheilEdmContext())
			{
				//Add ChangeoverCells
				foreach (var rpg in RowPGList)
				{
					foreach (var cpg in ColumnPGList)
					{
						ChangeoverCells.Add(Cell.Blank(rpg, cpg));
						foreach (var cp in cpg.Products)
							foreach (var cr in cp.Reworks)
								ChangeoverCells.Add(Cell.Blank(rpg, cr, columnColor: cp.Color));
					}
					foreach (var rp in rpg.Products)
						foreach (var rr in rp.Reworks)
							foreach (var cpg in ColumnPGList)
							{
								ChangeoverCells.Add(Cell.Blank(rr, cpg, rowColor: rr.Product.Color));
								foreach (var cp in cpg.Products)
									foreach (var cr in cp.Reworks)
										if (cr.IsValid)
											ChangeoverCells.Add(new ChangeoverCell(rr, cr, this.Id, context));
										else
											ChangeoverCells.Add(Cell.Blank(rr, cr, rowColor: rr.Product.Color, columnColor: cr.Product.Color));
							}
				}
			}
			//				*********
			TotalVisualColumns = col;
			TotalVisualRows = row;
			#endregion
		}