Пример #1
0
        /*
         * // Evento para setear el BoxNumber desde otro hilo
         * public void setNumberBoxText(int pElementIndex, string pText)
         * {
         *  if (this.boxArray[pElementIndex].textbox.InvokeRequired)
         *  {
         *      SetNumberBoxTextCallback callBack = new SetNumberBoxTextCallback(setNumberBoxText);
         *      this.Invoke(callBack, new object[] { pElementIndex, pText });
         *  }
         *  else
         *  {
         *      this.boxArray[pElementIndex].textbox.Text = pText;
         *  }
         * }
         * // Evento para obtener el SelectedGroup desde otro hilo
         * public int getSelectedGroup()
         * {
         *  int selectedIndex = 0;
         *  if (this.drawTypeBox.InvokeRequired)
         *  {
         *      GetSelectedGroupCallback callBack = new GetSelectedGroupCallback(getSelectedGroup);
         *      selectedIndex = (int)this.Invoke(callBack, new object[] { });
         *  }
         *  else
         *  {
         *      selectedIndex = this.drawTypeBox.SelectedIndex;
         *  }
         *  Console.WriteLine("selectedIndex: " + selectedIndex);
         *  return selectedIndex;
         * }
         * // Evento para setear el SelectedGroup desde otro hilo
         * public void setSelectedGroup(int pGroupId)
         * {
         *  if (this.drawTypeBox.InvokeRequired)
         *  {
         *      SetSelectedGroupCallback callBack = new SetSelectedGroupCallback(setSelectedGroup);
         *      this.Invoke(callBack, new object[] { pGroupId });
         *  }
         *  else
         *  {
         *      this.drawTypeBox.SelectedIndex = pGroupId;
         *  }
         * }
         * // Evento para setear el TotalImport desde otro hilo
         * public void setTotalImport(string pText)
         * {
         *  if (this.txbTotalImport.InvokeRequired)
         *  {
         *      SetTotalImportCallback callBack = new SetTotalImportCallback(setTotalImport);
         *      this.Invoke(callBack, new object[] { pText });
         *  }
         *  else
         *  {
         *      this.txbTotalImport.Text = pText;
         *  }
         * }
         * // Evento para setear el SyncImport desde otro hilo
         * public void setSyncImport(string pText)
         * {
         *  if (this.txbSyncImport.InvokeRequired)
         *  {
         *      SetSyncImportCallback callBack = new SetSyncImportCallback(setSyncImport);
         *      this.Invoke(callBack, new object[] { pText });
         *  }
         *  else
         *  {
         *      this.txbSyncImport.Text = pText;
         *  }
         * }
         * // Evento para setear el PendingImport desde otro hilo
         * public void setPendingImport(string pText)
         * {
         *  if (this.txbPendingImport.InvokeRequired)
         *  {
         *      SetPendingImportCallback callBack = new SetPendingImportCallback(setPendingImport);
         *      this.Invoke(callBack, new object[] { pText });
         *  }
         *  else
         *  {
         *      this.txbPendingImport.Text = pText;
         *  }
         * }
         * // Evento para setear el MaxToReceive desde otro hilo
         * public void setMaxToReceive(string pText)
         * {
         *  if (this.txbMaxToReceive.InvokeRequired)
         *  {
         *      SetMaxToReceiveCallback callBack = new SetMaxToReceiveCallback(setMaxToReceive);
         *      this.Invoke(callBack, new object[] { pText });
         *  }
         *  else
         *  {
         *      this.txbMaxToReceive.Text = pText;
         *  }
         * }
         */

        //--------------------------------------- Métodos de Actualización --------------------------------------//

        private void updateBoxArray(long pGroupId)
        {
            this.updateTotalBoxes(pGroupId);

            int totalImport = 0;
            //int pendingImport = 0;
            ListService listService = new ListService();

            // Calcular importe sincronizado con el server
            int[] syncTotalImportArray = listService.getDrawTotals(this.datePickerList.Value.Date, pGroupId);
            for (int i = 0; i < syncTotalImportArray.Length; i++)
            {
                totalImport += syncTotalImportArray[i];
                //this.boxArray[i].textbox.Text = FormatService.formatInt(syncTotalImportArray[i]);
                this.setNumberBoxText(i, FormatService.formatInt(syncTotalImportArray[i]));
            }
            this.setTotalImport(FormatService.formatInt(totalImport));

            /*
             * // Calcular importe pendiente de sincronización
             * int[] pendingSyncImportArray = listService.getDrawPendingSyncTotals(this.datePickerList.Value.Date, pGroupId);
             * for (int i = 0; i < syncTotalImportArray.Length; i++)
             * {
             *  pendingImport += pendingSyncImportArray[i];
             * }
             * this.setSyncImport(FormatService.formatInt(totalImport - pendingImport));
             * this.setPendingImport(FormatService.formatInt(pendingImport));
             * int maxToReceive = (int) (totalImport * 0.03);
             * this.setMaxToReceive(maxToReceive == 0 ? "" : FormatService.formatInt(maxToReceive));
             */
        }
Пример #2
0
 private void updateTotalBoxes(long pGroupId)
 {
     if (pGroupId != 0)
     {
         int         totalImport   = 0;
         int         syncImport    = 0;
         int         qrImport      = 0;
         int         pendingImport = 0;
         ListService listService   = new ListService();
         // Calcular importe sincronizado con el server
         int[] syncTotalImportArray = listService.getDrawTotals(this.datePickerList.Value.Date, pGroupId);
         for (int i = 0; i < syncTotalImportArray.Length; i++)
         {
             totalImport += syncTotalImportArray[i];
         }
         this.setTotalImport(FormatService.formatInt(totalImport));
         // Calcular importe pendiente de sincronización
         //int[] pendingSyncImportArray = listService.getDrawPendingSyncTotals(this.datePickerList.Value.Date, pGroupId);
         int[] pendingSyncImportArray = listService.getTotalImportBySyncStatus(this.datePickerList.Value.Date, pGroupId, SystemConstants.SYNC_STATUS_PENDING_TO_SERVER);
         for (int i = 0; i < pendingSyncImportArray.Length; i++)
         {
             pendingImport += pendingSyncImportArray[i];
         }
         // Calcular importe sincronizado vía web
         int[] syncImportArray = listService.getTotalImportBySyncStatus(this.datePickerList.Value.Date, pGroupId, SystemConstants.SYNC_STATUS_COMPLETED);
         for (int i = 0; i < syncImportArray.Length; i++)
         {
             syncImport += syncImportArray[i];
         }
         // Calcular importe sincronizado vía Código QR
         int[] qrSyncImportArray = listService.getTotalImportBySyncStatus(this.datePickerList.Value.Date, pGroupId, SystemConstants.SYNC_STATUS_QRUPDATED);
         for (int i = 0; i < qrSyncImportArray.Length; i++)
         {
             qrImport += qrSyncImportArray[i];
         }
         // Setear los controles
         //this.setSyncImport(FormatService.formatInt(totalImport - pendingImport));
         this.setSyncImport(FormatService.formatInt(syncImport));
         this.setSyncQRImport(FormatService.formatInt(qrImport));
         this.setPendingImport(FormatService.formatInt(pendingImport));
         int prohibitedFactor = Int32.Parse(ServerParameterService.getProhibitedFactor());
         int maxToReceive     = (int)(totalImport * ((double)prohibitedFactor / 100));
         this.setMaxToReceive(maxToReceive == 0 ? "" : FormatService.formatInt(maxToReceive) + " ");
     }
 }