Esempio n. 1
0
        private void txtCustomerCode_Leave(object sender, EventArgs e)
        {
            string customer = txtCustomerCode.Text.Trim();

            if (!string.IsNullOrEmpty(customer))
            {
                BaseMaster baseMaster = bCommon.GetBaseMaster("CUSTOMER", customer);
                if (baseMaster != null)
                {
                    txtCustomerCode.Text = baseMaster.Code;
                    txtCustomerName.Text = baseMaster.Name;
                    txtProductCode.Focus();
                }
                else
                {
                    MessageBox.Show("客户编号不存在!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtCustomerCode.Text = "";
                    txtCustomerName.Text = "";
                    txtCustomerCode.Focus();
                }
            }
            else
            {
                txtCustomerName.Text = "";
            }
            //判断编号是否已存在
            if (!string.IsNullOrEmpty(this.txtUnitCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtCustomerCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtProductCode.Text.Trim()))
            {
                BaseCustomerPriceTable CustomerPriceCode = new BaseCustomerPriceTable();
                CustomerPriceCode = bCustomerPrice.GetModel(txtCustomerCode.Text, txtProductCode.Text, txtUnitCode.Text);
                if (CustomerPriceCode != null)
                {
                    txtCustomerCode.Text = "";
                    txtProductCode.Text  = "";
                    txtUnitCode.Text     = "";
                    txtCustomerName.Text = "";
                    txtProductName.Text  = "";
                    txtUnitName.Text     = "";
                    txtCustomerCode.Focus();
                    MessageBox.Show("客户编号商品编号单位编号的组合已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string customercode = dgvData.SelectedRows[0].Cells[0].Value.ToString();
                string productcode  = dgvData.SelectedRows[0].Cells[2].Value.ToString();
                string unitcode     = dgvData.SelectedRows[0].Cells[4].Value.ToString();

                if (customercode != "")
                {
                    _currentCustomerPriceTable = bCustomerPrice.GetModel(customercode, productcode, unitcode);
                }
            }
            catch (Exception ex) { }

            if (_currentCustomerPriceTable == null || _currentCustomerPriceTable.CUSTOMER_CODE == null || "".Equals(_currentCustomerPriceTable.CUSTOMER_CODE))
            {
                _currentCustomerPriceTable = null;
            }
        }
Esempio n. 3
0
 private bool CheckCode()
 {
     //判断编号是否已存在
     if (!string.IsNullOrEmpty(this.txtUnitCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtCustomerCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtProductCode.Text.Trim()))
     {
         BaseCustomerPriceTable CustomerPriceCode = new BaseCustomerPriceTable();
         CustomerPriceCode = bCustomerPrice.GetModel(txtCustomerCode.Text, txtProductCode.Text, txtUnitCode.Text);
         if (CustomerPriceCode != null)
         {
             txtCustomerCode.Text = "";
             txtProductCode.Text  = "";
             txtUnitCode.Text     = "";
             txtCustomerName.Text = "";
             txtProductName.Text  = "";
             txtUnitName.Text     = "";
             txtCustomerCode.Focus();
             MessageBox.Show("客户编号商品编号单位编号的组合已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return(false);
         }
     }
     return(true);
 }