Exemplo n.º 1
0
        // private  string msg = "hold";  //默认发送数据
        //发送数据
        private void sendMsg()
        {
            String targetIP = Utils.getConfig("targetIP");

            if (targetIP != null && !"".Equals(targetIP))
            {
                try
                {
                    EndPoint       point = new IPEndPoint(IPAddress.Parse(targetIP), 6000);
                    Rehabilitation rhb   = Rehabilitation.GetSingleton();
                    int            now   = 0;
                    while (isServe)
                    {
                        if (server != null && (now = rhb.GetScore()) != -1)
                        {
                            server.SendTo(Encoding.UTF8.GetBytes(now.ToString()), point);
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString(), "出错了");
                    isServe = false;
                }
            }
            else
            {
                MessageBox.Show("目标IP地址不能为空", "出错了");
            }
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> PutRehabilitation(int id, Rehabilitation rehabilitation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != rehabilitation.ID)
            {
                return(BadRequest());
            }

            db.Entry(rehabilitation).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RehabilitationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public GloveModel()
        {
            gc = GloveController.GetSingleton(ModelType.HandOnly);
            //            var mLogger = Logger.GetInstance(mw.txt_log);
            //            gc.RegisterLogger(mLogger);

            //if (!gc.IsConnected((int)handType)) //接入手套
            //{
            //    gc.Connect(chuankou, 0);       //连接手套和串口
            //}
            rhb             = Rehabilitation.GetSingleton();
            dh              = DataWarehouse.GetSingleton();
            sc              = SkeletonCalculator.GetSingleton("");
            handinformation = HandInf.GetSingleton();

            OptimizedData = HandInf.GetSingleton();

            fram       = new SkeletonJson();
            Mychuankou = "COM3";


            //pullDataTimer = new Timer(500);
            //pullDataTimer.Elapsed += pullDataTimer_Tick;
            //pullDataTimer.Start();
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> PostRehabilitation(Rehabilitation rehabilitation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Rehabilitations.Add(rehabilitation);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (RehabilitationExists(rehabilitation.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = rehabilitation.ID }, rehabilitation));
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Returns true if WeeklyPrice instances are equal
        /// </summary>
        /// <param name="other">Instance of WeeklyPrice to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(WeeklyPrice other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                     ) &&
                 (
                     Rehabilitation == other.Rehabilitation ||
                     Rehabilitation != null &&
                     Rehabilitation.Equals(other.Rehabilitation)
                 ) &&
                 (
                     TurnoverRate == other.TurnoverRate ||
                     TurnoverRate != null &&
                     TurnoverRate.Equals(other.TurnoverRate)
                 ));
        }
Exemplo n.º 6
0
 public GloveConfigView()
 {
     InitializeComponent();
     sc  = SensorCalibrator.GetSingleton();
     rhb = Rehabilitation.GetSingleton();
     skc = SkeletonCalculator.GetSingleton("");
     dh  = DataWarehouse.GetSingleton();
 }
Exemplo n.º 7
0
        public async Task <IHttpActionResult> GetRehabilitation(int id)
        {
            Rehabilitation rehabilitation = await db.Rehabilitations.FindAsync(id);

            if (rehabilitation == null)
            {
                return(NotFound());
            }

            return(Ok(rehabilitation));
        }
Exemplo n.º 8
0
        public async Task <IHttpActionResult> DeleteRehabilitation(int id)
        {
            Rehabilitation rehabilitation = await db.Rehabilitations.FindAsync(id);

            if (rehabilitation == null)
            {
                return(NotFound());
            }

            db.Rehabilitations.Remove(rehabilitation);
            await db.SaveChangesAsync();

            return(Ok(rehabilitation));
        }
Exemplo n.º 9
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked            // Overflow is fine, just wrap
     {
         int hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Date != null)
         {
             hashCode = hashCode * 59 + Date.GetHashCode();
         }
         if (Rehabilitation != null)
         {
             hashCode = hashCode * 59 + Rehabilitation.GetHashCode();
         }
         if (TurnoverRate != null)
         {
             hashCode = hashCode * 59 + TurnoverRate.GetHashCode();
         }
         if (Per != null)
         {
             hashCode = hashCode * 59 + Per.GetHashCode();
         }
         if (Psr != null)
         {
             hashCode = hashCode * 59 + Psr.GetHashCode();
         }
         if (Pcfr != null)
         {
             hashCode = hashCode * 59 + Pcfr.GetHashCode();
         }
         if (Pbr != null)
         {
             hashCode = hashCode * 59 + Pbr.GetHashCode();
         }
         if (Stopped != null)
         {
             hashCode = hashCode * 59 + Stopped.GetHashCode();
         }
         if (SpecialTreatment != null)
         {
             hashCode = hashCode * 59 + SpecialTreatment.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 10
0
 public static void ImportRehabilitation()
 {
     using (var context = new HospitalAppEntities())
     {
         var rehabilitation = new Rehabilitation()
         {
             RehabilitationStartDate = new DateTime(2012, 02, 03),
             RehabilitationEndDate   = new DateTime(2012, 03, 04),
             RoomId    = 10,
             PatientId = 3,
             DiseaseId = 1,
             DoctorId  = 2
         };
         context.Rehabilitations.Add(rehabilitation);
         Console.WriteLine("Succesfuly added new rehabilitation");
         context.SaveChanges();
     }
 }
Exemplo n.º 11
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked            // Overflow is fine, just wrap
     {
         int hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Date != null)
         {
             hashCode = hashCode * 59 + Date.GetHashCode();
         }
         if (Rehabilitation != null)
         {
             hashCode = hashCode * 59 + Rehabilitation.GetHashCode();
         }
         if (TurnoverRate != null)
         {
             hashCode = hashCode * 59 + TurnoverRate.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 12
0
        private GloveModule(MainWindow mw)
        {
            this.mw = mw;
            gc      = GloveController.GetSingleton(ModelType.HandOnly);
            var mLogger = Logger.GetInstance(mw.txt_log);

            gc.RegisterLogger(mLogger);
            rhb = Rehabilitation.GetSingleton();
            dh  = DataWarehouse.GetSingleton();
            string[] ports = gc.GetPorts();
            if (ports.Length > 0)
            {
                ports.ToList().ForEach(n => mw.cbb_port.Items.Add(n));
                mw.cbb_port.SelectedItem = mw.cbb_port.Items[mw.cbb_port.Items.Count - 1];
            }
            // socket module
            sm = SocketManager.GetInstance();
            sm.Start(10200);
            sc                     = SkeletonCalculator.GetSingleton("");
            pullDataTimer          = new Timer(10);
            pullDataTimer.Elapsed += pullDataTimer_Tick;
            pullDataTimer.Start();
        }
Exemplo n.º 13
0
 private void newRehabilitation_Save_click(object sender, RoutedEventArgs e)
 {
     using (var context = new HospitalAppEntities())
     {
         var rehabilitation = new Rehabilitation();
         rehabilitation.RehabilitationStartDate = Convert.ToDateTime(RehabilitationStartDate.Text);
         rehabilitation.RehabilitationEndDate   = Convert.ToDateTime(RehabilitationEndDate.Text);
         rehabilitation.RoomId    = Convert.ToInt32(RoomId.Text);
         rehabilitation.PatientId = Convert.ToInt32(PatientId.Text);
         rehabilitation.DiseaseId = Convert.ToInt32(DiseaseId.Text);
         rehabilitation.DoctorId  = Convert.ToInt32(DoctorId.Text);
         if (rehabilitation.RoomId == 0 || rehabilitation.PatientId == 0 || rehabilitation.DiseaseId == 0 || rehabilitation.DoctorId == 0)
         {
             MessageBox.Show("Error: Check if there is any missing proparties or 0 values of Ids");
         }
         else
         {
             context.Rehabilitations.Add(rehabilitation);
             added.Content    = $"Rehabilitation added successfully!";
             added.Visibility = Visibility.Visible;
             context.SaveChanges();
         }
     }
 }
Exemplo n.º 14
0
        /// <summary>
        ///     Returns true if DailyPrice instances are equal
        /// </summary>
        /// <param name="other">Instance of DailyPrice to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DailyPrice other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                (Equals((PriceBase)other) &&
                 (
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                 ) &&
                 (
                     PreClosing == other.PreClosing ||
                     PreClosing != null &&
                     PreClosing.Equals(other.PreClosing)
                 ) &&
                 (
                     Rehabilitation == other.Rehabilitation ||
                     Rehabilitation != null &&
                     Rehabilitation.Equals(other.Rehabilitation)
                 ) &&
                 (
                     TurnoverRate == other.TurnoverRate ||
                     TurnoverRate != null &&
                     TurnoverRate.Equals(other.TurnoverRate)
                 ) &&
                 (
                     Per == other.Per ||
                     Per != null &&
                     Per.Equals(other.Per)
                 ) &&
                 (
                     Psr == other.Psr ||
                     Psr != null &&
                     Psr.Equals(other.Psr)
                 ) &&
                 (
                     Pcfr == other.Pcfr ||
                     Pcfr != null &&
                     Pcfr.Equals(other.Pcfr)
                 ) &&
                 (
                     Pbr == other.Pbr ||
                     Pbr != null &&
                     Pbr.Equals(other.Pbr)
                 ) &&
                 (
                     Stopped == other.Stopped ||
                     Stopped != null &&
                     Stopped.Equals(other.Stopped)
                 ) &&
                 (
                     SpecialTreatment == other.SpecialTreatment ||
                     SpecialTreatment != null &&
                     SpecialTreatment.Equals(other.SpecialTreatment)
                 ));
        }
Exemplo n.º 15
0
        public static RehabilitationDTO EntityToDTO(Rehabilitation rehabilitation)
        {
            var mapper = mapperConfiguration.CreateMapper();

            return(mapper.Map <Rehabilitation, RehabilitationDTO>(rehabilitation));
        }