Ejemplo n.º 1
0
 private void selectTargetAccount_OnAccountSelected(Account account)
 {
     ObjectList<AccountService> accountServices = account.GetAccountServices(true);
     if (accountServices != null)
     {
         this.bsTargetAccountServices.set_DataSource(accountServices);
         foreach (AccountService service in accountServices)
         {
             service.PaidSumm = 0M;
         }
         foreach (Jn jn in this.bsGroupOperationServices.get_DataSource() as ObjectList<Jn>)
         {
             bool flag = false;
             foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvTargetAccountServices.Rows)
             {
                 if ((jn.ServiceTypeId == System.Convert.ToInt64(row.Cells.get_Item("ServiceTypeId").get_Value())) && ((((System.DateTime) row.Cells.get_Item("ToDate").get_Value()) == System.DateTime.MinValue) || (((System.DateTime) row.Cells.get_Item("ToDate").get_Value()) > System.DateTime.Now)))
                 {
                     AccountService service2 = row.get_DataBoundItem() as AccountService;
                     if (service2 != null)
                     {
                         service2.PaidSumm += jn.OriginalSumm;
                         flag = true;
                     }
                     break;
                 }
             }
             if (!flag)
             {
                 foreach (System.Windows.Forms.DataGridViewRow row2 in (System.Collections.IEnumerable) this.dgvTargetAccountServices.Rows)
                 {
                     if (jn.ServiceTypeId == System.Convert.ToInt64(row2.Cells.get_Item("ServiceTypeId").get_Value()))
                     {
                         AccountService service3 = row2.get_DataBoundItem() as AccountService;
                         if (service3 != null)
                         {
                             service3.PaidSumm += jn.OriginalSumm;
                         }
                         break;
                     }
                 }
             }
         }
         this.dgvTargetAccountServices_CellEndEdit(this.dgvTargetAccountServices, null);
     }
 }