Esempio n. 1
0
        /// <summary>
        /// 处理更新个人设置请求
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public PersonalSetResponse PersonalSetRequest(PersonalSetRequest request)
        {
            PersonalSetResponse response = new PersonalSetResponse
            {
                Uid          = request.Uid,
                DeviceType   = request.DeviceType,
                ActivityType = request.ActivityType,
                Success      = false,
                DataId       = request.DataId
            };
            var setEntity = new PersonalSettingEntity
            {
                Member_id          = request.Uid,
                Device_code        = ((int)request.DeviceType).ToString(),
                Activity_type      = ((int)request.ActivityType).ToString(),
                Seat_height        = request.SeatHeight,
                Backrest_distance  = request.BackDistance,
                Lever_length       = request.LeverLength,
                Lever_angle        = request.LeverAngle,
                Front_limit        = request.ForwardLimit,
                Back_limit         = request.BackLimit,
                Training_mode      = ((int)request.TrainMode).ToString(),
                Footboard_distance = request.PedalDistance
            };

            using (TransactionScope ts = new TransactionScope()) //使整个代码块成为事务性代码
            {
                //更新个人设置,更新是否减脂模式
                memberDAO.UpdateDeFatState(request.Uid, request.DefatModeEnable);
                personalSettingDAO.UpdateSetting(setEntity);
                response.Success = true;
                ts.Complete();
            }
            return(response);
        }
Esempio n. 2
0
        /// <summary>
        /// 处理更新个人设置请求
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public PersonalSetResponse HandlePersonalSetRequest(PersonalSetRequest request)
        {
            PersonalSetResponse response = new PersonalSetResponse
            {
                Uid        = request.Uid,
                DeviceType = request.DeviceType,
                TrainMode  = request.TrainMode,
                DataId     = request.DataId,
                Success    = false,
            };

            try {
                var setEntity = new PersonalSettingEntity
                {
                    Fk_member_id        = long.Parse(request.Uid),
                    Member_id           = request.BindId,
                    Device_code         = ((int)request.DeviceType).ToString(),
                    Device_order_number = ((int)request.DeviceType + 1),
                    Seat_height         = request.SeatHeight,
                    Backrest_distance   = request.BackDistance,
                    Footboard_distance  = request.FootboardDistance,
                    Lever_angle         = request.LeverAngle,
                    Front_limit         = request.ForwardLimit,
                    Back_limit          = request.BackLimit,
                    Training_mode       = ((int)request.TrainMode).ToString(),
                    Consequent_force    = request.ConsequentForce,
                    Reverse_force       = request.ReverseForce,
                    Power = request.Power,
                };
                personalSettingDAO.UpdateSetting(setEntity);
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Success = false;
                logger.Error("更新个人设置出错" + ex.ToString());
            }

            //更新个人设置


            return(response);
        }