Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,JobGettingConfigId")] PositionName positionName)
        {
            if (id != positionName.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(positionName);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PositionNameExists(positionName.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["JobGettingConfigId"] = new SelectList(_context.JobGettingConfig, "Id", "Id", positionName.JobGettingConfigId);
            return(View(positionName));
        }
Beispiel #2
0
 public IActionResult Update(PositionName positionName)
 {
     if (ModelState.IsValid)
     {
         positionName.UpdateDate = DateTime.Now;
         _positionNameRepository.Update(positionName);
         TempData["MSG_S"] = Message.MSG_S_001;
         return(RedirectToAction(nameof(Details), new { id = positionName.Id }));
     }
     return(View(nameof(Details), positionName));
 }
Beispiel #3
0
 public IActionResult Insert(PositionName positionName)
 {
     if (ModelState.IsValid)
     {
         positionName.InsertDate = DateTime.Now;
         positionName.BusinessId = _employeeLogin.GetEmployee().BusinessId;
         _positionNameRepository.Insert(positionName);
         TempData["MSG_S"] = Message.MSG_S_002;
         return(Json("Ok"));
     }
     return(Json("Error"));
 }
Beispiel #4
0
 public void Insert(PositionName positionName)
 {
     try
     {
         _context.PositionName.Add(positionName);
         _context.SaveChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,JobGettingConfigId")] PositionName positionName)
        {
            if (ModelState.IsValid)
            {
                _context.Add(positionName);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["JobGettingConfigId"] = new SelectList(_context.JobGettingConfig, "Id", "Id", positionName.JobGettingConfigId);
            return(View(positionName));
        }
Beispiel #6
0
 public void Update(PositionName positionName)
 {
     try
     {
         _context.PositionName.Update(positionName);
         _context.Entry(positionName).Property(x => x.InsertDate).IsModified = false;
         _context.SaveChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #7
0
 public void Remove(int id)
 {
     try
     {
         PositionName positionName = FindById(id);
         _context.PositionName.Remove(positionName);
         _context.SaveChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
    IEnumerator Generate100Players()
    {
        yield return(new WaitUntil(() => Position_Controller.instance.allPositions.Count > 0));

        for (int i = 0; i < 100; i++)
        {
            //get player with random position
            int          randomPosIndex = Random.Range(0, 6);
            PositionName randomPos      = (PositionName)randomPosIndex;
            Player       newPlayer      = new Player(Position_Controller.instance.allPositions[randomPos]);

            //save player to db
            Player_model.instance.AddPlayer(newPlayer);
        }
    }
Beispiel #9
0
        public IActionResult Details(int id)
        {
            PositionName positionName = _positionNameRepository.FindById(id);

            return(View(positionName));
        }
Beispiel #10
0
        internal BoundingBoxSide(PositionName position, NVector3 extent, UIColor color = null) : base()
        {
            if (color == null)
            {
                color = Utilities.AppYellow;
            }
            Tiles      = new List <Tile>();
            this.color = color;
            this.face  = position;

            // inline Swift setup() and setupExtensions() functions
            size = Size(extent);

            var   yAxis       = Axis.Y.Normal().ToSCNVector3();
            var   xAxis       = Axis.X.Normal().ToSCNVector3();
            var   zAxis       = Axis.Z.Normal().ToSCNVector3();
            float halfTurn    = (float)Math.PI;
            float quarterTurn = (float)Math.PI / 2;

            switch (face)
            {
            case PositionName.Front:
                LocalTranslate(new SCNVector3(0, 0, extent.Z / 2));
                break;

            case PositionName.Back:
                LocalTranslate(new SCNVector3(0, 0, -extent.Z / 2));
                LocalRotate(SCNQuaternion.FromAxisAngle(yAxis, halfTurn));
                break;

            case PositionName.Left:
                LocalTranslate(new SCNVector3(-extent.X / 2, 0, 0));
                LocalRotate(SCNQuaternion.FromAxisAngle(yAxis, -quarterTurn));
                break;

            case PositionName.Right:
                LocalTranslate(new SCNVector3(extent.X / 2, 0, 0));
                LocalRotate(SCNQuaternion.FromAxisAngle(yAxis, quarterTurn));
                break;

            case PositionName.Bottom:
                LocalTranslate(new SCNVector3(0, -extent.Y / 2, 0));
                LocalRotate(SCNQuaternion.FromAxisAngle(xAxis, halfTurn));
                break;

            case PositionName.Top:
                LocalTranslate(new SCNVector3(0, extent.Y / 2, 0));
                LocalRotate(SCNQuaternion.FromAxisAngle(xAxis, -quarterTurn));
                break;
            }

            for (int index = 0; index < 12; index++)
            {
                var line = new SCNNode();
                line.Geometry = Cylinder(lineThickness, extensionLength);
                if (index < 4)
                {
                    xAxisExtLines.Add(line);
                    line.LocalRotate(SCNQuaternion.FromAxisAngle(zAxis, -quarterTurn));
                    if (index == 2 || index == 3)
                    {
                        line.LocalRotate(SCNQuaternion.FromAxisAngle(xAxis, halfTurn));
                    }
                    xAxisExtNode.AddChildNode(line);
                }
                else if (index < 8)
                {
                    yAxisExtLines.Add(line);
                    if (index == 5 || index == 7)
                    {
                        line.LocalRotate(SCNQuaternion.FromAxisAngle(xAxis, halfTurn));
                    }
                    yAxisExtNode.AddChildNode(line);
                }
                else
                {
                    zAxisExtLines.Add(line);
                    line.LocalRotate(SCNQuaternion.FromAxisAngle(xAxis, -quarterTurn));
                    zAxisExtNode.AddChildNode(line);
                }
            }

            UpdateExtensions();
            HideXAxisExtensions();
            HideYAxisExtensions();
            HideZAxisExtensions();

            AddChildNode(xAxisExtNode);
            AddChildNode(yAxisExtNode);
            AddChildNode(zAxisExtNode);
        }
Beispiel #11
0
        public Position GetPositionByName(PositionName name)
        {
            var position = this.repository.AllAsNoTracking().First(x => x.Name == name);

            return(position);
        }
Beispiel #12
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Text == "贴框设备")
            {
                return;
            }

            foreach (TreeNode node in treeView1.Nodes[0].Nodes)
            {
                if (node.Text == e.Node.Text)
                {
                    node.ForeColor = Color.White;
                    node.BackColor = Color.DodgerBlue;
                }
                else
                {
                    node.ForeColor = Color.Black;
                    node.BackColor = Color.Transparent;
                }
            }

            var nodetext = (PositionName)Enum.Parse(typeof(PositionName), e.Node.Text);

            panelVeiw.Controls.Clear();
            m_panelOperate.Controls.Clear();
            switch (nodetext)
            {
            case PositionName.Y轴位置设定:
                m_panelOperate.Controls.Add(mYaxis);
                panelVeiw.Controls.Add(m_panelOperate, 0, 0);
                break;

            case PositionName.Z轴位置设定:
                m_panelOperate.Controls.Add(mZaxis);
                panelVeiw.Controls.Add(m_panelOperate, 0, 0);
                break;

            case PositionName.产品标定:
                m_panelOperate.Controls.Add(ProductTeach);
                panelVeiw.Controls.Add(m_panelOperate, 0, 0);
                break;

            case PositionName.机器人位置设定:
                m_panelOperate.Controls.Add(RootAxis);
                panelVeiw.Controls.Add(m_panelOperate, 0, 0);
                break;

            case PositionName.相机校正:
                m_panelOperate.Controls.Add(CameraRelationship);
                panelVeiw.Controls.Add(m_panelOperate, 0, 0);
                break;

            case PositionName.相机拍照位置:
                m_panelOperate.Controls.Add(mCameraAxis);
                panelVeiw.Controls.Add(m_panelOperate, 0, 0);
                break;

            default:
                //panelVeiw.Controls.Add(defaultView);
                break;
            }
            name = nodetext;
        }
 public Position(PositionName pos)
 {
     myPosition           = pos;
     positionModificators = Position_Data.instance.positionModificators[pos];
 }
Beispiel #14
0
        public void Seed()
        {
            if (_context.Business.Any() || _context.Address.Any() || _context.Contact.Any())
            {
                return;
            }
            Address ad1 = new Address
            {
                ZipCode      = "06622280",
                Street       = "Rua Santo André",
                Number       = 130,
                Neighborhood = "Santa Tereza",
                InsertDate   = DateTime.Now,
                CityId       = 887
            };

            Business business1 = new BusinessPhysical
            {
                FullName   = "Primeiro Comercio Pessoa Fisica",
                Email      = "*****@*****.**",
                CPF        = "36018556820",
                BirthDay   = DateTime.Parse("11/09/1995"),
                InsertDate = DateTime.Now,
                Address    = ad1
            };

            Contact contact1 = new Contact
            {
                TypeNumber = Models.Enums.TypeNumber.Celular,
                DDD        = "11",
                Number     = "954665152",
                Business   = business1,
                InsertDate = DateTime.Now
            };

            Address ad2 = new Address
            {
                ZipCode      = "06449162",
                Street       = "Rua Goiabeira",
                Number       = 71,
                Neighborhood = "Viana",
                InsertDate   = DateTime.Now,
                CityId       = 263
            };

            PositionName positionName = new PositionName
            {
                Name       = "Desenvolvedor",
                InsertDate = DateTime.Now,
                Business   = business1
            };

            Employee employee = new Employee
            {
                Name             = "Klinger Oliveira",
                CPF              = "36018556820",
                Email            = "*****@*****.**",
                Login            = "******",
                Sexo             = Models.Enums.Sexo.Masculino,
                Password         = "******",
                Address          = ad2,
                InsertDate       = DateTime.Now,
                Active           = true,
                BirthDay         = DateTime.Parse("11/09/1995"),
                PositionName     = positionName,
                Business         = business1,
                RegisterEmployee = null
            };

            Contact contact2 = new Contact
            {
                TypeNumber = Models.Enums.TypeNumber.Celular,
                DDD        = "11",
                Number     = "945624568",
                InsertDate = DateTime.Now,
                Employee   = employee
            };

            _context.Address.AddRange(ad1, ad2);
            _context.PositionName.AddRange(positionName);
            _context.Business.AddRange(business1);
            _context.Employee.AddRange(employee);
            _context.Contact.AddRange(contact1, contact2);
            _context.SaveChanges();
        }
Beispiel #15
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (EmployeeId != null)
                {
                    hashCode = hashCode * 59 + EmployeeId.GetHashCode();
                }
                if (EmployeeCode != null)
                {
                    hashCode = hashCode * 59 + EmployeeCode.GetHashCode();
                }
                if (EmployeeName != null)
                {
                    hashCode = hashCode * 59 + EmployeeName.GetHashCode();
                }

                hashCode = hashCode * 59 + Gender.GetHashCode();
                if (DateOfBirth != null)
                {
                    hashCode = hashCode * 59 + DateOfBirth.GetHashCode();
                }
                if (PhoneNumber != null)
                {
                    hashCode = hashCode * 59 + PhoneNumber.GetHashCode();
                }
                if (DepartmentId != null)
                {
                    hashCode = hashCode * 59 + DepartmentId.GetHashCode();
                }
                if (DepartmentName != null)
                {
                    hashCode = hashCode * 59 + DepartmentName.GetHashCode();
                }
                if (Email != null)
                {
                    hashCode = hashCode * 59 + Email.GetHashCode();
                }

                hashCode = hashCode * 59 + Salary.GetHashCode();

                hashCode = hashCode * 59 + WorkStatus.GetHashCode();
                if (PositionId != null)
                {
                    hashCode = hashCode * 59 + PositionId.GetHashCode();
                }
                if (PositionName != null)
                {
                    hashCode = hashCode * 59 + PositionName.GetHashCode();
                }
                if (TaxCode != null)
                {
                    hashCode = hashCode * 59 + TaxCode.GetHashCode();
                }
                if (JoinDate != null)
                {
                    hashCode = hashCode * 59 + JoinDate.GetHashCode();
                }
                if (IdentityNumber != null)
                {
                    hashCode = hashCode * 59 + IdentityNumber.GetHashCode();
                }
                if (IdentityDate != null)
                {
                    hashCode = hashCode * 59 + IdentityDate.GetHashCode();
                }
                if (IdentityPlace != null)
                {
                    hashCode = hashCode * 59 + IdentityPlace.GetHashCode();
                }
                return(hashCode);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Returns true if Employee instances are equal
        /// </summary>
        /// <param name="other">Instance of Employee to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Employee other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     EmployeeId == other.EmployeeId ||
                     EmployeeId != null &&
                     EmployeeId.Equals(other.EmployeeId)
                     ) &&
                 (
                     EmployeeCode == other.EmployeeCode ||
                     EmployeeCode != null &&
                     EmployeeCode.Equals(other.EmployeeCode)
                 ) &&
                 (
                     EmployeeName == other.EmployeeName ||
                     EmployeeName != null &&
                     EmployeeName.Equals(other.EmployeeName)
                 ) &&
                 (
                     Gender == other.Gender ||

                     Gender.Equals(other.Gender)
                 ) &&
                 (
                     DateOfBirth == other.DateOfBirth ||
                     DateOfBirth != null &&
                     DateOfBirth.Equals(other.DateOfBirth)
                 ) &&
                 (
                     PhoneNumber == other.PhoneNumber ||
                     PhoneNumber != null &&
                     PhoneNumber.Equals(other.PhoneNumber)
                 ) &&
                 (
                     DepartmentId == other.DepartmentId ||
                     DepartmentId != null &&
                     DepartmentId.Equals(other.DepartmentId)
                 ) &&
                 (
                     DepartmentName == other.DepartmentName ||
                     DepartmentName != null &&
                     DepartmentName.Equals(other.DepartmentName)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     Salary == other.Salary ||

                     Salary.Equals(other.Salary)
                 ) &&
                 (
                     WorkStatus == other.WorkStatus ||

                     WorkStatus.Equals(other.WorkStatus)
                 ) &&
                 (
                     PositionId == other.PositionId ||
                     PositionId != null &&
                     PositionId.Equals(other.PositionId)
                 ) &&
                 (
                     PositionName == other.PositionName ||
                     PositionName != null &&
                     PositionName.Equals(other.PositionName)
                 ) &&
                 (
                     TaxCode == other.TaxCode ||
                     TaxCode != null &&
                     TaxCode.Equals(other.TaxCode)
                 ) &&
                 (
                     JoinDate == other.JoinDate ||
                     JoinDate != null &&
                     JoinDate.Equals(other.JoinDate)
                 ) &&
                 (
                     IdentityNumber == other.IdentityNumber ||
                     IdentityNumber != null &&
                     IdentityNumber.Equals(other.IdentityNumber)
                 ) &&
                 (
                     IdentityDate == other.IdentityDate ||
                     IdentityDate != null &&
                     IdentityDate.Equals(other.IdentityDate)
                 ) &&
                 (
                     IdentityPlace == other.IdentityPlace ||
                     IdentityPlace != null &&
                     IdentityPlace.Equals(other.IdentityPlace)
                 ));
        }