示例#1
0
        private void cbClientName_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
        {
            // clear fields
            cbCompany.Text = "";
            tbClientRuc.Text = "";
            tbClientDomicile.Text = "";
            tbClientPhone.Text = "";
            tbFax.Text = "";
            gcContact.DataSource = null;

            DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit Edit;
            Edit = ((DevExpress.XtraEditors.LookUpEdit)sender).Properties;

            if (e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
                return;

            List<CCompany> ListCompanies = (List<CCompany>)cbCompany.Properties.DataSource;

            ListCompanies.Add(new CCompany { Idcompany = 0, Business_name = e.DisplayValue.ToString() });
            cbCompany.Properties.DataSource = ListCompanies;

            // --- add contacts
            Reception oReception = new BusinessLayer.Modules.Reception();
            gcContact.DataSource = new BindingList<CContact>(oReception.GetLstContactsByCompany(0));

            e.Handled = true;
        }
示例#2
0
        void RetrieveDataCompany()
        {
            // --- recuperate the clients
            if (cbCompany.EditValue != null)
            {

                if (cbCompany.EditValue.ToString().Trim() != "" && cbCompany.EditValue.ToString().Trim() != "0")
                {
                    CCompany oCompany = new CCompany();
                    CCompanyFactory faCompany = new CCompanyFactory();
                    oCompany = faCompany.GetByPrimaryKey(new CCompanyKeys(Convert.ToInt16(cbCompany.EditValue)));

                    tbClientDomicile.Text = oCompany.Domicile;
                    tbClientPhone.Text = oCompany.Phone_client;
                    tbClientRuc.Text = oCompany.Ruc;

                    // --- get/show contacts
                    Reception oReception = new BusinessLayer.Modules.Reception();
                    gcContact.DataSource = new BindingList<CContact>(oReception.GetLstContactsByCompany(oCompany.Idcompany));
                }

                // --- get/show attached files
                Show_exist_files();
            }
        }