コード例 #1
0
 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
 };
コード例 #2
0
 public CoordinateSystemsJson(Models.Position position)
 {
     id           = position.Id;
     name         = position.Name;
     description  = position.Description;
     referenceUrl = position.ReferenceUrl;
     precision    = position.Precision;
 }
コード例 #3
0
        public ActionResult CreatePosition(Models.Position position)
        {
            if (ModelState.IsValid)
            {
                _positionsHandler.Add(ConvertToBlModel(position));
            }

            return(RedirectToAction("Positions"));
        }
コード例 #4
0
 public DataAccessLayerCommon.Position MapToItem(Models.Position position)
 {
     return(new DataAccessLayerCommon.Position()
     {
         Id = position.Id,
         Name = position.Name,
         Flag = position.Flag
     });
 }
コード例 #5
0
        public ActionResult Edit(Models.Position position, int id)
        {
            if (!ModelState.IsValid)
            {
                return(View(position));
            }

            positionRepository.Update(id, positionMapper.MapToItem(position));
            return(RedirectPermanent("/position/show"));
        }
コード例 #6
0
        public ActionResult Add(Models.Position position)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            positionRepository.Insert(positionMapper.MapToItem(position));
            return(View());
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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());
        }
コード例 #10
0
 public ActionResult EditPosition(Models.Position position)
 {
     _positionsHandler.Update(ConvertToBlModel(position));
     return(RedirectToAction("Positions"));
 }
コード例 #11
0
        private static Position ConvertToBlModel(Models.Position position)
        {
            Mapper.CreateMap <Models.Position, Position>();

            return(Mapper.Map <Models.Position, Position>(position));
        }
コード例 #12
0
        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("Должности пользователя не существует");
                }
            }
        }
コード例 #13
0
 private void MoveToRegion(Models.Position position)
 {
     CustomMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude), Distance.FromMiles(0.2)));
 }
コード例 #14
0
 private CustomCircle CreateCircle(Models.Position position, int radius) =>
 new CustomCircle
 {
     Position = position,
     Radius   = radius
 };
コード例 #15
0
 void RefreshPosition(Models.Position position)
 {
     CustomMap.Pins.Clear();
     CustomMap.Pins.Add(CreatePin(position, "SENAI Londrina - STI", "Rua São Vicent, 168"));
     MoveToRegion(position);
 }