private void Start() { cursorHandler = FindObjectOfType <CursorHandler>(); workingArea = FindObjectOfType <WorkingArea>(); boxOut = FindObjectOfType <BoxOut>(); canvas = FindObjectOfType <Canvas>(); }
public bool IsRectangle(WorkingArea area, out float width, out float height) { if (area.Vertexes.Count == 4) { //Might be a square(true), rectangle (true), parallelogram(FALSE) if ((Math.Abs(area.Vertexes[0].X - area.Vertexes[1].X) < 0.01f && Math.Abs(area.Vertexes[2].X - area.Vertexes[3].X) < 0.01f && Math.Abs(area.Vertexes[0].Y - area.Vertexes[3].Y) < 0.01f && Math.Abs(area.Vertexes[1].Y - area.Vertexes[2].Y) < 0.01f) || (Math.Abs(area.Vertexes[0].Y - area.Vertexes[1].Y) < 0.01f && Math.Abs(area.Vertexes[2].Y - area.Vertexes[3].Y) < 0.01f && Math.Abs(area.Vertexes[0].X - area.Vertexes[3].X) < 0.01f && Math.Abs(area.Vertexes[1].X - area.Vertexes[2].X) < 0.01f)) { GetRectangle(area.Vertexes, out width, out height); return(true); } } width = -1; height = -1; return(false); }
private void AddNewWorkingAreaSymbol() { WorkingArea newWorkingArea = new WorkingArea(); newWorkingArea.Id = "#ADDNEWWORKINGAREA"; newWorkingArea.Name = "ADDNEWWORKINGAREA"; newWorkingArea.Description = "ADDNEWWORKINGAREA"; newWorkingArea.Vertexes.Add(new Point(40, 10)); newWorkingArea.Vertexes.Add(new Point(60, 10)); newWorkingArea.Vertexes.Add(new Point(60, 40)); newWorkingArea.Vertexes.Add(new Point(90, 40)); newWorkingArea.Vertexes.Add(new Point(90, 60)); newWorkingArea.Vertexes.Add(new Point(60, 60)); newWorkingArea.Vertexes.Add(new Point(60, 90)); newWorkingArea.Vertexes.Add(new Point(40, 90)); newWorkingArea.Vertexes.Add(new Point(40, 60)); newWorkingArea.Vertexes.Add(new Point(10, 60)); newWorkingArea.Vertexes.Add(new Point(10, 40)); newWorkingArea.Vertexes.Add(new Point(40, 40)); AddWorkingAreaToList(newWorkingArea); }
private void CloneOnClick(object sender, EventArgs eventArgs) { if (lstExistingWorkingAreas.SelectedItems.Count == 0) { return; } ListViewItem listviewItem = lstExistingWorkingAreas.SelectedItems[0]; WorkingArea workingArea = (WorkingArea)listviewItem.Tag; //WorkingArea to be cloned! if (DialogResult.Yes == MessageBox.Show("Are you really sure you want to clone this workingArea?", "Clone workingArea?", MessageBoxButtons.YesNo)) { lstExistingWorkingAreas.SelectedItems.Clear(); lstExistingWorkingAreas.Items.Remove(listviewItem); WorkingArea clone = workingArea.Clone(); clone.Id = null; clone.Name = workingArea.Name + "_CLONE"; workingAreasPersistence.AddOrUpdate(clone.Id, clone); ListWorkingAreas(); } }
public int Delete(int id) { WorkingArea workingAreaToDelete = context.WorkingAreas.SingleOrDefault(a => a.Id == id); context.WorkingAreas.Remove(workingAreaToDelete); return(context.SaveChanges()); }
public static Dictionary <Minutia, Tuple <int[, , ], int[, , ]> > MCCMethod(List <Minutia> minutiae, int rows, int columns) { integralValues.Clear(); response.Clear(); neighbourMinutiae.Clear(); List <Minutia> allNeighbours; deltaS = 2 * Constants.R / Constants.Ns; deltaD = 2 * Math.PI / Constants.Nd; MakeTableOfIntegrals(); workingArea = WorkingArea.BuildWorkingArea(minutiae, Constants.R, rows, columns); for (int index = 0; index < minutiae.Count; index++) { value = new int[Constants.Ns, Constants.Ns, Constants.Nd]; mask = new int[Constants.Ns, Constants.Ns, Constants.Nd]; allNeighbours = new List <Minutia>(); for (int i = 0; i < Constants.Ns; i++) { for (int j = 0; j < Constants.Ns; j++) { int maskValue = CalculateMaskValue(minutiae[index], i, j, rows, columns); for (int k = 0; k < Constants.Nd; k++) { currentСoordinate = GetCoordinatesInFingerprint(minutiae[index], i, j); if (currentСoordinate.Item1 < 0 || currentСoordinate.Item1 >= rows || currentСoordinate.Item2 < 0 || currentСoordinate.Item2 >= columns) { value[i, j, k] = 0; mask[i, j, k] = 0; continue; } mask[i, j, k] = maskValue; neighbourMinutiae = GetNeighbourMinutiae(minutiae, minutiae[index], currentСoordinate); allNeighbours.AddRange(neighbourMinutiae); allNeighbours = MinutiaListDistinct(allNeighbours); value[i, j, k] = Psi(GetValue(minutiae[index], k)); } } } if (allNeighbours.Count < Constants.MinM && !IsValidMask()) { continue; } response.Add(minutiae[index], new Tuple <int[, , ], int[, , ]>(value, mask)); } return(response); }
public SimpleDraw() { InitializeComponent(); this.Size = new Size((int)(0.65 * Screen.PrimaryScreen.WorkingArea.Width), (int)(0.85 * Screen.PrimaryScreen.WorkingArea.Height)); workingArea = new WorkingArea(new Bitmap(pictureBox.Width, pictureBox.Height), pictureBox); workingArea.RepaintBitmap(); }
public int Update(WorkingArea workingArea) { WorkingArea workingAreaToUpdate = context.WorkingAreas.SingleOrDefault(a => a.Id == workingArea.Id); workingAreaToUpdate.Area = workingArea.Area; workingAreaToUpdate.City = workingArea.City; return(context.SaveChanges()); }
public GameObject CreateWorkingArea(Tribe tribe, float seconds) { GameObject obj = Instantiate(GameSession.GrabGameplayManagerReference().workingAreaPrefab) as GameObject; WorkingArea workingArea = obj.GetComponent <WorkingArea>(); obj.transform.parent = transform; obj.transform.position = transform.position + Vector3.up * GameConstants.WORKING_AREA_GROUND_Y; workingArea.SetCountTimeAndColor(tribe.Count, seconds, tribe.m_unitColour); return(obj); }
private static ClassificationResult ClassifyGeneric( INestingManager manager, List <Part> parts, WorkingArea workingArea) { float areaX, areaY; if (!manager.IsRectangle(workingArea, out areaX, out areaY)) { throw new Exception("WorkingArea is not a rectangle!"); } float boxX, boxY; manager.GetRectangleBoxOfParts(parts, out boxX, out boxY); if (boxX > areaX || boxY > areaY) { throw new Exception("Part does not fit inside Working area!"); } //Calculate how many boxes could be fit in the area int horizontalBoxes = (int)(areaX / boxX); int verticalBoxes = (int)(areaY / boxY); //We build the final result using the partial results and the calculated positions of the boxes ClassificationResult result = new ClassificationResult(ClassifierInformation) { WorkingArea = workingArea.Clone() }; int partIndex = 0; //Place parts until we run out of space for (int i = 0; i < horizontalBoxes; i++) { for (int j = 0; j < verticalBoxes; j++) { Point subResultOrigin = new Point(i * boxX, j * boxY); result.ExtraPolygons.Add(manager.CalculateRectangle(boxX, boxY, subResultOrigin)); Part placedPart = parts[partIndex % parts.Count].Clone(); placedPart.Place(subResultOrigin); result.Parts.Add(placedPart); partIndex++; } } return(result); }
private void AddWorkingAreaToList(WorkingArea workingArea) { Image bitmap = drawingService.DrawThumbnail(workingArea, 100); lstExistingWorkingAreas.LargeImageList.Images.Add(workingArea.Id, bitmap); ListViewItem item = new ListViewItem(workingArea.Name); item.ImageKey = workingArea.Id; item.Tag = workingArea; lstExistingWorkingAreas.Items.Add(item); }
public static string ToString(this WorkingArea wa) { switch (wa) { case WorkingArea.LivingRoom: return("Living Room"); case WorkingArea.Bedrooms: return("Bedrooms"); case WorkingArea.Kitchen: return("Kitchen"); case WorkingArea.SelfService: return("Self Service"); case WorkingArea.Lighting: return("Lighting"); case WorkingArea.TextileRugs: return("Textiles & Rugs"); case WorkingArea.CookingEating: return("Cooking & Eating"); case WorkingArea.IKEAFoodRestaurant: return("IKEA Food Restaurant"); case WorkingArea.LogisticsCommon: return("Logistics Common(TS)"); case WorkingArea.StockControl: return("Stock Control"); case WorkingArea.GoodsReceiving: return("Goods Receiving"); case WorkingArea.GoodsReplenishment: return("Goods Replenishment"); case WorkingArea.FullServe: return("Full Serve"); case WorkingArea.ComIn: return("Com & In"); case WorkingArea.Family: return("Family"); case WorkingArea.CustomerService: return("Customer Service"); case WorkingArea.CSEntrance: return("CS Entrance"); case WorkingArea.CSTrolleyHandling: return("CS Trolley Handling"); case WorkingArea.CashAdministration: return("Cash Administration"); case WorkingArea.Recovery: return("Recovery"); case WorkingArea.BuildingProjects: return("Building Projects"); default: throw new ArgumentException("Unknown enum of type: WorkingArea."); } }
public WorkingArea CalculateWorkingArea(float width, float height) { WorkingArea result = new WorkingArea() { Vertexes = new List <Point>() { new Point(0, 0), new Point(width, 0), new Point(width, height), new Point(0, height) }, }; return(result); }
public ActionResult CreateMama(ViewMama vMama) { if (ModelState.IsValid) { EmployeeLogin login = new EmployeeLogin(); login.Username = vMama.Username; login.Password = vMama.Password; login.EmployeeType = "Mama"; WorkingArea area = new WorkingArea(); area.AreaId = vMama.WorkingArea; area.CityId = vMama.WorkingCity; Department dept = new Department(); dept.Id = vMama.DepartmentName; EmployeeApproval approval = new EmployeeApproval(); Mama mama = new Mama(); mama.FirstName = vMama.FirstName; mama.LastName = vMama.LastName; mama.Email = vMama.Email; mama.Phone = vMama.Phone; mama.JobType = vMama.JobType; mama.JoiningDate = vMama.JoiningDate.ToShortDateString(); mama.DateOfBirth = vMama.DateOfBirth.ToShortDateString(); mama.Department = dept; mama.Gender = vMama.Gender; mama.HouseNo = vMama.HouseNo; mama.RoadNo = vMama.RoadNo; mama.Salary = vMama.Salary; mama.LoginData = login; mama.DeliveryArea = area; mama.Approval = approval; mama.Area = areaRepo.Get(vMama.AreaName); mama.City = cityRepo.Get(vMama.CityName); mamaRepo.Insert(mama); return(RedirectToAction("LoadAdmin", "Employee", new { id = (int)Session["AID"] })); } else { return(View(vMama)); } }
private void AggiungiInADL(List <string> listIdDocToAdd) { try { List <WorkingArea> listWorkingArea = new List <WorkingArea>(); WorkingArea objectArea = null; string idDocumentoPrincipale = string.Empty; InfoDocumento infoDocPrincipale; foreach (string id in listIdDocToAdd) { ElementoInLibroFirma elemento = (from e in this.ListaElementiFiltrati where e.InfoDocumento.Docnumber.Equals(id) select e).FirstOrDefault(); if (elemento != null) { objectArea = new WorkingArea(); objectArea.ObjectType = AreaLavoroTipoOggetto.DOCUMENTO; if (!string.IsNullOrEmpty(elemento.InfoDocumento.IdDocumentoPrincipale) && !ListIdDocumentSigned.Contains(elemento.InfoDocumento.IdDocumentoPrincipale)) { idDocumentoPrincipale = elemento.InfoDocumento.IdDocumentoPrincipale; infoDocPrincipale = UIManager.DocumentManager.GetInfoDocumento(idDocumentoPrincipale, idDocumentoPrincipale, this); objectArea.IdObject = idDocumentoPrincipale; objectArea.TipoDocumento = infoDocPrincipale.tipoProto; objectArea.IdRegistro = infoDocPrincipale.idRegistro; objectArea.Motivo = Utils.Languages.GetLabelFromCode("SignatureSelectedItemAreaMotivoAllegato", UIManager.UserManager.GetUserLanguage()); } else { objectArea.IdObject = elemento.InfoDocumento.Docnumber; objectArea.TipoDocumento = elemento.InfoDocumento.TipoProto; objectArea.IdRegistro = elemento.InfoDocumento.IdRegistro; objectArea.Motivo = Utils.Languages.GetLabelFromCode("SignatureSelectedItemAreaMotivo", UIManager.UserManager.GetUserLanguage()); } listWorkingArea.Add(objectArea); } } if (listWorkingArea != null && listWorkingArea.Count > 0) { UIManager.DocumentManager.AddMassiveObjectInADL(listWorkingArea); } } catch (Exception e) { } }
private void btnRun_Click(object sender, EventArgs e) { this.results = new List <ClassificationResult>(); //Extraemos el area de trabajo ListViewItem selectedItem = lstExistingWorkingAreas.CheckedItems[0]; WorkingArea area = (WorkingArea)selectedItem.Tag; List <Part> parts = new List <Part>(); foreach (ListViewItem item in lstExistingParts.CheckedItems) { Part part = ((Part)item.Tag).Clone(); part.NormalizeVertexes(); parts.Add(part); } List <ClassifierWrapper> classifiers = new List <ClassifierWrapper>(); foreach (ListViewItem item in lstClassifiers.CheckedItems) { INestingClassifierFactory factory = (INestingClassifierFactory)item.Tag; INestingClassifier classifier = factory.Create(); classifier.SetNestingManager(new NestingManager()); classifier.SetClassificationParameters(new ClassificationParameters(area, parts)); classifiers.Add(new ClassifierWrapper(classifier)); } currentlyRunningClassifiers = classifiers.Count; btnRun.Enabled = false; btnRun.Text = $"{currentlyRunningClassifiers} classifiers running"; foreach (ClassifierWrapper wrapper in classifiers) { wrapper.ClassifyAllCompleted += ReceiveResult; wrapper.ClassifyAllAsync(); } PaintResults(); }
private static List <WorkingArea> CalculateRemainderWorkingAreas( INestingManager nestingManager, float tesselationPolygonWidth, float tesselationPolygonHeight, int horizontalBoxes, int verticalBoxes, float workingAreaWidth, float workingAreaHeight) { List <WorkingArea> result = new List <WorkingArea>(); float width1 = tesselationPolygonWidth * horizontalBoxes; float height1 = workingAreaHeight - tesselationPolygonHeight * verticalBoxes; float width2 = workingAreaWidth - tesselationPolygonWidth * horizontalBoxes; float height2 = height1; float width3 = width2; float height3 = tesselationPolygonHeight * verticalBoxes; if (height1 > 0) { WorkingArea area = nestingManager.CalculateWorkingArea(width1, height1); area.Placement = new Point(0, tesselationPolygonHeight * verticalBoxes); result.Add(area); } if (height2 > 0 && width2 > 0) { WorkingArea area = nestingManager.CalculateWorkingArea(width2, height2); area.Placement = new Point(tesselationPolygonWidth * horizontalBoxes, tesselationPolygonHeight * verticalBoxes); result.Add(area); } if (width3 > 0) { WorkingArea area = nestingManager.CalculateWorkingArea(width3, height3); area.Placement = new Point(tesselationPolygonWidth * horizontalBoxes, 0); result.Add(area); } return(result); }
private void btnOK_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show("Are you really sure you want to save this workingArea?", "Save changes?", MessageBoxButtons.YesNo)) { WorkingArea newWorkingArea = new WorkingArea(); newWorkingArea.Id = txtId.Text; newWorkingArea.Name = txtName.Text; newWorkingArea.Description = txtDescription.Text; foreach (ListViewItem item in lstWorkingAreaVertexes.Items) { newWorkingArea.Vertexes.Add((Point)item.Tag); } workingAreasPersistence.AddOrUpdate(newWorkingArea.Id, newWorkingArea); ListWorkingAreas(); } }
public ClassificationParameters(WorkingArea workingArea, List <Part> parts) { if (workingArea == null) { throw new Exception("Error creating ClassificationParameters: WorkingArea is null!"); } if (workingArea.Vertexes.Count < 3) { throw new Exception("Error creating ClassificationParameters: WorkingArea has a wrong number of vertexes!"); } if (parts == null || parts.Count == 0) { throw new Exception("Error creating ClassificationParameters: Parts list is null or empty!"); } //We check if parts can't fit in the working area (too big) this.WorkingArea = workingArea.Clone(); this.WorkingArea.Parts.Clear(); double available = workingArea.GetTotalArea(); this.Parts = new List <Part>(); foreach (Part part in parts) { Part clone = (Part)part.Clone(); clone.UnPlace(); if (clone.Vertexes.Count < 3) { throw new Exception("Error creating ClassificationParameters: Part has a wrong number of vertexes!"); } available = available - clone.GetTotalArea(); Parts.Add(clone); } }
public async Task <string> CreateAsyncWorkingArea(string areaId, string userId) { var workingArea = this.workingAreaRepository.All().Where(x => x.UserId == userId).FirstOrDefault(); if (workingArea == null) { workingArea = new WorkingArea { AreaId = areaId, UserId = userId, ActiveWorkingArea = ActiveWorkingArea.No, }; await this.workingAreaRepository.AddAsync(workingArea); } await this.workingAreaRepository.SaveChangesAsync(); return(workingArea.Id); }
private void DeleteOnClick(object sender, EventArgs e) { if (lstExistingWorkingAreas.SelectedItems.Count == 0) { return; } ListViewItem listviewItem = lstExistingWorkingAreas.SelectedItems[0]; WorkingArea workingArea = (WorkingArea)listviewItem.Tag; //WorkingArea to be deleted! if (DialogResult.Yes == MessageBox.Show("Are you really sure you want to delete this workingArea?", "Delete workingArea?", MessageBoxButtons.YesNo)) { lstExistingWorkingAreas.SelectedItems.Clear(); lstExistingWorkingAreas.Items.Remove(listviewItem); workingAreasPersistence.Delete <WorkingArea>(workingArea.Id); } }
private void AddLoadingSymbol() { WorkingArea loading = new WorkingArea(); loading.Id = "LOADING"; loading.Name = "LOADING"; loading.Description = "LOADING"; loading.Vertexes.Add(new Point(30, 10)); loading.Vertexes.Add(new Point(70, 10)); loading.Vertexes.Add(new Point(30, 90)); loading.Vertexes.Add(new Point(70, 90)); Image bitmap = drawingService.DrawThumbnail(loading, 100); lstExistingWorkingAreas.LargeImageList.Images.Add(loading.Id, bitmap); ListViewItem item = new ListViewItem(loading.Name); item.ImageKey = loading.Id; lstExistingWorkingAreas.Items.Add(item); }
private void LstWorkingAreasItemSelected(object sender, ListViewItemSelectionChangedEventArgs e) { lstWorkingAreaVertexes.Items.Clear(); lstWorkingAreaVertexes.ContextMenu = new ContextMenu(vertexMenus.ToArray()); WorkingArea workingArea = e.Item.Tag as WorkingArea; if (workingArea != null && workingArea.Id == "#ADDNEWWORKINGAREA") { workingArea = null; } bool selected = e.IsSelected && workingArea != null; if (selected) { txtId.Text = workingArea.Id; txtName.Text = workingArea.Name; txtDescription.Text = workingArea.Description; foreach (Point point in workingArea.Vertexes) { AddVertex(point); } DrawSchematic(); } else { imgWorkingArea.Image = null; txtId.Text = ""; txtName.Text = ""; txtDescription.Text = ""; } }
private static void ClassifySinglePart(INestingManager nestingManager, Part part, WorkingArea workingArea, List <ClassificationResult> results) { Point point = Point.Origin; part.Place(Point.Origin); float areaWidth, areaHeight; if (!nestingManager.IsRectangle(workingArea, out areaWidth, out areaHeight)) { throw new InvalidOperationException("Area is not a rectangle"); } foreach (KeyValuePair <Point, Point> edge in part.ConvexHullEdges()) { Part mirror = part.CalculateMirror(edge.Key, edge.Value); Part clone = part.Clone(); mirror.Place(point); clone.Place(point); Part hull = new Part(); foreach (var side in new Part[] { mirror, clone }) { if (side.InnerParts.Any()) { hull.InnerParts.AddRange(side.InnerParts.Select(x => x.Clone())); } else { hull.InnerParts.Add(side); } } hull.FitToOrigin(); float hullWidth, hullHeight; nestingManager.GetRectangleBoxOfPart(hull, out hullWidth, out hullHeight); //Is the hull too big for the area? if (!(hullWidth <= areaWidth) || !(hullHeight <= areaHeight)) { continue; } ClassificationResult result = new ClassificationResult(ClassifierInformation) { Parts = hull.InnerParts, WorkingArea = workingArea }; //The result was already found? if (results.Contains(result)) { //Ignore result continue; } //If it fits, we store the part and continue operating over it. results.Add(result); ClassifySinglePart(nestingManager, hull, workingArea, results); } }
/// <summary> /// <para> /// Retrieves a string representing this object. /// </para> /// </summary> public override string ToString() { return(GetType().Name + "[Bounds=" + bounds.ToString() + " WorkingArea=" + WorkingArea.ToString() + " Primary=" + primary.ToString() + " DeviceName=" + deviceName); }
private void Start() { envelopesToProceed = gameState.CurrentDayLetters.Length; workingArea = FindObjectOfType <WorkingArea>(); }
public static ClassificationResult GetMainResult( INestingManager nestingManager, List <Part> originalParts, WorkingArea workingArea) { float areaX, areaY; if (!nestingManager.IsRectangle(workingArea, out areaX, out areaY)) { throw new Exception("WorkingArea is not a rectangle!"); } //Step 1: Remove parts that do not fit the working area float boxX; float boxY; List <Part> parts = new List <Part>(); foreach (Part part in originalParts) { nestingManager.GetRectangleBoxOfPart(part, out boxX, out boxY); if (areaX >= boxX && areaY >= boxY) { //Part does not fit the working area parts.Add(part); } } //Step 2: Break if no parts fit the working area if (!parts.Any()) { //Empty result return(new ClassificationResult(ClassifierInformation) { WorkingArea = workingArea }); } //Step 2.5: Sort parts by Area size in descending order, so we favor the placement of bigger pieces //in case there are not enough polygons to place all the parts, because the smaller parts could be fit in the remainders parts = parts.OrderByDescending(x => x.GetTotalArea()).ToList(); //Step 3: Calculate the tesselation polygon nestingManager.GetRectangleBoxOfParts(parts, out boxX, out boxY); int horizontalBoxes = (int)(areaX / boxX); int verticalBoxes = (int)(areaY / boxY); WorkingArea tesselationPolygon = new WorkingArea() { Vertexes = new List <Point>() { new Point(0, 0), new Point(boxX, 0), new Point(boxX, boxY), new Point(0, boxY) } }; ClassificationResult result = new ClassificationResult(ClassifierInformation); //Step 4: Calculate the remainder polygons List <WorkingArea> remainderPolygons = CalculateRemainderWorkingAreas( nestingManager, boxX, boxY, horizontalBoxes, verticalBoxes, areaX, areaY); //Step 5: Generate the reimainder polygons' problems foreach (WorkingArea remainderPolygon in remainderPolygons) { ClassificationResult subResult = GetMainResult(nestingManager, parts, remainderPolygon); if (!nestingManager.IsRectangle(remainderPolygon, out areaX, out areaY)) { throw new Exception("WorkingArea is not a rectangle!"); } result.ExtraPolygons.Add(nestingManager.CalculateRectangle(areaX, areaY, remainderPolygon.Placement)); result.AddSubResult(subResult, remainderPolygon.Placement); } //Step6: Generate tesselation poligons' subproblem List <ClassificationResult> subresults = new List <ClassificationResult>(); foreach (Part part in parts) { ClassificationResult res = GetDirectedResult(nestingManager, part, tesselationPolygon, parts); if (res != null) { subresults.Add(res); } } result.WorkingArea = workingArea.Clone(); int numberOfParts = parts.Count; int partIndex = 0; //Place parts until we run out of space for (int i = 0; i < horizontalBoxes; i++) { for (int j = 0; j < verticalBoxes; j++) { ClassificationResult subResult = subresults[partIndex % numberOfParts]; Point subResultOrigin = new Point(i * boxX, j * boxY); result.AddSubResult(subResult, subResultOrigin); partIndex++; } } return(result); }
public int Insert(WorkingArea workingArea) { context.WorkingAreas.Add(workingArea); return(context.SaveChanges()); }
private static Expression <Func <TestingPersonnel, bool> > GetFilterByWorkingAreaAndDayOfWeek(WorkingArea workingArea, DayOfWeek dayOfWeek) { switch (dayOfWeek) { case DayOfWeek.Monday: return(x => x.TestingPersonnelWorkingAreas.Any(wa => wa.Area == workingArea) && (x.Type == TestingPersonnelType.Normal || (x.Type == TestingPersonnelType.Fixed && x.MondayShift == Shift.None))); case DayOfWeek.Tuesday: return(x => x.TestingPersonnelWorkingAreas.Any(wa => wa.Area == workingArea) && (x.Type == TestingPersonnelType.Normal || (x.Type == TestingPersonnelType.Fixed && x.TuesdayShift == Shift.None))); case DayOfWeek.Wednesday: return(x => x.TestingPersonnelWorkingAreas.Any(wa => wa.Area == workingArea) && (x.Type == TestingPersonnelType.Normal || (x.Type == TestingPersonnelType.Fixed && x.WednesdayShift == Shift.None))); case DayOfWeek.Thursday: return(x => x.TestingPersonnelWorkingAreas.Any(wa => wa.Area == workingArea) && (x.Type == TestingPersonnelType.Normal || (x.Type == TestingPersonnelType.Fixed && x.ThursdayShift == Shift.None))); case DayOfWeek.Friday: return(x => x.TestingPersonnelWorkingAreas.Any(wa => wa.Area == workingArea) && (x.Type == TestingPersonnelType.Normal || (x.Type == TestingPersonnelType.Fixed && x.FridayShift == Shift.None))); default: return(x => x.TestingPersonnelWorkingAreas.Any(wa => wa.Area == workingArea) && (x.Type == TestingPersonnelType.Normal || x.Type == TestingPersonnelType.Fixed)); } }
public async Task <List <TestingPersonnelInvitationReceiverDto> > GetTestingPersonnelInvitationReceiversByWorkingAreaAsync(WorkingArea workingArea, DayOfWeek dayOfWeek) { await using var context = ContextFactory.CreateDataContext(null); var testingPersonnelInvitationReceivers = await context.TestingPersonnels .Where(GetFilterByWorkingAreaAndDayOfWeek(workingArea, dayOfWeek)) .Select(x => new TestingPersonnelInvitationReceiverDto { TestingPersonnelId = x.Id, Email = _aesCryptography.Decrypt(x.Email) }) .ToListAsync() .ConfigureAwait(false); return(testingPersonnelInvitationReceivers); }