public ConsumeDataControl( LR.Services.IConsumeDataService service, LR.Services.IStaffService _sService, LR.Services.IRoomService _rService) { this._service = service; InitializeComponent(); InitData(); this.cbxRoom.ItemsSource = _rService.List().Select(p => new { name = p.Name, id = p.ID }); this.cbxRoom.DisplayMemberPath = "name"; this.cbxRoom.SelectedValuePath = "id"; this.cbxRoom.SelectedIndex = 0; this.cbxStaff.ItemsSource = _sService.List().Select(p => new { name = p.Name, id = p.ID }); this.cbxStaff.DisplayMemberPath = "name"; this.cbxStaff.SelectedValuePath = "id"; this.cbxStaff.SelectedIndex = 0; this.btns.OnReset += Btns_OnAdd; this.btns.OnDelete += Btns_OnDelete;; this.btns.OnSave += Btns_OnSave;; this.ucPager.FirstPage += UcPager_FirstPage; this.ucPager.LastPage += UcPager_LastPage; this.ucPager.PreviousPage += UcPager_PreviousPage; this.ucPager.NextPage += UcPager_NextPage; }
public RoyaltyControl(LR.Services.IRoyaltyService service, LR.Services.IStaffService staffservice) { InitializeComponent(); this._service = service; this._staffservice = staffservice; List <RoyaltyState> stateSource = new List <RoyaltyState>() { new RoyaltyState() { Name = LR.Services.Extends.GetName(LR.Entity.Royalty.RoyaltyState.Normal), ID = 0, Value = (int)LR.Entity.Royalty.RoyaltyState.Normal }, new RoyaltyState() { Name = LR.Services.Extends.GetName(LR.Entity.Royalty.RoyaltyState.Abandon), ID = 1, Value = (int)LR.Entity.Royalty.RoyaltyState.Abandon } }; cboState.ItemsSource = stateSource; cboState.DisplayMemberPath = "Name"; cboState.SelectedValuePath = "Value"; cboState.SelectedIndex = 0; this.Loaded += StaffControl_Loaded; }