private async void btnLoadBatchAsuntos_Click(object sender, RoutedEventArgs e)
        {
            try {
                List <Entidades.Asunto> lstToDistribute;
                if (!bllSelectedOnly)
                {
                    CheckLoadedUsersInAsunto();
                    lstToDistribute = lstAsuntoToAssign.ToList();
                }
                else
                {
                    isOneOperatorLoaded();
                    lstToDistribute = lstAsuntoToAssign.Where(asunto => asunto.Oper != null).ToList();
                }
                // Set sending time to current
                DateTime dtSendingTime = DateTime.Now;
                // On all filtered asuntos save sending date
                lstToDistribute.ForEach(asunto => asunto.SendingDate = dtSendingTime);
                // Generate a new logic asunto object
                Logica.Asunto      logAsunto      = new Logica.Asunto();
                Entidades.Operador currBackOffice = App.Current.Properties["user"] as Entidades.Operador;
                // Call for asunto distribution in batch
                await logAsunto.SentBatchAsuntoToOperators(currBackOffice, lstToDistribute);

                // Update balance with asuntos sented
                lstToDistribute.ForEach(asuntoToDeliver => currentBalanceFromOperators.Increment(asuntoToDeliver));
                currentBalanceFromOperators.UpdateAverage();
                // Refresh report of caller method
                (Owner as frmBackoffice).RefreshReportBalanceCurrentDay();
                Util.MsgBox.Error("Completado correctamente");
            }
            catch (Exception ex) {
                Except.Throw(ex);
            }
        }
Esempio n. 2
0
 private void mnuAddAsunto_Click(object sender, RoutedEventArgs e)
 {
     if (dgConnectedUser.SelectedItem != null)
     {
         // gets selected operator
         Operador operatorToAddAsunto = (dgConnectedUser.SelectedItem as OperBackoffice).Operator;
         // generates a new instance of the add asunto dialog
         frmAddAsunto frmNewAsunto = new frmAddAsunto(operatorToAddAsunto);
         // Shows the dialog
         frmNewAsunto.Owner = this;
         frmNewAsunto.WindowStartupLocation = WindowStartupLocation.CenterOwner;
         if (frmNewAsunto.ShowDialog() == true)
         {
             balanceOfOperators.Increment(frmNewAsunto.confirmedNewAsunto);
             balanceOfOperators.UpdateAverage();
             frmNewAsunto.Close();
             RefreshReportBalanceCurrentDay();
         }
     }
 }