示例#1
0
        private bool checkFkn(CustomerFunc.Fakturakund[] p)
        {
            CustomerFunc.Fakturakund selFkn = new CustomerFunc.Fakturakund();

            if (p.Length == 0) // Ingen Klinik hittades
            {
                MessageBox.Show("Fakturakunden finns inte.", "Fakturakund saknas", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else if (p.Length > 1) // Fler än en kliniker hittades
            {
                int i = -1;
                Ortoped.Dialogs.frmDiagFkn oDiaFkn = new Ortoped.Dialogs.frmDiagFkn(CustomerFunc.Fakturakund.convertToFkn(p), ref i);
                oDiaFkn.ShowDialog();
                if (!oDiaFkn.selCust.Equals(""))
                    selFkn = oCust.getFakturakundByCust(oDiaFkn.selCust);

                oDiaFkn.Dispose();
            }
            else	// Endast en klinik hittades
            {
                selFkn = p[0];
            }

            if (selFkn.CustNr != null)
            {
                // Uppdatera f�lt
                txtFKN.Text = selFkn.CustNr;            // p[0].CustNr;
                txtFKN_NAM.Text = selFkn.Name;          // p[0].Name;
                cboPrislista.Text = selFkn.PriceList;   // p[0].PriceList;
                return true;
            }
            else return false;
        }
示例#2
0
        private void txtFKN_Leave(object sender, System.EventArgs e)
        {
            checkIfOrderHeadIsChanged(null, null);

            if ((txtFKN.Tag.ToString() != txtFKN.Text) && !txtFKN.Text.Trim().Equals(""))
            {
                if (txtFKN.Text.StartsWith("."))
                {
                    if (!checkFkn(oCust.getFakturakundByName(txtFKN.Text.Substring(1))))
                    {
                        txtFKN.Focus();
                        txtFKN.Text = txtFKN.Tag.ToString();
                        txtFKN.SelectAll();
                    }
                }
                else
                {
                    CustomerFunc.Fakturakund[] f = new CustomerFunc.Fakturakund[1];
                    f[0] = oCust.getFakturakundByCust(txtFKN.Text);
                    if (!checkFkn(f))
                    {
                        txtFKN.Focus();
                        txtFKN.Text = txtFKN.Tag.ToString();
                        txtFKN.SelectAll();
                    }
                }
            }
            else if (txtFKN.Text.Trim() == "")
            {
                txtFKN_NAM.Text = "";
            }
        }