private void txtDepartualCode_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtDepartualCode.Text.Trim())) { BaseWarehouseTable Warehouse = new BaseWarehouseTable(); BWarehouse bWarehouse = new BWarehouse(); Warehouse = bWarehouse.GetModel(this.txtDepartualCode.Text); if (Warehouse == null || "".Equals(Warehouse)) { txtDepartualCode.Focus(); txtDepartualCode.Text = ""; txtDepartualName.Text = ""; MessageBox.Show("仓库编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { txtDepartualCode.Text = Warehouse.CODE; txtDepartualName.Text = Warehouse.NAME; } } else { txtDepartualName.Text = ""; } }
private void txtWarehouseCode_Leave(object sender, EventArgs e) { //判断编号是否已存在 if (!string.IsNullOrEmpty(this.txtWarehouseCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtProductCode.Text.Trim())) { BaseSafetyStockTable SafetyCode = new BaseSafetyStockTable(); SafetyCode = bSafetyStock.GetModel(txtWarehouseCode.Text, txtProductCode.Text); if (SafetyCode != null) { txtWarehouseCode.Text = ""; txtWarehouseName.Text = ""; txtProductCode.Text = ""; txtProductName.Text = ""; txtWarehouseCode.Focus(); MessageBox.Show("仓库编号与商品编号的组合已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (!string.IsNullOrEmpty(this.txtWarehouseCode.Text.Trim())) { BaseWarehouseTable Warehouse = new BaseWarehouseTable(); BWarehouse bWarehouse = new BWarehouse(); Warehouse = bWarehouse.GetModel(this.txtWarehouseCode.Text); if (Warehouse == null || "".Equals(Warehouse)) { txtWarehouseCode.Focus(); txtWarehouseCode.Text = ""; txtWarehouseName.Text = ""; MessageBox.Show("仓库编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { txtWarehouseName.Text = Warehouse.NAME; } } }
private void txtCode_Leave(object sender, EventArgs e) { //判断编号是否已存在 if (!string.IsNullOrEmpty(this.txtCode.Text.Trim())) { BaseWarehouseTable WarehouseCode = new BaseWarehouseTable(); WarehouseCode = bWarehouse.GetModel(txtCode.Text); if (WarehouseCode != null) { txtCode.Focus(); txtCode.Text = ""; MessageBox.Show("编号已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
/// <summary> /// 获得当前选中的数据 /// </summary> private void GetCurrentSelectedTable() { try { string code = dgvData.SelectedRows[0].Cells[0].Value.ToString(); if (code != "") { _currentWarehouseTable = bWarehouse.GetModel(code); } } catch (Exception ex) { } if (_currentWarehouseTable == null || _currentWarehouseTable.CODE == null || "".Equals(_currentWarehouseTable.CODE)) { _currentWarehouseTable = null; } }