Exemplo n.º 1
0
        public EmployeeView(RulaObject _rulaObject , Employee _toemployee , string _type)
        {
            this._employee = _toemployee;
            this._employee.RulaObject = _rulaObject;
            _employee.Rula_score = new RulaScore();
            _employee.Rula_score.CreateFromRulaObject(_rulaObject);
            _employee.Rula_score.Type = _type;
            this.DataContext = _employee;
            InitializeComponent();

        }
Exemplo n.º 2
0
        public EmployeeView(RulaObject _rulaObject, string _type)
        {
            this._employee = new Employee();
            this._employee.RulaObject = _rulaObject;
            _employee.Rula_score = new RulaScore();
            _employee.Rula_score.CreateFromRulaObject(_rulaObject);

            _employee.Rula_score.Type = _type;
            this.DataContext = _employee;
            InitializeComponent();

            //Employees = _employee.All();
            //cb_employee.ItemsSource = Employees;
        }
Exemplo n.º 3
0
        public RulaScore CreateFromRulaObject(RulaObject rula)
        {
           
            int[,] chart = Helpers.getChart(Helpers.chart_type.arm_wrist);
            int y = Helpers.getY(rula.score_upper_arm.getTotal(), rula.score_lower_arm.getTotal());
            int x = Helpers.getX(rula.score_wrist_position.getTotal(), rula.score_wrist_twist.getTotal());
            if (Helpers.Check2DArray(y, x, chart))
            {
                this.posture_score_a = chart[y, x];
            }
            else return null;
            this.final_wrist_arm_score = this.posture_score_a + rula.score_arm_wrist_muscle.getTotal() + rula.score_arm_wrist_load.getTotal();
            chart = Helpers.getChart(Helpers.chart_type.trunk);
            y = Helpers.getYTrunk(rula.score_neck.getTotal());
            x = Helpers.getXTrunk(rula.score_trunk.getTotal(), rula.score_legs.getTotal());
            if (Helpers.Check2DArray(y, x, chart))
            {
                this.posture_score_b = chart[y, x];
            }
            else return null;

            this.final_neck_trunk_leg_score = posture_score_b + rula.score_neck_trunk_legs_muscle.getTotal() + rula.score_neck_trunk_legs_load.getTotal();
            int tempy = final_neck_trunk_leg_score;
            int tempx = final_wrist_arm_score;
            chart = Helpers.getChart(Helpers.chart_type.rula_final);

            if ((final_wrist_arm_score) >= chart.GetLength(0))
            {
                tempx = chart.GetLength(0) -1;

            }
            int xx = chart.GetLength(0);
            int yy = chart.GetLength(1);
            if ((final_neck_trunk_leg_score) >= chart.GetLength(1))
            {
                tempy = chart.GetLength(1) -1;

            }
           
            this.final_score = chart[tempx, tempy];

            switch (final_score)
            {
                case 1:
                case 2:
                    this.description = "Acceptable";
                    break;
                case 3:
                case 4:
                    this.description = "Investigate further.";
                    break;
                case 5:
                case 6:
                    this.description = "Investigate further and change soon.";
                    break;
                default:
                    this.description = "Investigate and change immediately";
                    break;
            }


            return this.rulaScore;
        }
Exemplo n.º 4
0
       public static RulaObject HandleEvent(object sender, RoutedEventArgs e, RulaObject rulaObject)
        {
            string _contentText = Helpers.GetContentText(sender);
            Type _senderType = sender.GetType();
            string _type = "";

            if (sender.GetType().Name == "CheckBox")
            {
                _type = "Additional";
            }
            else if (sender.GetType().Name == "RadioButton")
            {
                _type = "Score";
            }

            var rdb = sender as System.Windows.Controls.Control;
            if (rdb.Tag == null) return rulaObject;
            String _tag = rdb.Tag.ToString();
            string _group = rdb.Uid.ToString();
            switch (_group)
            {
                case "upper_arm":
                    if (_type == "Additional")
                    {
                        rulaObject.score_upper_arm.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_upper_arm.AdditionalScore += (Helpers.Convert(_tag));
                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_upper_arm.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
                case "lower_arm":
                    if (_type == "Additional")
                    {
                        rulaObject.score_lower_arm.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_lower_arm.AdditionalScore += (Helpers.Convert(_tag));
                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_lower_arm.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
                case "wrist_position":
                    if (_type == "Additional")
                    {
                        rulaObject.score_wrist_position.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_wrist_position.AdditionalScore += (Helpers.Convert(_tag));
                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_wrist_position.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
                case "wrist_twist":
                    if (_type == "Additional")
                    {
                        rulaObject.score_wrist_twist.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_wrist_twist.AdditionalScore += (Helpers.Convert(_tag));
                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_wrist_twist.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
                case "arm_wrist_muscle":
                    if (_type == "Additional")
                    {
                        rulaObject.score_arm_wrist_muscle.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_arm_wrist_muscle.AdditionalScore += (Helpers.Convert(_tag));

                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_arm_wrist_muscle.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }

                    break;
                case "arm_wrist_load":
                    if (_type == "Additional")
                    {
                        rulaObject.score_arm_wrist_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_arm_wrist_load.AdditionalScore += (Helpers.Convert(_tag));

                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_arm_wrist_load.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
                case "neck_position":
                    if (_type == "Additional")
                    {
                        rulaObject.score_neck.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_neck.AdditionalScore += (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_neck.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
                case "trunk_position":
                    if (_type == "Additional")
                    {
                        rulaObject.score_trunk.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_trunk.AdditionalScore += (Helpers.Convert(_tag));
                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_trunk.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        

                    }
                    break;
                case "legs_position":
                    if (_type == "Additional")
                    {
                        rulaObject.score_legs.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_legs.AdditionalScore += (Helpers.Convert(_tag));
                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_legs.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
                case "neck_trunk_legs_muscle":
                    if (_type == "Additional")
                    {
                        rulaObject.score_neck_trunk_legs_muscle.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_neck_trunk_legs_muscle.AdditionalScore += (Helpers.Convert(_tag));

                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_neck_trunk_legs_muscle.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
                case "neck_trunk_legs_load":
                    if (_type == "Additional")
                    {
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText , _type));
                        rulaObject.score_neck_trunk_legs_load.AdditionalScore += (Helpers.Convert(_tag));
                    }
                    else if (_type == "Score")
                    {
                        rulaObject.score_neck_trunk_legs_load.Score = (Helpers.Convert(_tag));
                        rulaObject.score_neck_trunk_legs_load.currentAdditionalChoices.Add(new IndexScoreChoice(Helpers.Convert(_tag), _contentText, _type));
                        
                    }
                    break;
            }
            return rulaObject;
        }