Ejemplo n.º 1
0
        private void txtSupplierCode_Leave(object sender, EventArgs e)
        {
            //判断编号是否已存在
            if (!string.IsNullOrEmpty(this.txtSupplierCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtProductCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtUnitCode.Text.Trim()))
            {
                BaseSupplierPriceTable SupplierPriceCode = new BaseSupplierPriceTable();
                SupplierPriceCode = bSupplierPrice.GetModel(txtSupplierCode.Text, txtProductCode.Text, txtUnitCode.Text, CConstant.EXCHANGE_RMB);
                if (SupplierPriceCode != null)
                {
                    txtSupplierCode.Text = "";
                    txtSupplierName.Text = "";
                    txtProductCode.Text  = "";
                    txtProductName.Text  = "";
                    txtUnitCode.Text     = "";
                    txtUnitName.Text     = "";
                    txtSupplierCode.Focus();
                    MessageBox.Show("供应商编号商品编号单位编号货币编号的组合\r\n已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            string supplier = txtSupplierCode.Text.Trim();

            if (!string.IsNullOrEmpty(supplier))
            {
                BaseMaster baseMaster = bCommon.GetBaseMaster("SUPPLIER", supplier);
                if (baseMaster != null)
                {
                    txtSupplierCode.Text = baseMaster.Code;
                    txtSupplierName.Text = baseMaster.Name;
                    txtProductCode.Focus();
                }
                else
                {
                    MessageBox.Show("供应商编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtSupplierCode.Text = "";
                    txtSupplierName.Text = "";
                    txtSupplierCode.Focus();
                }
            }
            else
            {
                txtSupplierName.Text = "";
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string suppliercode = dgvData.SelectedRows[0].Cells["SUPPLIER_CODE"].Value.ToString();
                string productcode  = dgvData.SelectedRows[0].Cells["PRODUCT_CODE"].Value.ToString();
                string unitcode     = dgvData.SelectedRows[0].Cells["UNIT_CODE"].Value.ToString();

                if (suppliercode != "")
                {
                    _currentSupplierPriceTable = bSupplierPrice.GetModel(suppliercode, productcode, unitcode, CConstant.EXCHANGE_CHIAN);
                }
            }
            catch (Exception ex) { }

            if (_currentSupplierPriceTable == null || _currentSupplierPriceTable.SUPPLIER_CODE == null || "".Equals(_currentSupplierPriceTable.SUPPLIER_CODE))
            {
                _currentSupplierPriceTable = null;
            }
        }
Ejemplo n.º 3
0
 private bool CheckCode()
 {
     //判断编号是否已存在
     if (!string.IsNullOrEmpty(this.txtSupplierCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtProductCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtUnitCode.Text.Trim()))
     {
         BaseSupplierPriceTable SupplierPriceCode = new BaseSupplierPriceTable();
         SupplierPriceCode = bSupplierPrice.GetModel(txtSupplierCode.Text, txtProductCode.Text, txtUnitCode.Text, CConstant.EXCHANGE_CHIAN);
         if (SupplierPriceCode != null)
         {
             txtSupplierCode.Text = "";
             txtSupplierName.Text = "";
             txtProductCode.Text  = "";
             txtProductName.Text  = "";
             txtUnitCode.Text     = "";
             txtUnitName.Text     = "";
             txtSupplierCode.Focus();
             MessageBox.Show("供应商编号商品编号单位编号货币编号的组合\r\n已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return(false);
         }
     }
     return(true);
 }