private void btnDelete_Click(object sender, RoutedEventArgs e) { LR.Entity.Royalty royalty = new LR.Entity.Royalty(); royalty.State = 400; royalty.ID = this._service.Single(item => item.ConsumeDataID == royalty.ConsumeDataID).ID; //this._service.Update(royalty.ID, royalty); this.InitListView(); }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { #region 控件列表集合 List <Control> con_list = new List <Control>() { txtStaff, txtConsumeData, txtRoyaltyType, txtPercent, txtSettleNum, cboState }; #endregion foreach (Control item in con_list) { if (item is TextBox) { if (((TextBox)item).Text == "") { Tip p = new Tip("请把信息填写完整 !"); p.ShowDialog(); return; } } if (item is ComboBox) { if (((ComboBox)item).Text == "") { Tip p = new Tip("请把信息填写完整 !"); p.ShowDialog(); return; } } } LR.Entity.Royalty royalty = new LR.Entity.Royalty(); royalty.ID = this._service.Single(item => item.ConsumeDataID == royalty.ConsumeDataID).ID; royalty.StaffID = this._staffservice.Single(item => item.Name == txtStaff.Text).ID; royalty.ConsumeDataID = Guid.Parse(txtConsumeData.Text); //TODO royalty.RoyaltyType = int.Parse(txtRoyaltyType.Text); //TODO royalty.Percent = decimal.Parse(txtPercent.Text); royalty.SettleNum = int.Parse(txtSettleNum.Text); //TODO royalty.State = int.Parse(cboState.Text); //this._service.Update(royalty.ID, royalty); this.InitListView(); }