private void btnFilter_Click(object sender, EventArgs e) { this.dataGridView1.Rows.Clear(); int count = 0; CardSearchCondition con = new CardSearchCondition(); con.CardType = comCardType.SelectedCardType; con.OwnerName = txtOwnerName.Text; con.CarPlate = txtCarPlate.Text; con.CardCertificate = txtCardCertificate.Text; _Cards = (new CardBll(AppSettings.CurrentSetting.ParkConnect)).GetCards(con).QueryObjects; _Cards = _Cards.FindAll(item => item.CardType != CardType.OperatorCard); foreach (CardInfo card in _Cards) { int row = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[row].Tag = card; this.dataGridView1.Rows[row].Cells["colCardID"].Value = card.CardID; this.dataGridView1.Rows[row].Cells["colOwnerName"].Value = card.OwnerName; this.dataGridView1.Rows[row].Cells["colCardType"].Value = card.CardType.Name; this.dataGridView1.Rows[row].Cells["colCertificate"].Value = card.CardCertificate; this.dataGridView1.Rows[row].Cells["colCarPlate"].Value = card.CarPlate; this.dataGridView1.Rows[row].Cells["colParkingStatus"].Value = ParkingStatusDescription.GetDescription(card.ParkingStatus); count++; } this.lblCount.Text = string.Format(Resources.Resource1.FrmMasterBase_StatusBar, count); }
private void AddCardRow(string cardID, byte[] parkingBytes, Color color) { DataGridViewRow selectrow = null; CardInfo card = CardDateResolver.Instance.GetCardInfoFromData(cardID, parkingBytes); foreach (DataGridViewRow row in dataGridView1.Rows) { string cardid = string.Empty; if (row.Tag is string) { cardid = row.Tag as string; } else { CardInfo into = row.Tag as CardInfo; if (into != null) { cardid = into.CardID; } } if (cardid == cardID) { SelectSingleRow(row); selectrow = row; break; } } if (selectrow == null) { int addrow = dataGridView1.Rows.Add(); selectrow = dataGridView1.Rows[addrow]; } if (card != null) { selectrow.Tag = card; selectrow.Cells["colCardID"].Value = card.CardID; selectrow.Cells["colCardType"].Value = card.CardType.Name; selectrow.Cells["colCarPlate"].Value = card.CarPlate; selectrow.Cells["colParkingStatus"].Value = ParkingStatusDescription.GetDescription(card.ParkingStatus); } else { selectrow.Tag = cardID; selectrow.Cells["colCardID"].Value = cardID; } this.dataGridView1.FirstDisplayedScrollingRowIndex = selectrow.Index; selectrow.DefaultCellStyle.ForeColor = color; }
private void btnFilterCard_Click(object sender, EventArgs e) { this.dataGridView1.Rows.Clear(); int count = 0; CardSearchCondition con = new CardSearchCondition(); con.CardType = comCardType.SelectedCardType; con.OwnerName = txtOwnerName.Text; con.CarPlate = txtCarPlate.Text; con.CardCertificate = txtCardCertificate.Text; _Cards = (new CardBll(AppSettings.CurrentSetting.ParkConnect)).GetCards(con).QueryObjects; foreach (CardInfo card in _Cards) { long cardID = 0; if (long.TryParse(card.CardID, out cardID)) { if ((rdTo34.Checked && cardID <= Math.Pow(2, 24)) || //转成韦根34时,则只显示韦根26的卡号 (rdTo26.Checked && cardID > Math.Pow(2, 24)) ////转成韦根26时,则只显示韦根34的卡号 ) { int row = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[row].Tag = card; this.dataGridView1.Rows[row].Cells["colCardID"].Value = card.CardID; this.dataGridView1.Rows[row].Cells["colOwnerName"].Value = card.OwnerName; this.dataGridView1.Rows[row].Cells["colCardType"].Value = card.CardType.Name; this.dataGridView1.Rows[row].Cells["colCertificate"].Value = card.CardCertificate; this.dataGridView1.Rows[row].Cells["colCarPlate"].Value = card.CarPlate; this.dataGridView1.Rows[row].Cells["colParkingStatus"].Value = ParkingStatusDescription.GetDescription(card.ParkingStatus); count++; } } } this.lblCount.Text = string.Format(Resources.Resource1.FrmMasterBase_StatusBar, count); }