private void Receive(string serial) { this.serial.Text = serial; vehicle = DeputeDao.GetBySerial(serial); if (vehicle != null) { this.setControlReadOnly(false); this.isUpdate = true; try { SetDeputeInfo(vehicle); } catch { MessageUtil.ShowWarning("发生错误!"); } this.SetOriginCustomer(vehicle.OriginCustomer); this.SetCurrentCustomer(vehicle.CurrentCustomer); } else { this.serial.Focus(); } }
/// <summary> /// 流水号失去焦点后,如果用户输入了流水号,则根据输入的流水号进行查找,否则生成流水号 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void serial_Leave(object sender, EventArgs e) { if (this.serial.ReadOnly || (this.serial.Text.Length != 11 && this.serial.Text.Length != 0)) { return; } InitComboBox(); if (Utilities.IsNullOrEmpty(this.serial.Text)) { vehicle = new Depute(); this.serial.Text = DeputeDao.GetLatestSerial(); this.setControlReadOnly(false); this.isUpdate = false; } else { vehicle = DeputeDao.GetBySerial(this.serial.Text); if (vehicle != null) { this.setControlReadOnly(false); this.isUpdate = true; SetDeputeInfo(vehicle); this.SetOriginCustomer(vehicle.OriginCustomer); this.SetCurrentCustomer(vehicle.CurrentCustomer); } else { this.serial.Focus(); } } }