private void Button_Click(object sender, RoutedEventArgs e) { if (null == Sport) { Sport = new DBModels.SportLottery { IncomingDate = dpIncoming.SelectedDate, SportLotteryGameType = cboGameType.SelectedItem as SportLotteryGameType, IsInstall = cbIsInstalled.IsChecked.Value, SportLotteryHostName = txtHostName.Text, PhoneNumber = txtPhone.Text, LotteryCode = txtCode.Text, Relation = cboRelation.Text }; } else { Sport.IncomingDate = dpIncoming.SelectedDate; Sport.SportLotteryGameType = cboGameType.SelectedItem as SportLotteryGameType; Sport.IsInstall = cbIsInstalled.IsChecked.Value; Sport.SportLotteryHostName = txtHostName.Text; Sport.PhoneNumber = txtPhone.Text; Sport.LotteryCode = txtCode.Text; Sport.Relation = cboRelation.Text; } DialogResult = true; }
public SportLottery(DBModels.SportLottery lottery) : this() { Sport = lottery; dpIncoming.SelectedDate = lottery.IncomingDate; cboGameType.SelectedItem = lottery.SportLotteryGameType; cbIsInstalled.IsChecked = lottery.IsInstall; txtHostName.Text = lottery.SportLotteryHostName; txtPhone.Text = lottery.PhoneNumber; txtCode.Text = lottery.LotteryCode; cboRelation.Text = lottery.Relation; }