public SerializableContractListItem ToXMLItem() { return(new SerializableContractListItem() { AcceptorID = AcceptorID, AssigneeID = AssigneeID, // Yes, it converts to and from, but all in the name of serialization Availability = Availability.ToString(), Buyout = Buyout, Collateral = Collateral, ContractID = ContractID, DateAccepted = DateAccepted, DateCompleted = DateCompleted, DateExpired = DateExpired, DateIssued = DateIssued, EndStationID = EndStationID, ForCorp = ForCorp, IssuerCorpID = IssuerCorpID, IssuerID = IssuerID, NumDays = NumDays, Price = Price, Reward = Reward, Status = ContractStatus.ToString(), StartStationID = StartStationID, Title = Title, Type = XMLType, Volume = Volume }); }
private void button7_Click(object sender, RoutedEventArgs e) { string index = listBox.SelectedItem.ToString(); listBox1.Items.Clear(); using (CompAndUsersEntities context = new CompAndUsersEntities()) { Companies company = context.Companies.FirstOrDefault(c => c.Name == index); label.Content = "Company ID " + company.Id; ContractStatus cs = (ContractStatus)company.ContractStatus; label2.Content = "Contract " + cs.ToString(); var users = context.Users.Where(u => u.CompanyID == company.Id); foreach (Users user in users) { listBox1.Items.Add(user.Id + " " + user.Name + " " + user.Login + " " + user.Password); } } }
/// <summary> /// Initializes a new instance of the <see cref="InvalidContractRequestException"/> class. /// </summary> /// <param name="contractNumber">Contract number.</param> /// <param name="versionNumber">Contract version number.</param> /// <param name="withdrawalType">Contract status.</param> public InvalidContractRequestException(string contractNumber, int versionNumber, ContractStatus?withdrawalType = null) : base($"Invalid contract status request. The contract withdrawal type request: {withdrawalType?.ToString()} The contract number: {contractNumber} and contract version: {versionNumber}.") { VersionNumber = versionNumber; ContractNumber = contractNumber; }
protected static string ToString(ContractStatus status) { if ((int)status <= 0) return string.Empty; return status.ToString("g").ToLower(); }