private void DoSearch() { //User billsMaker = (User)this.cmbMaker.SelectedItem; User billsMaker = PermissionService.GetCurrentUser(); DateTime fromDate = new DateTime(this.dtpFrom.Value.Year, this.dtpFrom.Value.Month, this.dtpFrom.Value.Day, 0, 0, 0, 0); DateTime toDate = new DateTime(this.dtpTo.Value.Year, this.dtpTo.Value.Month, this.dtpTo.Value.Day, 23, 59, 59, 998); string billsID = txtID.Text.Trim(); StockBillService stockBillService = new StockBillService(); List <Bills> billsList = stockBillService.SearchBill(fromDate, toDate, null, null, null, null, null, billsMaker, billsID, this.BillsType); //fil billsList to dgvBilsList this.dgvBillsList.Rows.Clear(); foreach (Bills bill in billsList) { if (!bill.Actived || bill.IsCancelOut || bill.IsRedBill) { continue; } DataGridViewRow row = new DataGridViewRow(); row.Tag = bill; DataGridViewCell cell = null; cell = new DataGridViewCheckBoxCell(); row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.ID.ToString(); row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Code; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Maker; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.MakeDate.ToString("yyyy-MM-dd HH:mm:ss"); row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Company.Name; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Storehouse.Name; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.TotalMoney; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Remark + (bill.Actived == false ? "已作废" : ""); row.Cells.Add(cell); dgvBillsList.Rows.Add(row); } }
public void DoSearch() { string maker = this.MakerConditionVisible ? txtMaker.Text.Trim() : PermissionService.GetCurrentUser().Name; DateTime fromDate = new DateTime(dtpFrom.Value.Year, dtpFrom.Value.Month, dtpFrom.Value.Day, 0, 0, 0, 0); DateTime toDate = new DateTime(dtpTo.Value.Year, dtpTo.Value.Month, dtpTo.Value.Day, 23, 59, 59, 998); StockBillService service = new StockBillService(); List <StockBill> bills = service.SearchBill( fromDate, toDate, null, maker, txtID.Text.Trim(), this.BillType); //Fill Bills into datagridview control this.dgvBillList.Rows.Clear(); foreach (StockBill bill in bills) { if (!bill.Actived || bill.IsCancelOut || bill.IsRedBill) { continue; } DataGridViewRow row = new DataGridViewRow(); row.Tag = bill; DataGridViewCell cell = null; cell = new DataGridViewCheckBoxCell(); row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.ID.ToString(); row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Maker; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.MakeDate.ToString("yyyy-MM-dd HH:mm:ss"); row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Storehouse.Name; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Company.Name; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.TotalMoney; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = bill.Remark + (bill.Actived == false ? "已作废" : ""); row.Cells.Add(cell); dgvBillList.Rows.Add(row); } }