Exemplo n.º 1
0
        private void PREBusinessesComboBox_TextChanged(object sender, EventArgs e)
        {
            listbox1.Visible = false;
            if (!this.Parent.Controls.Contains(listbox1))
            {
                this.Parent.Controls.Add(listbox1);
            }
            listbox1.Width    = this.Width;
            listbox1.Location = new System.Drawing.Point(this.Left, this.Top + this.Height);
            if (string.IsNullOrEmpty(this.Text))
            {
                return;
            }

            PreferentialReportSearchCondition con = new PreferentialReportSearchCondition();

            con.BusinessName = this.Text;
            PREBusinessesBll     bll   = new PREBusinessesBll(AppSettings.CurrentSetting.ParkConnect);
            List <PREBusinesses> items = bll.GetBusinesses(con).QueryObjects;

            if (items.Count > 0)
            {
                listbox1.DataSource    = items;
                listbox1.ValueMember   = "BusinessesID";
                listbox1.DisplayMember = "BusinessesName";
                listbox1.Visible       = true;
                listbox1.BringToFront();
            }
        }
Exemplo n.º 2
0
        protected override List <object> GetDataSource()
        {
            PreferentialReportSearchCondition con = new PreferentialReportSearchCondition();

            con.BusinessName = this.txtBusinessesName.Text.Trim();
            PREBusinessesBll busBll = new PREBusinessesBll(AppSettings.CurrentSetting.ParkConnect);

            businesses = busBll.GetBusinesses(con).QueryObjects.ToList();
            List <object> source = new List <object>();

            foreach (object o in businesses)
            {
                source.Add(o);
            }
            return(source);
        }
Exemplo n.º 3
0
        public void Init()
        {
            PREBusinessesBll     bll   = new PREBusinessesBll(AppSettings.CurrentSetting.ParkConnect);
            List <PREBusinesses> items = bll.GetAllBusinesses().QueryObjects;

            //this.DropDownStyle = ComboBoxStyle.DropDownList;
            //this.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
            //this.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;

            SetDataSource(items);

            this.TextChanged          += new EventHandler(PREBusinessesComboBox_TextChanged);
            this.SelectedIndexChanged += new EventHandler(PREBusinessesComboBox_SelectedIndexChanged);
            //listbox1.SelectedIndexChanged += new EventHandler(listbox1_SelectedIndexChanged);
            listbox1.MouseDoubleClick += new MouseEventHandler(listbox1_MouseDoubleClick);
        }
Exemplo n.º 4
0
        protected override bool DeletingItem(object item)
        {
            PREBusinessesBll bll    = new PREBusinessesBll(AppSettings.CurrentSetting.ParkConnect);
            PREBusinesses    info   = (PREBusinesses)item;
            CommandResult    result = bll.Delete(info);

            if (result.Result != ResultCode.Successful)
            {
                MessageBox.Show(result.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (DataBaseConnectionsManager.Current.StandbyConnected)
            {
                PREBusinessesBll srbll = new PREBusinessesBll(AppSettings.CurrentSetting.CurrentStandbyConnect);
                srbll.Delete(info);
            }
            return(result.Result == ResultCode.Successful);
        }