本文整理汇总了C#中System.Contract.GetPromoted方法的典型用法代码示例。如果您正苦于以下问题:C# Contract.GetPromoted方法的具体用法?C# Contract.GetPromoted怎么用?C# Contract.GetPromoted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Contract
的用法示例。
在下文中一共展示了Contract.GetPromoted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveButtonClick
private void SaveButtonClick(object sender, RoutedEventArgs e)
{
Contract contract = new Contract();
contract.ContractNo = int.Parse(TextBoxContractNo.Text);
contract.CreationDate = DateTime.Now;
contract.Dealer = dealers[ComboBoxDealer.SelectedIndex];
contract.Customer = customers[ComboBoxCustomer.SelectedIndex];
contract.ReturnDate = ReturnDate.SelectedDate.Value;
int price;
if (int.TryParse(Advance.Text, out price))
contract.Advance = price;
else
{
MessageBox.Show("Advance price error");
return;
}
if (int.TryParse(Total.Text, out price))
contract.TotalPrice = price;
else
{
MessageBox.Show("Total price error");
return;
}
foreach (StackPanel item in ToolsGrid.Items)
{
if (item.DataContext == null) continue;
Machine rentedMachine = item.DataContext as Machine;
contract.Machines.Add(rentedMachine);
engine.MachineRepository.Update(rentedMachine);
}
foreach (StackPanel item in AccessoryGrid.Items)
{
int count;
if (item.DataContext == null || int.TryParse((item.Children[1] as TextBox).Text, out count)) continue;
Accessory rentedAccesory = new Accessory();
rentedAccesory.Name = (item.Children[0] as TextBlock).Text;
rentedAccesory.Count = count;
}
contract.GetPromoted();
engine.ContractRepository.Insert(contract);
UpdateContracts();
contract = contracts[contracts.Count - 1];
int lastContractId = engine.ContractRepository.Get(null, q => q.OrderBy(s => s.ContractNo), string.Empty).Last().ContractId;
foreach (Machine item in contract.Machines)
item.ContractId = lastContractId;
UpdateMachines();
WindowHelpers.ClearMainWindow(this,false);
TextBoxContractNo.Text = (contract.ContractNo + 1).ToString();
}