Exemple #1
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                VIPInfo   vipModel   = new VIPInfo();
                VipNoInfo vipNoModel = new VipNoInfo();
                if (vipBorrowList.Count == 0 && vipNoBorrowList.Count == 0)
                {
                    btnSearch.Enabled    = true;
                    progressBar1.Visible = false;
                    lvBorrow.Items.Clear();
                    label1.Text = "0辆";
                    MessageBox.Show("未查询到相应数据!");
                    return;
                }
                double sum = 0;
                lvBorrow.Items.Clear();
                VipBorrowInfo vipBorrowTemp;
                if (vipModel == null)
                {
                    vipModel = new VIPInfo();
                }
                for (int i = 0; i < vipBorrowList.Count; i++)
                {
                    try
                    {
                        vipBorrowTemp = vipBorrowList[i];
                        lvBorrow.Items.Add("");
                        lvBorrow.Items[i].ForeColor = Color.BlueViolet;
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].SubItems.Add("");
                        lvBorrow.Items[i].Tag = vipBorrowTemp;
                        vipModel.VipId        = vipBorrowTemp.VipId;
                        vipModel = vipBLL.VipSelectById_MainPage(vipModel);
                        if (vipModel == null)
                        {
                            vipModel.VipId = vipBorrowTemp.VipId;
                            vipModel       = vipBLL.VipSelectById_MainPage(vipModel);
                        }
                        lvBorrow.Items[i].SubItems[0].Text = vipModel.VipNumber;
                        lvBorrow.Items[i].SubItems[1].Text = vipModel.VipName;
                        lvBorrow.Items[i].SubItems[2].Text = borrowKind[vipBorrowTemp.RkrId];
                        lvBorrow.Items[i].SubItems[3].Text = vipBorrowTemp.BbkTime.ToString();
                        lvBorrow.Items[i].SubItems[4].Text = vipBorrowTemp.BbkNumber.ToString();
                        lvBorrow.Items[i].SubItems[5].Text = vipBorrowTemp.LeftNum.ToString();
                        lvBorrow.Items[i].SubItems[6].Text = vipModel.VipPhone.ToString();
                        lvBorrow.Items[i].SubItems[7].Text = vipModel.VipAddress;
                        lvBorrow.Items[i].SubItems[8].Text = vipBorrowTemp.Mark;
                        if (vipBorrowTemp.IsNight)
                        {
                            lvBorrow.Items[i].SubItems[9].Text = "是";
                        }
                        else
                        {
                            lvBorrow.Items[i].SubItems[9].Text = "否";
                        }
                        sum += vipBorrowTemp.LeftNum;
                    }
                    catch (Exception)
                    {
                    }
                }
                VipNoBorrow vipNoBorrowTemp;
                if (vipNoModel == null)
                {
                    vipNoModel = new VipNoInfo();
                }
                for (int i = 0; i < vipNoBorrowList.Count; i++)
                {
                    try
                    {
                        vipNoBorrowTemp = vipNoBorrowList[i];
                        lvBorrow.Items.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].ForeColor = Color.Red;
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems.Add("");
                        lvBorrow.Items[i + vipBorrowList.Count].Tag = vipNoBorrowTemp;
                        vipNoModel.VipId = vipNoBorrowTemp.VipId;
                        vipNoModel       = vipNoBLL.VipNoSelectByVIPNoId(vipNoModel);
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems[0].Text = vipNoModel.VipNumber;
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems[1].Text = vipNoBorrowTemp.VnName;
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems[2].Text = borrowKind[vipNoBorrowTemp.RkrId];
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems[3].Text = vipNoBorrowTemp.BbkTime.ToString();
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems[4].Text = vipNoBorrowTemp.VnNumber.ToString();
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems[5].Text = vipNoBorrowTemp.LeftNum.ToString();
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems[6].Text = vipNoBorrowTemp.VnPhone.ToString();
                        lvBorrow.Items[i + vipBorrowList.Count].SubItems[8].Text = vipNoBorrowTemp.Mark;
                        if (vipNoBorrowTemp.IsNight)
                        {
                            lvBorrow.Items[i + vipBorrowList.Count].SubItems[9].Text = "是";
                        }
                        else
                        {
                            lvBorrow.Items[i + vipBorrowList.Count].SubItems[9].Text = "否";
                        }
                        sum += vipNoBorrowTemp.LeftNum;
                    }
                    catch (Exception)
                    {
                    }
                }
                label1.Text = sum.ToString() + "辆";
            }
            catch (Exception)
            {
            }

            btnSearch.Enabled    = true;
            progressBar1.Visible = false;
        }