Example #1
0
        private void txtCustomer_Leave(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtCustomer.Text.Trim()) && !string.IsNullOrEmpty(this.txtReported.Text.Trim()))
            {
                BaseCustomerReportedTable CustomerReportedCode = new BaseCustomerReportedTable();
                CustomerReportedCode = bCustomerReported.GetModel(txtCustomer.Text, txtReported.Text);
                if (CustomerReportedCode != null)
                {
                    txtCustomer.Text = "";
                    txtReported.Text = "";
                    txtCustomer.Focus();
                    MessageBox.Show("代理店与报备名称已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            //if (!string.IsNullOrEmpty(txtCustomer.Text.Trim()))
            //{
            //    BaseMaster baseMaster = bCommon.GetBaseMaster("CUSTOMER", txtCustomer.Text.Trim());
            //    if (baseMaster != null)
            //    {
            //        txtCustomer.Text = baseMaster.Code;
            //        txtCustomerName.Text = baseMaster.Name;
            //    }
            //    else
            //    {
            //        MessageBox.Show("代理店不存在.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //        txtCustomer.Text = "";
            //        txtCustomerName.Text = "";
            //        txtCustomer.Focus();
            //    }
            //}
            //else
            //{
            //    txtCustomerName.Text = "";
            //}

            string customerCode = txtCustomer.Text.Trim();

            if (customerCode != "")
            {
                BaseMaster baseMaster = bCommon.GetBaseMaster("CUSTOMER", customerCode, "TYPE = 1");
                if (baseMaster != null)
                {
                    txtCustomer.Text     = baseMaster.Code;
                    txtCustomerName.Text = baseMaster.Name;
                }
                else
                {
                    MessageBox.Show("代理店不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtCustomer.Text     = "";
                    txtCustomerName.Text = "";
                    txtCustomer.Focus();
                }
            }
            else
            {
                txtCustomerName.Text = "";
            }
        }
Example #2
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string ccode = dgvData.SelectedRows[0].Cells[0].Value.ToString();
                string rcode = dgvData.SelectedRows[0].Cells[2].Value.ToString();
                if (ccode != "" && rcode != "")
                {
                    _currentCustomerReportedTable = bCustomerReported.GetModel(ccode, rcode);
                }
            }
            catch (Exception ex) { }

            if (_currentCustomerReportedTable == null || _currentCustomerReportedTable.CUSTOMER_CODE == null || "".Equals(_currentCustomerReportedTable.CUSTOMER_CODE))
            {
                _currentCustomerReportedTable = null;
            }
        }