示例#1
0
        private void cmdViewBuyer_Click(object sender, EventArgs e)
        {
            try
            {
                int tempID = int.Parse(lsvPhones.SelectedItems[0].SubItems[16].Text);
                if (tempID.ToString() != "")
                {
                    DelegateReadUserByPhoneID dn = MysqlControl.ReadUserByPhoneID;

                    IAsyncResult iar = dn.BeginInvoke(lsvPhones.SelectedItems[0].SubItems[16].Text, null, null);

                    while (iar.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    MysqlController.LXUser tempUser = dn.EndInvoke(iar);

                    var iCustem = new frmEditCustem(isBusy, iLoginUser)
                    {
                        TopLevel = false, Dock = DockStyle.Fill, Parent = Parent
                    };
                    iCustem.SetCustom(tempUser);
                    iCustem.Show();
                    iCustem.BringToFront();
                    Parent.BringToFront();
                }
            }
            catch (Exception)
            {
                return;
            }
        }
示例#2
0
        private void RefreshList(IList <MysqlController.LXPhones> tempPhones)
        {
            isBusy.Visible = true;
            lsvPhones.Items.Clear();
            for (int i = 0; i < tempPhones.Count; i++)
            {
                if (string.IsNullOrEmpty(tempPhones[i].PhoneID))
                {
                    continue;
                }

                var iItem = new ListViewItem(tempPhones[i].PhoneDate);
                iItem.SubItems.Add(tempBrand[int.Parse(tempPhones[i].PhoneBrand)]);
                iItem.SubItems.Add(tempPhones[i].PhoneName);
                iItem.SubItems.Add(tempPhones[i].PhoneIMEI);
                iItem.SubItems.Add(tempPhones[i].PhonePrice);
                iItem.SubItems.Add(tempPhones[i].PhoneRealPrice);
                iItem.SubItems.Add(tempPhones[i].PhoneHasEquip ? "有" : "无");
                iItem.SubItems.Add(tempSeller[int.Parse(tempPhones[i].PhoneSeller)]);
                iItem.SubItems.Add(tempPhones[i].PhoneHasWarranty ? "有" : "无");
                switch (tempPhones[i].PhoneWarrantyType)
                {
                case "0":
                    iItem.SubItems.Add("软件保修");
                    break;

                case "1":
                    iItem.SubItems.Add("软硬全保");
                    break;

                case "2":
                    iItem.SubItems.Add("延长保修");
                    break;

                case "3":
                    iItem.SubItems.Add("无敌保修");
                    break;
                }
                switch (tempPhones[i].PhoneWarrantyDuration)
                {
                case "0":
                    iItem.SubItems.Add("一年");
                    break;

                case "1":
                    iItem.SubItems.Add("两年");
                    break;

                case "2":
                    iItem.SubItems.Add("三年");
                    break;

                case "3":
                    iItem.SubItems.Add("终身");
                    break;
                }
                iItem.SubItems.Add(tempPhones[i].PhoneIsDelete ? "有" : "无");
                iItem.SubItems.Add(tempPhones[i].phone_supplier);
                iItem.SubItems.Add(tempPhones[i].PhoneEquipPrice);
                iItem.SubItems.Add(tempPhones[i].PhoneEquipRealPrice);
                iItem.SubItems.Add(tempPhones[i].PhoneIsLegal ? "有" : "无");
                iItem.SubItems.Add(tempPhones[i].PhoneID);
                //DelegateReadUserByPhoneID
                DelegateReadUserByPhoneID dn = MysqlControl.ReadUserByPhoneID;

                IAsyncResult iar = dn.BeginInvoke(tempPhones[i].PhoneID, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.LXUser iUser = dn.EndInvoke(iar);

                try
                {
                    iItem.SubItems.Add(iUser.UserCName);
                }
                catch (Exception)
                {
                    iItem.SubItems.Add("");
                }
                try
                {
                    iItem.SubItems.Add(iUser.Phone);
                }
                catch (Exception)
                {
                    iItem.SubItems.Add("");
                }
                try
                {
                    iItem.SubItems.Add(iUser.BXKid);
                }
                catch (Exception)
                {
                    iItem.SubItems.Add("");
                }

                lsvPhones.Items.Add(iItem);
                Application.DoEvents();
            }
            isBusy.Visible = false;
        }