예제 #1
0
 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;
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string warehousecode = dgvData.SelectedRows[0].Cells["WAREHOUSE_CODE"].Value.ToString();
                string productcode   = dgvData.SelectedRows[0].Cells["PRODUCT_CODE"].Value.ToString();
                if (warehousecode != "" && productcode != "")
                {
                    _currentSafetyStockTable = bSafetyStock.GetModel(warehousecode, productcode);
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("获取对象失败!");
            }

            if (_currentSafetyStockTable == null || _currentSafetyStockTable.WAREHOUSE_CODE == null || "".Equals(_currentSafetyStockTable.WAREHOUSE_CODE))
            {
                _currentSafetyStockTable = null;
            }
        }