private void BindPayMent() { IList <PaymentMethod> payList = new List <PaymentMethod>(); string msg = string.Empty; payList = PharmacyDatabaseService.AllPaymentMethods(out msg); var drugInventorys = PharmacyDatabaseService.GetDrugInventoryRecordBySalesOrderId(_salesOrderId, out msg); bool IsSpecialDrug = drugInventorys.Where(r => r.DrugInfo.IsSpecialDrugCategory).Count() > 0; if (IsSpecialDrug) { MessageBox.Show("当前订单含有特殊药品,不能采用现金支付方式!"); payList = payList.Where(r => !r.Name.Contains("现金")).ToList(); } cmbPayMethod.DataSource = payList; cmbPayMethod.DisplayMember = "Name"; cmbPayMethod.ValueMember = "ID"; if (!IsSpecialDrug) { cmbPayMethod.SelectedItem = payList.Where(r => r.Name.Contains("现金")).FirstOrDefault(); } }
private void InitData() { string msg = string.Empty; PaymentMethod[] list = PharmacyDatabaseService.AllPaymentMethods(out msg); this.comboBox1.DataSource = list; this.comboBox1.DisplayMember = "Name"; this.comboBox1.ValueMember = "Id"; this.comboBox1.SelectedIndex = 0; List <ComboxItem> returnItems = new List <ComboxItem>(); returnItems.Add(new ComboxItem(EnumHelper <DealerMethod> .GetDisplayValue(DealerMethod.PurchaseInInventory), (int)DealerMethod.PurchaseInInventory)); returnItems.Add(new ComboxItem(EnumHelper <DealerMethod> .GetDisplayValue(DealerMethod.PurchaseReturn), (int)DealerMethod.PurchaseReturn)); DealerMethodValue.DataSource = returnItems; DealerMethodValue.DisplayMember = "Name"; DealerMethodValue.ValueMember = "Value"; }