private void RefreshPayout(string DataString) { isBusy.Visible = true; DelegateReadPrivatePayout dn = MysqlControl.ReadPrivatePayout; IAsyncResult iar = dn.BeginInvoke(DataString, null, null); while (iar.IsCompleted == false) { Application.DoEvents(); } MysqlController.Payout[] tempPayout = dn.EndInvoke(iar); lsvPayout.Items.Clear(); if (tempPayout == null) { return; } if (tempPayout.Length <= 0) { return; } double MergeInt = 0; for (int i = 0; i < tempPayout.Length; i++) { if (string.IsNullOrEmpty(tempPayout[i].PayoutDate)) { continue; } lsvPayout.Items.Add(tempPayout[i].PayoutDate); lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutName); lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutPrice); MergeInt = Math.Round(MergeInt + double.Parse(tempPayout[i].PayoutPrice), 2); /* * 现金 * 信用卡 * 收入 */ switch (tempPayout[i].PayoutType) { case "0": lsvPayout.Items[i].SubItems.Add("现金"); break; case "1": lsvPayout.Items[i].SubItems.Add("信用卡"); break; case "2": lsvPayout.Items[i].SubItems.Add("收入"); break; } lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutBackup); lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutID.ToString()); Application.DoEvents(); } txtMerge.Text = MergeInt + "元"; isBusy.Visible = false; }
private void RefreshPayout() { isBusy.Visible = true; DelegateReadPrivatePayout dn = MysqlControl.ReadPrivatePayout; IAsyncResult iar = dn.BeginInvoke(dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') + dtpTime.Value.Day.ToString().PadLeft(2, '0'), null, null); while (iar.IsCompleted == false) { Application.DoEvents(); } MysqlController.Payout[] tempPayout = dn.EndInvoke(iar); lsvPayout.Items.Clear(); if (tempPayout == null) { return; } if (tempPayout.Length > 0) { for (int i = 0; i < tempPayout.Length; i++) { if (string.IsNullOrEmpty(tempPayout[i].PayoutDate)) { continue; } lsvPayout.Items.Add(tempPayout[i].PayoutDate); lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutName); lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutPrice); /* * 现金 * 信用卡 * 收入 */ switch (tempPayout[i].PayoutType) { case "0": lsvPayout.Items[i].SubItems.Add("现金"); break; case "1": lsvPayout.Items[i].SubItems.Add("信用卡"); break; case "2": lsvPayout.Items[i].SubItems.Add("收入"); break; } lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutBackup); lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutID.ToString()); lsvPayout.Items[i].SubItems.Add(tempPayout[i].PayoutInCase ? "是" : "否"); Application.DoEvents(); } } isBusy.Visible = false; }