Beispiel #1
0
        /// <summary>
        /// Obtiene los statistics del antiguo personnel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 24/06/2016
        /// </history>
        private async void btnGetStaticsOld_Click(object sender, RoutedEventArgs e)
        {
            if (cmbPersonnelOld.SelectedValue != null)
            {
                idOldSelect = cmbPersonnelOld.SelectedValue.ToString();
                lockButtons(false);
                txtStatus.Text = "Loading...";
                PersonnelShort      personnelShort      = (PersonnelShort)cmbPersonnelOld.SelectedItem;
                PersonnelStatistics personnelStatistics = await BRPersonnel.GetPersonnelStatistics(personnelShort.peID);

                LoadStatistics(tvwOld, personnelStatistics, personnelShort);
                lockButtons(true);
            }
            else
            {
                UIHelper.ShowMessage("Please select a Personnel");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Obtiene los statistics del nuevo personnel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 24/06/2016
        /// </history>
        private async void btnGetStaticsNew_Click(object sender, RoutedEventArgs e)
        {
            if (cmbPersonnelNew.SelectedValue != null)
            {
                idNewSelect = cmbPersonnelNew.SelectedValue.ToString();
                lockButtons(false);
                status.Visibility = Visibility.Visible;
                txtStatus.Text    = "Loading...";
                PersonnelShort      personnelShort      = (PersonnelShort)cmbPersonnelNew.SelectedItem;
                PersonnelStatistics personnelStatistics = await BRPersonnel.GetPersonnelStatistics(personnelShort.peID);

                LoadStatistics(tvwNew, personnelStatistics, personnelShort);
                status.Visibility = Visibility.Collapsed;
                lockButtons(true);
            }
            else
            {
                UIHelper.ShowMessage("Please select a Personnel");
            }
        }
Beispiel #3
0
        /// <summary>
        /// Cambia el ID del personnel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 24/06/2016
        /// </history>
        private async void btnChangeID_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                lockButtons(false);

                if (cmbPersonnelNew.SelectedValue != null && cmbPersonnelOld.SelectedValue != null)
                {
                    if (cmbPersonnelNew.SelectedValue != cmbPersonnelOld.SelectedValue)
                    {
                        #region Tasks
                        lockButtons(false);
                        txtStatus.Text = "Loading...";
                        if (cmbPersonnelOld.SelectedValue.ToString() != idOldSelect)
                        {
                            idOldSelect = cmbPersonnelOld.SelectedValue.ToString();
                            PersonnelShort      personnelShort      = (PersonnelShort)cmbPersonnelOld.SelectedItem;
                            PersonnelStatistics personnelStatistics = await BRPersonnel.GetPersonnelStatistics(personnelShort.peID);

                            LoadStatistics(tvwOld, personnelStatistics, personnelShort);
                        }
                        if (cmbPersonnelNew.SelectedValue.ToString() != idNewSelect)
                        {
                            idNewSelect = cmbPersonnelNew.SelectedValue.ToString();
                            PersonnelShort      personnelShort      = (PersonnelShort)cmbPersonnelNew.SelectedItem;
                            PersonnelStatistics personnelStatistics = await BRPersonnel.GetPersonnelStatistics(personnelShort.peID);

                            LoadStatistics(tvwNew, personnelStatistics, personnelShort);
                        }

                        #endregion

                        MessageBoxResult msgResult = UIHelper.ShowMessage("Are you sure you want to change the User's ID? \n " + msjOld + " \n " + msjNew, MessageBoxImage.Question, "Personnel Change ID");
                        if (msgResult == MessageBoxResult.Yes)
                        {
                            txtStatus.Text = "Changing ID...";
                            int nRes = await BRPersonnel.UpdatePersonnelId(cmbPersonnelOld.SelectedValue.ToString(), cmbPersonnelNew.SelectedValue.ToString());

                            UIHelper.ShowMessageResult("ID", nRes);
                            if (nRes > 0)
                            {
                                DialogResult = true;
                                Close();
                            }
                        }
                        lockButtons(true);
                    }
                }
                else
                {
                    UIHelper.ShowMessage("Please select old ID and new ID");
                }


                lockButtons(true);
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }