public CreditListTag() { if (creditList == null) { creditList = new CreditList(); } }
public CreditListTag(string value) : base(value) { if (creditList == null) { creditList = new CreditList(); } }
public IEnumerable <string> GetMediums(string credit) { if (creditList == null) { creditList = new CreditList(); } return(creditList.GetMediums(credit)); }
public void AddValue(string credit, string medium) { if (creditList == null) { creditList = new CreditList(); } creditList.Add(credit, medium); }
public IEnumerable <string> GetCredits() { if (creditList == null) { creditList = new CreditList(); } return(creditList.Select(c => c.Credit)); }
/// <summary> /// Окно кредитов для выбранного клиента /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnShowCredits_Click(object sender, RoutedEventArgs e) { if (lvClients.SelectedValue != null) { CreditList creditList = new CreditList(new SelectionArgs((this.lvClients.SelectedItem as Clients).Id, Type.Client, false)); creditList.Show(); } else { MessageBox.Show("Начала выдилите клиента"); } }
private CreditList CreateCreditList(bool addCredits = true) { AddData(addCredits); var result = new CreditList { Session = Session }; ParentList = (result.CreateParentList() as PieceList) !; ParentList.ChildListType = result.GetType(); result.ParentList = ParentList; return(result); }
public static bool TryParse(string s, out CreditList result) { try { result = ParseCreditList(s); return(true); } catch { result = null; return(false); } }
public override void SetValue(string value) { if (creditList == null) { creditList = new CreditList(); } if (ADIFCreditList.TryParse(value, out CreditList list)) { foreach (var item in list) { creditList.Add(item); } base.SetValue(value); } }
public override void ClearValue() { creditList = new CreditList(); base.ClearValue(); }
/// <summary> /// /// </summary> /// <param name="s"></param> static CreditList ParseCreditList(string s) { if (s == null) { return(null); } // example string: IOTA,WAS:LOTW&CARD,DXCC:CARD var list = new CreditList(); // split by comma first var split = s.Split(Values.COMMA); foreach (var val in split) { // if a colon is present, split again if (val.Contains(Values.COLON)) { var creditQslSplit = val.Split(Values.COLON); if (creditQslSplit == null || creditQslSplit.Length != 2) { throw new Exception("Error in CreditList value."); } // now try to split by ampersand if (creditQslSplit[1].Contains(Values.AMPERSAND)) { var mediumSplit = creditQslSplit[1].Split(Values.AMPERSAND); if (mediumSplit == null) { mediumSplit = new string[] { } } ; foreach (var medium in mediumSplit) { if (!Values.QSLMediums.IsValid(medium)) { throw new Exception($"QSL medium '{medium}' is not valid for credit '{creditQslSplit[0]}'."); } list.Add(creditQslSplit[0], medium); } } else { // if no ampersand is present, validate against QSL medium if (!Values.QSLMediums.IsValid(creditQslSplit[1])) { throw new Exception($"QSL medium '{creditQslSplit[1]}' is not valid for credit '{creditQslSplit[0]}'."); } list.Add(creditQslSplit[0], creditQslSplit[1]); } // end ampersand check } else { // if a colon was not present, simply validate against the credit enumeration list.Add(val); } } return(list); } }