Пример #1
0
        /// <summary>
        /// returns the location if the cylinder is in the rack
        /// if the cylinder is not in the rack returns a empty array
        /// </summary>
        /// <returns></returns>
        public int[] FindInRack()
        {
            int[] ret = new int[5];

            if (Cylinder_ID != 0)
            {
                SqlDbRack rack = sql.FirstOrDefault <SqlDbRack>("WHERE Cylinder_ID=@0", Cylinder_ID);

                if (rack != null)
                {
                    ret[0] = rack.RackNumber;
                    ret[1] = rack.Bridge;
                    ret[2] = rack.Trolley;
                    ret[3] = rack.Lift;
                    ret[4] = rack.Telescope;
                }
            }
            return(ret);
        }
Пример #2
0
        public static double Distance(Hook h1, Hook h2)
        {
            SqlDbRack r1 = h1.GetRack();
            SqlDbRack r2 = h2.GetRack();

            if (r1 == null)
            {
                r1 = new Hook(1, h1.bridge, h1.trolley, h1.Lift < 100 ? h1.lift : 1, 1).GetRack();
            }

            if (r2 == null)
            {
                r2 = new Hook(1, h2.bridge, h2.trolley, h2.Lift < 100 ? h2.lift : 1, 1).GetRack();
            }

            if (r1 == null || r2 == null)
            {
                return(0);
            }

            return(Math.Abs(r1.PositionX - r2.PositionX) + Math.Abs(r1.PositionY - r2.PositionY) + Math.Abs(r1.PositionZ - r2.PositionZ));
        }
Пример #3
0
 public Hook(SqlDbRack r) : this(r.RackNumber, r.Bridge, r.Trolley, r.Lift, r.Telescope)
 {
 }