private void RestoreBackups() { _strFirstName = _strFirstName_orig; _strMiddleName = _strMiddleName_orig; _strLastName = _strLastName_orig; _strAKA = _strAKA_orig; _strSSN = _strSSN_orig; _birthDate = _birthDate_orig; _strDriversLicense = _strDriversLicense_orig; _strStreet1 = _strStreet1_orig; _strStreet2 = _strStreet2_orig; _strCity = _strCity_orig; StateID = _intStateId_orig; _strZip = _strZip_orig; _strPhoneHome = _strPhoneHome_orig; _strPhoneMobile = _strPhoneMobile_orig; _HasProbationOfficer = _HasProbationOfficer_orig; _strProbationOfficer = _strProbationOfficer_orig; _BarredUntilDate = _BarredUntilDate_orig; _strNotes = _strNotes_orig; _IsActive = _IsActive_orig; _Employers = (_Employers_orig == null) ? null : _Employers_orig.Clone(); _Plans = (_Plans_orig == null) ? null : _Plans_orig.Clone(); }
private void SaveBackups() { _strFirstName_orig = _strFirstName; _strMiddleName_orig = _strMiddleName; _strLastName_orig = _strLastName; _strAKA_orig = _strAKA; _strSSN_orig = _strSSN; _birthDate_orig = _birthDate; _strDriversLicense_orig = _strDriversLicense; _strStreet1_orig = _strStreet1; _strStreet2_orig = _strStreet2; _strCity_orig = _strCity; _intStateId_orig = _intStateId; _strZip_orig = _strZip; _strPhoneHome_orig = _strPhoneHome; _strPhoneMobile_orig = _strPhoneMobile; _HasProbationOfficer_orig = _HasProbationOfficer; _strProbationOfficer_orig = _strProbationOfficer; _BarredUntilDate_orig = _BarredUntilDate; _strNotes_orig = _strNotes; _IsActive_orig = _IsActive; _Employers_orig = (_Employers == null) ? null : _Employers.Clone(); _Plans_orig = (_Plans == null) ? null : _Plans.Clone(); }
private void InitializeProperties() { _strFirstName_orig = _strFirstName = string.Empty; _strMiddleName_orig = _strMiddleName = string.Empty; _strLastName_orig = _strLastName = string.Empty; _strAKA_orig = _strAKA = string.Empty; _strSSN_orig = _strSSN = string.Empty; _birthDate_orig = _birthDate = null; _strDriversLicense_orig = _strDriversLicense = string.Empty; _strStreet1_orig = _strStreet1 = string.Empty; _strStreet2_orig = _strStreet2 = string.Empty; _strCity_orig = _strCity = "Council Bluffs"; _intStateId_orig = _intStateId = 12; _strStateName = "IA"; _strZip_orig = _strZip = string.Empty; _strPhoneHome_orig = _strPhoneHome = string.Empty; _strPhoneMobile_orig = _strPhoneMobile = string.Empty; _HasProbationOfficer_orig = _HasProbationOfficer = false; _strProbationOfficer_orig = _strProbationOfficer = string.Empty; _BarredUntilDate_orig = _BarredUntilDate = null; _strNotes_orig = _strNotes = string.Empty; _IsActive_orig = _IsActive = true; _Employers_orig = null; _Employers = null; _Plans_orig = null; _Plans = null; }
public EmployersDefendant Clone() { EmployersDefendant emps = new EmployersDefendant(); emps.IsLoading = true; foreach (EmployerDefendant emp in this) { emps.Add(emp.Clone()); } emps.IsLoading = false; return(emps); }
internal void ApplyFilter(SingleFilterInfo filterParts) { List <T> results; // Check to see if the property type we are filtering by implements the IComparable interface. Type interfaceType = TypeDescriptor.GetProperties(typeof(T))[filterParts.PropName].PropertyType.GetInterface("IComparable"); if (interfaceType == null) { throw new InvalidOperationException("Filtered property must implement IComparable."); } results = new List <T>(); // Check each value and add to the results list. foreach (T item in this) { if (filterParts.PropDesc.GetValue(item) != null) { IComparable compareValue; if (filterParts.PropName == "Employers") { // probably need to find the exact employer here. and then implement icomparabel on that particular employer compareValue = (IComparable)filterParts.PropDesc.GetValue(item); EmployersDefendant emps = (EmployersDefendant)filterParts.PropDesc.GetValue(item); foreach (EmployerDefendant emp in emps) { if (string.IsNullOrEmpty(emp.SeparationDate)) { if (emp.EmployerName.StartsWith(filterParts.CompareValue.ToString(), StringComparison.CurrentCultureIgnoreCase)) { results.Add(item); break; } } } } else { compareValue = (IComparable)filterParts.PropDesc.GetValue(item); // like operator works differently than the >, < and = operators, so handle it by itself. if (filterParts.OperatorValue == FilterOperator.Like) { if (compareValue.ToString().StartsWith(filterParts.CompareValue.ToString(), StringComparison.CurrentCultureIgnoreCase)) { results.Add(item); } } else { int result = compareValue.CompareTo(filterParts.CompareValue); if (filterParts.OperatorValue == FilterOperator.EqualTo && result == 0) { results.Add(item); } else if (filterParts.OperatorValue == FilterOperator.GreaterThan && result > 0) { results.Add(item); } else if (filterParts.OperatorValue == FilterOperator.LessThan && result < 0) { results.Add(item); } } //if( compareValue.ToString().StartsWith( filterParts.CompareValue.ToString(), StringComparison.CurrentCultureIgnoreCase ) ) //{ // results.Add( item ); //} } } } // clearing the current list and adding the found results back in this.ClearItems(); foreach (T itemFound in results) { this.Add(itemFound); } }