Exemple #1
0
        private void LoadList()
        {
            listView1.Items.Clear();
            var result = service.GetList(new Customers()
            {
                IsDel = 0
            });

            if (result.Code == 0)
            {
                listView1.GridLines     = true;
                listView1.FullRowSelect = true;
                listView1.View          = View.Details;
                listView1.Scrollable    = true;
                listView1.MultiSelect   = false;
                result.Body.ForEach(x =>
                {
                    var item = new ListViewItem();
                    item.UseItemStyleForSubItems = false;
                    item.SubItems[0].Text        = "0";
                    //item.SubItems[0].ForeColor = defaultForeColor;
                    //item.SubItems[0].Font = font;
                    item.SubItems.Add(x.Id.ToString());
                    item.SubItems.Add(x.Name);
                    item.SubItems.Add(x.Phone);
                    item.SubItems.Add(x.Remarks);
                    listView1.Items.Add(item);
                });
            }
        }
Exemple #2
0
        public static void BindCustomers(ComboBox comBox)
        {
            comBox.DropDownStyle = ComboBoxStyle.DropDownList;
            CustomerImpl services = new CustomerImpl();
            var          result   = services.GetList(new Model.Customers()
            {
                IsDel = 0
            });

            if (result.Code == 0)
            {
                result.Body.Insert(0, new Model.Customers()
                {
                    Id = 0, Name = "请选择客户"
                });
                comBox.DataSource    = result.Body;
                comBox.DisplayMember = "Name";
                comBox.ValueMember   = "Id";
            }
        }