private Pin CreatePin(Models.Position position, string label = null, string address = null) => new Pin { Type = PinType.Place, Position = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude), Label = label, Address = address };
public CoordinateSystemsJson(Models.Position position) { id = position.Id; name = position.Name; description = position.Description; referenceUrl = position.ReferenceUrl; precision = position.Precision; }
public ActionResult CreatePosition(Models.Position position) { if (ModelState.IsValid) { _positionsHandler.Add(ConvertToBlModel(position)); } return(RedirectToAction("Positions")); }
public DataAccessLayerCommon.Position MapToItem(Models.Position position) { return(new DataAccessLayerCommon.Position() { Id = position.Id, Name = position.Name, Flag = position.Flag }); }
public ActionResult Edit(Models.Position position, int id) { if (!ModelState.IsValid) { return(View(position)); } positionRepository.Update(id, positionMapper.MapToItem(position)); return(RedirectPermanent("/position/show")); }
public ActionResult Add(Models.Position position) { if (!ModelState.IsValid) { return(View()); } positionRepository.Insert(positionMapper.MapToItem(position)); return(View()); }
private Position[] GetPositions() { //SqlRepository repository = new SqlRepository(_LocalFileConnectionString); Position position = new Models.Position(); position.Id = 1; position.PositionName = "Test"; Position position2 = new Models.Position(); position.Id = 2; position.PositionName = "Run"; Position[] positions = { position, position2 }; return(positions); }
private void btnOk_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtPosition.Text)) { MessageBox.Show("Xana boşdur!!"); return; } Position pos = new Models.Position { Name = txtPosition.Text }; db.Positions.Add(pos); db.SaveChanges(); MessageBox.Show("Yeni vəzifə əlavə edildi!"); Reset(); }
public static string ImportEmployees(FastFoodDbContext context, string jsonString) { var sb = new StringBuilder(); var deserializedEmployees = JsonConvert.DeserializeObject <EmployeeDto[]>(jsonString); var validEmployes = new List <Employee>(); foreach (var employeeDto in deserializedEmployees) { if (!IsValid(employeeDto)) { sb.AppendLine(string.Format(FailureMessage, employeeDto.Name)); continue; } if (!context.Positions.Any(e => e.Name == employeeDto.Position)) { var positionToAdd = new Models.Position(); positionToAdd.Name = employeeDto.Position; context.Positions.Add(positionToAdd); context.SaveChanges(); } var position = context.Positions.FirstOrDefault(e => e.Name == employeeDto.Position); var employee = new Employee(); employee.Name = employeeDto.Name; employee.PositionId = position.Id; employee.Age = employeeDto.Age; validEmployes.Add(employee); sb.AppendLine(string.Format(SuccessMessage, employee.Name)); } context.Employees.AddRange(validEmployes); context.SaveChanges(); return(sb.ToString().Trim()); }
public ActionResult EditPosition(Models.Position position) { _positionsHandler.Update(ConvertToBlModel(position)); return(RedirectToAction("Positions")); }
private static Position ConvertToBlModel(Models.Position position) { Mapper.CreateMap <Models.Position, Position>(); return(Mapper.Map <Models.Position, Position>(position)); }
private void Start(Models.User User) { Models.Position Position = User.GetPosition(); if (Position != null) { Int64 IDPosition = Position.ID; switch (IDPosition) { case 1: //Администратор Main Administrator = new Main(); this.Hide(); Tray.Visible = false; Administrator.Show(); break; case 2: //Инженер конструктор Design_Engineer_F Design_Engineer = new Design_Engineer_F(); this.Hide(); if (SystemArgs.SettingsUser.Hidden) { Design_Engineer.WindowState = FormWindowState.Minimized; Design_Engineer.ShowInTaskbar = false; } Tray.Visible = false; Design_Engineer.Show(); break; case 3: //КБ KB_F KB = new KB_F(); this.Hide(); Tray.Visible = false; KB.Show(); break; case 4: //Архивариус AR_Arhive_F Arhive = new AR_Arhive_F(); this.Hide(); Tray.Visible = false; Arhive.Show(); break; case 5: //Сотрудник ПДО PDO_F PDO = new PDO_F(); this.Hide(); Tray.Visible = false; PDO.Show(); break; case 6: //Сотрудник ОПП OPP_F OPP = new OPP_F(); this.Hide(); Tray.Visible = false; OPP.Show(); break; case 7: Chief_PDO_F Chief_PDO = new Chief_PDO_F(); this.Hide(); Tray.Visible = false; Chief_PDO.Show(); break; default: throw new Exception("Должности пользователя не существует"); } } }
private void MoveToRegion(Models.Position position) { CustomMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude), Distance.FromMiles(0.2))); }
private CustomCircle CreateCircle(Models.Position position, int radius) => new CustomCircle { Position = position, Radius = radius };
void RefreshPosition(Models.Position position) { CustomMap.Pins.Clear(); CustomMap.Pins.Add(CreatePin(position, "SENAI Londrina - STI", "Rua São Vicent, 168")); MoveToRegion(position); }