public override string ToString() { return(FirstName.ToString() + " " + LastName.ToString() + " " + Pesel.ToString()); }
/// <summary> /// Returns true if DepartmentDocumentSearchResponse instances are equal /// </summary> /// <param name="other">Instance of DepartmentDocumentSearchResponse to be compared</param> /// <returns>Boolean</returns> public bool Equals(DepartmentDocumentSearchResponse other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( FirstName == other.FirstName || FirstName != null && FirstName.Equals(other.FirstName) ) && ( LastName == other.LastName || LastName != null && LastName.Equals(other.LastName) ) && ( CompanyName == other.CompanyName || CompanyName != null && CompanyName.Equals(other.CompanyName) ) && ( DepartmentDocumentNumber == other.DepartmentDocumentNumber || DepartmentDocumentNumber != null && DepartmentDocumentNumber.Equals(other.DepartmentDocumentNumber) ) && ( CheckNumber == other.CheckNumber || CheckNumber != null && CheckNumber.Equals(other.CheckNumber) ) && ( CheckAmount == other.CheckAmount || CheckAmount != null && CheckAmount.Equals(other.CheckAmount) ) && ( CheckDate == other.CheckDate || CheckDate != null && CheckDate.Equals(other.CheckDate) ) && ( TransmittalNumber == other.TransmittalNumber || TransmittalNumber != null && TransmittalNumber.Equals(other.TransmittalNumber) ) && ( TransmittalStatus == other.TransmittalStatus || TransmittalStatus != null && TransmittalStatus.Equals(other.TransmittalStatus) ) && ( DepositNumber == other.DepositNumber || DepositNumber != null && DepositNumber.Equals(other.DepositNumber) ) && ( CashListing == other.CashListing || CashListing != null && CashListing.Equals(other.CashListing) )); }
private void ValidateBasic() { if (!FirstName.HasValue()) { modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].FirstName), "first name required"); } if (!LastName.HasValue()) { modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].LastName), "last name required"); } var mindate = DateTime.Parse("1/1/1753"); var HasOneOfThreeRequired = false; DateTime dt; if (DateOfBirth.HasValue() && !Util.BirthDateValid(bmon, bday, byear, out dt)) { modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].DateOfBirth), "birthday invalid"); } if (BestBirthday.HasValue && BestBirthday < mindate) { modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].DateOfBirth), "invalid date"); } if (BestBirthday.HasValue && BestBirthday > mindate) { HasOneOfThreeRequired = true; } if (Util.ValidEmail(EmailAddress)) { HasOneOfThreeRequired = true; } var d = Phone.GetDigits().Length; if (Phone.HasValue() && d >= 10) { HasOneOfThreeRequired = true; } if (d > 20) { modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].Phone), "too many digits in phone"); } if (!HasOneOfThreeRequired) { modelState.AddModelError("FORM", "we require one of valid birthdate, email or phone to find an Existing profile"); } if (!Util.ValidEmail(EmailAddress) && (person == null || !Util.ValidEmail(person.EmailAddress))) { modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].EmailAddress), "valid email required for registration confirmation"); } if (Phone.HasValue() && d < 10) { modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].Phone), "10+ digits required"); } if (!modelState.IsValid) { Log("InvalidBasic"); } }
/// <summary> /// Get a hash code for the current object. /// </summary> /// <returns>A hash code for the current object.</returns> public override int GetHashCode() { return(FirstName.GetHashCode() * 5 + LastName.GetHashCode() + DateOfBirth.GetHashCode()); }
public string GetFullName() => $"{Title.Trim()} {FirstName.Trim()} {LastName.Trim()}";
public void UpdateLastName(string lastName) { LastName = new LastName(lastName); }
/// <summary> /// Returns true if Address instances are equal /// </summary> /// <param name="other">Instance of Address to be compared</param> /// <returns>Boolean</returns> public bool Equals(Address other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ReferenceNumber == other.ReferenceNumber || ReferenceNumber != null && ReferenceNumber.Equals(other.ReferenceNumber) ) && ( FirstName == other.FirstName || FirstName != null && FirstName.Equals(other.FirstName) ) && ( LastName == other.LastName || LastName != null && LastName.Equals(other.LastName) ) && ( Address1 == other.Address1 || Address1 != null && Address1.Equals(other.Address1) ) && ( Address2 == other.Address2 || Address2 != null && Address2.Equals(other.Address2) ) && ( City == other.City || City != null && City.Equals(other.City) ) && ( State == other.State || State != null && State.Equals(other.State) ) && ( CountryCode == other.CountryCode || CountryCode != null && CountryCode.Equals(other.CountryCode) ) && ( PostalCode == other.PostalCode || PostalCode != null && PostalCode.Equals(other.PostalCode) ) && ( PhoneNumber == other.PhoneNumber || PhoneNumber != null && PhoneNumber.Equals(other.PhoneNumber) )); }
public void LowerCase() { FirstName = FirstName.ToLowerInvariant(); LastName = LastName.ToLowerInvariant(); }
private bool Equals(Person person) => FirstName.Equals(person.FirstName) && LastName.Equals(person.LastName) && PhoneNumber.Equals(person.PhoneNumber) && Email.Equals(person.Email);
private void SetLastName(string lName) { LastName.Clear(); LastName.SendKeys(lName); }
public override int GetHashCode() { return(FirstName?.GetHashCode() ?? 0 + LastName?.GetHashCode() ?? 0 + BirthDate.GetHashCode()); }
// Public Methods /// <summary> /// Ensures that all required fields are present. /// </summary> public CCResponse ValidateFields() { //Security Defect - Added the below code to trim all the fields FirstName = FirstName.Trim(); LastName = LastName.Trim(); City = City.Trim(); Zip = Zip.Trim(); Email = Email.Trim(); State = State.Trim(); Address1 = Address1.Trim(); Address2 = Address2.Trim(); Country = Country.Trim(); //Security Defect - Added the below code to trim all the fields CCResponse c = new CCResponse(); //Security Defects - START - Added the below lines to validate the fields in the BillToInfo if (IsMissing(FirstName)) { c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "FirstName"; c.ActualMessage = c.Message; c.Flag = Config.Setting("ERRCDE_FIRSTNAME"); Logger.Log(c.Message + c.Flag); return(c); } //Security Defects- CH4 -Commented the required field check for lastname since Empty spaces are coming from EXG in this field. //else if (IsMissing(LastName)) //{ // c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "LastName"; // c.ActualMessage = c.Message; // c.Flag = Config.Setting("ERRCDE_LASTNAME"); // Logger.Log(c.Message + c.Flag); // return c; //} //Security Defects-CH4 - Commented the required field check for lastname since Empty spaces are coming from EXG in this field. else if (IsMissing(City) || (City.Length > 25) || junkValidation(City)) { c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "City"; c.ActualMessage = c.Message; c.Flag = Config.Setting("ERRCDE_CITY"); Logger.Log(c.Message + c.Flag); return(c); } else if (IsMissing(Zip) || (Zip.Length > 10) || junkValidation(Zip) || !CSAAWeb.Validate.IsValidZip(Zip)) { c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "Zip"; c.ActualMessage = c.Message; c.Flag = Config.Setting("ERRCDE_CITY"); Logger.Log(c.Message + c.Flag); return(c); } else if ((Email.Length > 90) || (Email != "" && !CSAAWeb.Validate.IsValidEmailAddress(Email))) { c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "Email"; c.ActualMessage = c.Message; c.Flag = Config.Setting("ERRCDE_EMAIL"); Logger.Log(c.Message + c.Flag); return(c); } else if (IsMissing(State) || (State.Length > 2) || junkValidation(State)) { c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "State"; c.ActualMessage = c.Message; c.Flag = Config.Setting("ERRCDE_STATE"); Logger.Log(c.Message + c.Flag); return(c); } //Security defects -Ch3-Removed junk validation in BillToInfo field else if (IsMissing(Address1) || (Address1.Length > 40)) { c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "Address1"; c.Flag = Config.Setting("ERRCDE_ADDRESS1"); c.ActualMessage = c.Message; Logger.Log(c.Message + c.Flag); return(c); } //Security defects -Ch3-Removed junk validation in BillToInfo field else if ((Address2.Length > 40)) { c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "Address2"; c.ActualMessage = c.Message; c.Flag = Config.Setting("ERRCDE_ADDRESS2"); return(c); } else if ((Country.Length > 2) || junkValidation(Country)) { c.Message = CSAAWeb.Constants.ERR_AUTHVALIDATION + "Country"; c.ActualMessage = c.Message; c.Flag = Config.Setting("ERRCDE_COUNTRY"); return(c); } //Security Defects -CH1 - END- Added the below lines to validate the fields in the BillToInfo /*Security Defects - CH2 - sTART - Commented the below code * else if (IsMissing(FirstName) || IsMissing(LastName)) * { * Logger.Log("Field missing, FirstName=" + FirstName + ", LastName=" + LastName); * return null; * throw new BusinessRuleException(EXP_MISSING_CONTACT); * } * * // CSAA.COM CH1:START- Removed Address1 from required field check . * // if (IsMissing(Address1) || IsMissing(City) || IsMissing(State) || IsMissing(Zip)) * else if ( IsMissing(City) || IsMissing(State) || IsMissing(Zip)) * { * //Logger.Log("Field missing, Address1=" + Address1 + ", City=" + City + ", State=" + State + ", Zip=" + Zip); * Logger.Log("Field missing, City=" + City + ", State=" + State + ", Zip=" + Zip); * return null; * * throw new BusinessRuleException(EXP_MISSING_ADDRESS); * } * // CSAA.COM CH1:END-//Security Defects - CH2 - Commented the below code */ else if (IsMissing(Country)) { _Country = Default_Country; return(null); } else if (IsMissing(Currency)) { _Currency = Default_Currency; return(null); } else { return(null); } }
public string AllCaps() { FirstName = FirstName.ToUpper(); LastName = LastName.ToUpper(); return(ToString()); }
//public ActionResult Index(string SelectedColumn, string ascending, string searchName, string selectedVehicleType) public ActionResult All([Bind(Include = "SearchName,SelectedSorting,SelectedColumn")] ParkedVehiclesViewModel model) { IQueryable <ParkedVehicle> parkedVehicles; switch (model.SelectedColumn) { case "Customer": //Havent implemented sorting with name yet, a little more complex with joins needed //This code can probably be simplified //When there is no search name entere wwe just return a list if (String.IsNullOrWhiteSpace(model.SearchName)) { parkedVehicles = db.ParkedVehicle; } else { var splitted = model.SearchName.Split(' '); string FirstName, LastName; if (splitted.Length != 2) { //A bit ugly solution should somehow just return an empty Iqueryable list FirstName = ""; LastName = ""; } else { FirstName = splitted[0]; LastName = splitted[1]; } var member = db.Member.Where(m => m.FirstName.ToLower() == FirstName.ToLower() && m.LastName.ToLower() == LastName.ToLower()); parkedVehicles = db.ParkedVehicle.Where(v => v.MembersId == member.FirstOrDefault().Id); } break; case "RegNr": parkedVehicles = (!String.IsNullOrEmpty(model.SearchName)) ? db.ParkedVehicle.Where(v => v.RegistrationNumber.Equals(model.SearchName)) : db.ParkedVehicle; parkedVehicles = model.SelectedSorting.Equals("Descending") ? parkedVehicles.OrderByDescending(v => v.RegistrationNumber) : parkedVehicles.OrderBy(v => v.RegistrationNumber); break; case "VehicleType": parkedVehicles = (!String.IsNullOrEmpty(model.SearchName)) ? db.ParkedVehicle.Where(v => v.VehicleType.Type.Equals(model.SearchName)) : db.ParkedVehicle; parkedVehicles = model.SelectedSorting.Equals("Descending") ? parkedVehicles.OrderByDescending(v => v.VehicleType.Type) : parkedVehicles.OrderBy(v => v.VehicleType.Type); break; case "Color": parkedVehicles = (!String.IsNullOrEmpty(model.SearchName)) ? db.ParkedVehicle.Where(v => v.Color.Equals(model.SearchName)) : db.ParkedVehicle; parkedVehicles = !Ascending(ViewBag.Ascending) ? parkedVehicles.OrderByDescending(v => v.Color) : parkedVehicles.OrderBy(v => v.Color); break; case "Brand": parkedVehicles = (!String.IsNullOrEmpty(model.SearchName)) ? db.ParkedVehicle.Where(v => v.Brand.Equals(model.SearchName)) : db.ParkedVehicle; parkedVehicles = !Ascending(ViewBag.Ascending) ? parkedVehicles.OrderByDescending(v => v.Brand) : parkedVehicles.OrderBy(v => v.Brand); break; case "Wheels": parkedVehicles = (!String.IsNullOrEmpty(model.SearchName)) ? db.ParkedVehicle.Where(v => v.Wheels.ToString().Equals(model.SearchName)) : db.ParkedVehicle; parkedVehicles = !Ascending(ViewBag.Ascending) ? parkedVehicles.OrderByDescending(v => v.Wheels) : parkedVehicles.OrderBy(v => v.Wheels); break; default: parkedVehicles = (!String.IsNullOrEmpty(model.SearchName)) ? db.ParkedVehicle.Where(v => v.ParkingTime.ToString().Contains(model.SearchName)) : db.ParkedVehicle; parkedVehicles = !Ascending(ViewBag.Ascending) ? parkedVehicles.OrderByDescending(v => v.ParkingTime) : parkedVehicles.OrderBy(v => v.ParkingTime); break; } model.ColumnSelectList = GetColumnSelectList(); model.ParkedVehicles = parkedVehicles; return(View(model)); }
public bool CheckName(string firstName, LastName lastName) { if (Initializing) throw new InvalidOperationException("still initializing"); if (_caps.CheckName == null) throw new InvalidOperationException("access denied; only approved developers have access to the registration api"); // Create the POST data LLSDMap query = new LLSDMap(); query.Add("username", LLSD.FromString(firstName)); query.Add("last_name_id", LLSD.FromInteger(lastName.ID)); byte[] postData = LLSDParser.SerializeXmlBytes(query); CapsClient request = new CapsClient(_caps.CheckName); request.OnComplete += new CapsClient.CompleteCallback(CheckNameResponse); request.StartRequest(); // FIXME: return false; }
public override int GetHashCode() => FirstName.GetHashCode() ^ LastName.GetHashCode() ^ Email.GetHashCode() ^ PhoneNumber.GetHashCode();
public bool CheckName(string firstName, LastName lastName) { if (Initializing) throw new InvalidOperationException("still initializing"); if (_caps.CheckName == null) throw new InvalidOperationException("access denied; only approved developers have access to the registration api"); // Create the POST data Dictionary<string, object> query = new Dictionary<string, object>(); query.Add("username", firstName); query.Add("last_name_id", lastName.ID); byte[] postData = LLSDParser.SerializeXmlBytes(query); CapsRequest request = new CapsRequest(_caps.CheckName.AbsoluteUri, String.Empty, null); request.OnCapsResponse += new CapsRequest.CapsResponseCallback(CheckNameResponse); request.MakeRequest(postData, "application/xml", 0, null); // FIXME: return false; }
public override string ToString() { return(string.Format("{0, -15} {1, -15} {2, -10} {3, -15} {4:M/d/yyyy}", FirstName.Trim(), LastName.Trim(), Gender.Trim(), FavoriteColor.Trim(), DateOfBirth)); }
/// <summary> /// The FullName /// </summary> /// <returns>The <see cref="string"/></returns> public string FullName() { return(string.Format(@"{1}, {0}{2}", FirstName.Trim(), LastName.Trim(), (string.IsNullOrEmpty(MiddleName)) ? string.Empty : " " + MiddleName.Trim())); }
public override string ToString()//Setting new ToString Method { return(string.Format("{0} - {1}, {2}", AccountNumber, LastName.ToUpper(), FirstName)); }
public override int GetHashCode() { return(Age.GetHashCode() + FirstName.GetHashCode() + LastName.GetHashCode()); }
public int CompareTo(object obj) { return(LastName.CompareTo((obj as Student)?.LastName)); }
public string Search(int report, int dateGroup, string staffId, int status, string keyword, string listPlayerIdIncidents) { Keyword = keyword; string reportStatus = ""; switch (status) // set status for writing the select query { case 2: reportStatus = "%Completion%"; break; case 3: reportStatus = "%Manager%"; break; case 4: reportStatus = "%Further%"; break; case 5: reportStatus = "%Completed%"; break; } DateTime date1 = DateTime.Now.Date, date2 = DateTime.Now.Date; // used to hold Date Group values switch (dateGroup) // set the date being filtered { case 2: date2 = DateTime.Now.Date.AddDays(-1); // reports from yesterday break; case 3: date2 = DateTime.Now.Date.AddDays(-7); // reports from last seven days break; case 4: date2 = DateTime.Now.Date.AddDays(-14); // reports from last 14 days break; case 5: date2 = DateTime.Now.Date.AddDays(-30); // reports from last month break; case 6: date2 = DateTime.Now.Date.AddDays(-365); // reports from last year break; case 7: date2 = DateTime.Parse(StartDate); date1 = DateTime.Parse(EndDate); break; } string reportType = ""; switch (report) // set the report type being filtered (take note that any changes from the group will create an error - MRReportsDutyManager) { case 2: reportType = "MR Incident Report"; break; case 3: reportType = "MR Duty Managers"; break; case 4: reportType = "MR Supervisors"; break; case 5: reportType = "MR Function Supervisor"; break; case 6: reportType = "MR Reception Supervisor"; break; case 7: reportType = "MR Reception"; break; case 8: reportType = "CU Duty Managers"; break; case 9: reportType = "CU Reception"; break; case 10: reportType = "CU Incident Report"; break; case 11: reportType = "MR Covid Marshall"; break; case 12: reportType = "CU Covid Marshall"; break; case 13: reportType = "MR Customer Relations Officer"; break; case 14: reportType = "MR Caretaker"; break; } // check if user has entered a keyword to be filtered bool hasKeyword = true; if (keyword.Equals("0") || keyword.Equals("")) // check whether the keyword filter is empty { hasKeyword = false; // keyword filter is empty } // check if staff has filter bool hasStaffFilter = true; if (ArchivedStaff) { if (string.IsNullOrEmpty(staffId)) { staffId = "SELECT StaffId FROM Staff WHERE Active=0"; } } else if (string.IsNullOrEmpty(staffId)) // if there is no staff filter selected, populate staff list { staffId = "SELECT StaffId FROM Staff"; hasStaffFilter = false; } // check if selected staff filter is the user logged in bool isAuthor = true; if (!staffId.Equals(UserCredentials.StaffId)) { isAuthor = false; } string selectQuery = "", startQuery = "SELECT [ReportId], [ReportName], [StaffId], [StaffName], [ShiftName], [ShiftDate], [ShiftDOW], [Report_Table], [Report_Version], [ReportStat], [AuditVersion], [RowNum]" + " FROM [View_Reports] WHERE ", startQuery1 = "SELECT [ReportId], [ReportName], [StaffId], [StaffName], [ShiftName], [ShiftDate], [ShiftDOW], [Report_Table], [Report_Version], [ReportStat], [AuditVersion], ROW_NUMBER() OVER(ORDER BY ShiftDate DESC, ShiftId DESC) RowNum" + " FROM [View_Reports] WHERE ", reportIdQuery = "", dateQuery = "", statusQuery = "", unreadQuery = "", reportQuery = "", authorQuery = "", cuQuery = "", mrQuery = "", endQuery = "ORDER BY ShiftDate DESC, ShiftId DESC, RowNum"; if (report == 1) // no report type filter { string groupsUpdate = ""; try { groupsUpdate = UserCredentials.GroupsQuery.Remove(UserCredentials.GroupsQuery.LastIndexOf("', 'MR Incident Report")); } catch { } try { groupsUpdate = UserCredentials.GroupsQuery.Remove(UserCredentials.GroupsQuery.LastIndexOf("', 'CU Incident Report")); } catch { } if (UnreadList && UserCredentials.GroupsQuery.Contains("Reception") && !UserCredentials.GroupsQuery.Contains("Supervisor") && !UserCredentials.GroupsQuery.Contains("Manager")) { reportQuery = "[ReportName] IN ('" + groupsUpdate + "') AND "; } else { if (UserCredentials.GroupsQuery.Contains("Reception") && !UserCredentials.GroupsQuery.Contains("Supervisor") && !UserCredentials.GroupsQuery.Contains("Manager")) { reportQuery = "([ReportName] IN ('" + groupsUpdate + "') OR ([ReportName] IN ('" + UserCredentials.GroupsQuery + "') AND [StaffId] = '" + UserCredentials.StaffId + "')) AND "; } else { reportQuery = "[ReportName] IN ('" + UserCredentials.GroupsQuery + "') AND "; } } } else // has report type filter { if (UserCredentials.GroupsQuery.Contains("Reception") && !UserCredentials.GroupsQuery.Contains("Supervisor") && !UserCredentials.GroupsQuery.Contains("Manager") && (reportType.Equals("MR Incident Report") || reportType.Equals("CU Incident Report"))) { reportQuery = "([ReportName] = '" + reportType + "' AND [StaffId] = '" + UserCredentials.StaffId + "') AND "; } else { reportQuery = "[ReportName] = '" + reportType + "' AND "; } } if (string.IsNullOrWhiteSpace(ReportId)) { reportIdQuery = " "; } else { reportIdQuery = "ReportId =" + ReportId + " AND "; } if (dateGroup != 1) // has date filter { dateQuery = "ShiftDate BETWEEN '" + date2.ToString("yyyy-MM-dd") + "' AND '" + date1.ToString("yyyy-MM-dd") + "' AND "; } else // no date filter { dateQuery = " "; } if (MROnly) { mrQuery = "[ReportName] LIKE '%MR%' AND "; } else { mrQuery = ""; } if (CUOnly) { cuQuery = "[ReportName] LIKE '%CU%' AND "; } else { cuQuery = ""; } if (status != 1) // has status filter { statusQuery = "[ReportStat] LIKE '" + reportStatus + "' AND "; } else // no status filter { statusQuery = " "; } if (!hasStaffFilter) // if staff filter is empty { authorQuery = "([ReportStat] = 'Report Completed' OR [ReportStat] = 'Further Action Required' OR [ReportStat] = 'Awaiting Manager Sign-off' OR ([ReportStat] = 'Awaiting Completion' AND [StaffId] = '" + UserCredentials.StaffId + "')) "; } else // has a staff filter { if (isAuthor) // The user selected his ownself { authorQuery = "([ReportStat] = 'Report Completed' OR [ReportStat] = 'Further Action Required' OR [ReportStat] = 'Awaiting Manager Sign-off' OR ([ReportStat] = 'Awaiting Completion' AND [StaffId] = '" + UserCredentials.StaffId + "')) AND StaffId IN (" + staffId + ") "; } else // // staff other than the user { authorQuery = "([ReportStat] = 'Report Completed' OR [ReportStat] = 'Further Action Required' OR [ReportStat] = 'Awaiting Manager Sign-off') AND StaffId IN (" + staffId + ") "; } } if (UnreadList && string.IsNullOrEmpty(ListPlayerIdIncidents)) // unread tickbox has been checked { unreadQuery = "AND ([ReadByList] NOT LIKE '%," + UserCredentials.StaffId + ",%' OR [ReadByList] IS NULL) AND ([ManagerSignId] NOT LIKE '%" + UserCredentials.StaffId + ",%' OR [ManagerSignId] IS NULL) "; } else // no unread list filter { unreadQuery = " "; } if (!hasKeyword && (WhatHappened.Equals("0") || string.IsNullOrEmpty(WhatHappened)) && (Location.Equals("0") || string.IsNullOrEmpty(Location)) && (ActionTaken.Equals("0") || string.IsNullOrEmpty(ActionTaken)) && (MemberNo.Equals("0") || string.IsNullOrEmpty(MemberNo)) && (FirstName.Equals("0") || string.IsNullOrEmpty(FirstName)) && (LastName.Equals("0") || string.IsNullOrEmpty(LastName)) && (Alias.Equals("0") || string.IsNullOrEmpty(Alias))) // if Keyword and advanced filters are empty { selectQuery = startQuery + reportQuery + reportIdQuery + dateQuery + mrQuery + cuQuery + statusQuery + authorQuery + unreadQuery + endQuery; } else // keyword filter and advanced filter has been entered { // run stored procedures SqlQuery sqlQuery = new SqlQuery(); if (!string.IsNullOrEmpty(listPlayerIdIncidents)) // run all the list of incidents for the selected player id { sqlQuery.RetrieveData("Proc_ListPriorIncidents", "SearchKeyword"); } else // no player id is selected, filter via keyword and report filters { // set appropriate stored procedure (either Proc_KeywordSearchAllReports - any report other than Incidents ; Proc_KeywordSearchIncidentReports - Incidents ONLY) if (reportType.Contains("Incident")) { sqlQuery.RetrieveData("Proc_KeywordSearchIncidentReports", "SearchKeyword"); } else { sqlQuery.RetrieveData("Proc_KeywordSearchAllReports", "SearchKeyword"); } } if (GlobalSearchId.Equals("")) // if no data retrieved, display an error message { return(selectQuery); } // take off the extra ', ' in Global Search Ids Variable int strLength = GlobalSearchId.Length; GlobalSearchId = GlobalSearchId.Remove(strLength - 2, 2); string keywordQuery = "AND [ReportId] IN (" + GlobalSearchId + ") "; GlobalSearchId = ""; // to avoid this variable from getting appended ListPlayerIdIncidents = ""; // reset this variable to be reused again in searching incident reports related to player id selected selectQuery = startQuery1 + reportQuery + reportIdQuery + dateQuery + mrQuery + cuQuery + statusQuery + authorQuery + keywordQuery + unreadQuery + endQuery; } return(selectQuery); }
private void button1_Click(object sender, EventArgs e) { int broj; if (FirstName.Text == "") { MessageBox.Show("you did not enter the first name of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); FirstName.Focus(); return; } else if (LastName.Text == "") { MessageBox.Show("you did not enter the first name of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); LastName.Focus(); return; } else if (UniqueIN.Text == "") { MessageBox.Show("you did not enter the unique identifacion number of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UniqueIN.Focus(); return; } else if (IDNumber.Text == "") { MessageBox.Show("you did not enter the ID number of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); IDNumber.Focus(); return; } else if (Address.Text == "") { MessageBox.Show("you did not enter the address of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); Address.Focus(); return; } else if (PhoneNumber.Text == "" && Int32.TryParse(PhoneNumber.Text, out broj)) { MessageBox.Show("you did not enter the phone number of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); PhoneNumber.Focus(); return; } else if (Municipalities.Text == "") { MessageBox.Show("you did not enter the municipalities of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (UniqueIN.Text.Length < 13) { MessageBox.Show("Unesite isprevno JMBG"); UniqueIN.Clear(); UniqueIN.Focus(); } else if (UniqueIN.Text.Length > 13) { MessageBox.Show("Unesite isprevno JMBG"); UniqueIN.Clear(); UniqueIN.Focus(); } else if (IDNumber.Text.Length < 9) { MessageBox.Show("Unesite isprevno BRLK"); IDNumber.Clear(); IDNumber.Focus(); } else if (IDNumber.Text.Length > 9) { MessageBox.Show("Unesite isprevno BRLK"); IDNumber.Clear(); IDNumber.Focus(); } else { SqlConnection con = new SqlConnection(Form1.path); try { con.Close(); con.Open(); SqlCommand command = con.CreateCommand(); command.CommandText = "SELECT Id FROM municipalities WHERE name = '" + Municipalities.SelectedItem.ToString() + "';"; SqlDataReader rdr = command.ExecuteReader(); rdr.Read(); int d = rdr.GetInt32(0); rdr.Close(); command.CommandText = "INSERT INTO candidate ( municipalities_id, first_name, last_name, unique_identifacion_number, Id_number, address, phone_number) VALUES ( " + d + ",'" + FirstName.Text + "','" + LastName.Text + "','" + UniqueIN.Text + "','" + IDNumber.Text + "','" + Address.Text + "'," + int.Parse(PhoneNumber.Text) + ");"; command.ExecuteNonQuery(); MessageBox.Show("Successfully entered candidate"); FirstName.Clear(); LastName.Clear(); UniqueIN.Clear(); IDNumber.Clear(); Address.Clear(); PhoneNumber.Clear(); Municipalities.SelectedIndex = -1; con.Close(); } catch (Exception ee) { MessageBox.Show("" + ee.ToString()); return; } } }
public async void SearchClicked(string dob, string enrollmentDate) { var searchChildRecords = new List <ChildRecordsNewAssessment>(); var isMorethan1000 = false; await LoadChildRecordsFromDBAsync(); if (!string.IsNullOrEmpty(FirstName) || !string.IsNullOrEmpty(LastName) || (SelectedLocations != null && SelectedLocations.Any()) || !string.IsNullOrEmpty(dob) || !string.IsNullOrEmpty(enrollmentDate) || !string.IsNullOrEmpty(ChildID)) { IEnumerable <ChildRecordsNewAssessment> query = ChildTestRecords; if (!string.IsNullOrEmpty(FirstName)) { query = query.Where(p => !string.IsNullOrEmpty(p.FirstName) && p.FirstName.ToLower().Contains(FirstName.ToLower())); } if (!string.IsNullOrEmpty(LastName)) { query = query.Where(p => !string.IsNullOrEmpty(p.LastName) && p.LastName.ToLower().Contains(LastName.ToLower())); } if (!string.IsNullOrEmpty(ChildID)) { query = query.Where(p => !string.IsNullOrEmpty(p.ChildID) && p.ChildID.ToLower().Contains(ChildID.ToLower())); } if (!string.IsNullOrEmpty(dob)) { query = query.Where(p => !string.IsNullOrEmpty(p.DOB) && p.DOB == dob); } if (!string.IsNullOrEmpty(enrollmentDate)) { query = query.Where(p => !string.IsNullOrEmpty(p.Enrollment) && p.Enrollment == enrollmentDate); } if (SelectedLocations.Count > 0) { query = query.Where(p => !string.IsNullOrEmpty(p.Location) && SelectedLocations.Contains(p.Location)); } searchChildRecords = new List <ChildRecordsNewAssessment>(query); } else { searchChildRecords = ChildTestRecords; } if (!searchChildRecords.Any()) { SearchResult = ErrorMessages.RecordMatchesFoundMessage; SearchErrorColor = Color.Red; SearchErrorVisible = true; } else { SearchResult = string.Format(ErrorMessages.RecordsFoundMessage, searchChildRecords.Count(), searchChildRecords.Count() == 1 ? "Match" : "Matches"); SearchErrorColor = Color.Black; SearchErrorVisible = true; if (searchChildRecords.Count > 1000) { isMorethan1000 = true; SearchResult = ErrorMessages.SearchError; SearchErrorColor = Color.Red; SearchErrorVisible = true; } else if (searchChildRecords.Count > 5) { searchChildRecords[searchChildRecords.Count - 1].IsTableSepartorVisble = false; } else { searchChildRecords[searchChildRecords.Count - 1].IsTableSepartorVisble = true; IsTableBottomLineVisible = false; } if (SelectAll) { int index = 0; foreach (var record in searchChildRecords) { index++; } } } var list = searchChildRecords.OrderBy(a => a.LastName); var reorderedList = new List <ChildRecordsNewAssessment>(list); ChildTestRecords.Clear(); if (!isMorethan1000) { ChildTestRecords = reorderedList; } }
public override int GetHashCode() { return(FirstName.GetHashCode() ^ MiddleName.GetHashCode() ^ LastName.GetHashCode() ^ SSN.GetHashCode() ^ Phone.GetHashCode()); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { //if (MemberId != 0) //{ // FullName = FirstName + ' ' + LastName + " & " + SpouseFirstName; //} if (ProvinceCode != null) { if (ProvinceCode.Length != 2) { yield return(new ValidationResult("The Province Code should be exactly 2 characters long", new[] { "ProvinceCode" })); } else { var province = _context.Province.Where(m => m.ProvinceCode == ProvinceCode).FirstOrDefault(); if (province == null) { yield return(new ValidationResult("The Province Code is not valid", new[] { "ProvinceCode" })); } else { ProvinceCode = ProvinceCode.Trim().ToUpper(); } } } Regex PostalCodePattern = new Regex((@"^[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}\s{0,1}[0-9]{1}[a-zA-Z]{1}[0-9]{1}"), RegexOptions.IgnoreCase); if (PostalCodePattern.IsMatch(PostalCode.Trim())) { if (!PostalCode.Contains(" ")) { PostalCode = PostalCode.Insert(3, " "); PostalCode = PostalCode.Trim().ToUpper(); } else { PostalCode = PostalCode.Trim().ToUpper(); } } else { yield return(new ValidationResult("The Postal Code entered is not in valid canadian format", new[] { "PostalCode" })); } Regex HomePhonePattern = new Regex(@"^\d\d\d-{0,1}\d\d\d-{0,1}\d\d\d\d"); if (HomePhone != null) { if (HomePhonePattern.IsMatch(HomePhone)) { if (!HomePhone.Contains('-')) { HomePhone = HomePhone.Insert(3, "-"); HomePhone = HomePhone.Insert(7, "-"); HomePhone = HomePhone.Trim(); } } else { yield return(new ValidationResult("The home Phone number entered is not in valid format 999-999-9999", new[] { "HomePhone" })); } } if (string.IsNullOrEmpty(SpouseFirstName) && string.IsNullOrEmpty(SpouseLastName)) { FullName = LastName.Trim() + "," + FirstName.Trim(); } else { if (SpouseLastName == null || SpouseLastName == LastName) { FullName = FirstName.Trim() + ' ' + LastName.Trim() + " & " + SpouseFirstName.Trim(); } else { FullName = LastName.Trim() + "," + FirstName.Trim() + " & " + SpouseLastName.Trim() + "," + SpouseFirstName.Trim(); } } if (UseCanadaPost) { if (string.IsNullOrEmpty(Street) && string.IsNullOrEmpty(City)) { yield return(new ValidationResult("The Street name and City Name field are required fields if you have checked Canada Post checkbox", new[] { "Street" })); } } else { if (string.IsNullOrEmpty(Email)) { yield return(new ValidationResult("The Email address field is required", new[] { "Email" })); } } if (MemberId == 0) { var duplicateID = _context.Member.Where(x => x.MemberId == MemberId).FirstOrDefault(); if (duplicateID != null) { yield return(new ValidationResult("The Member Id entered is already on file", new[] { "MemberId" })); } } if (Street != null) { Street = Street.Trim(); } if (City != null) { City = City.Trim(); } if (Email != null) { Email = Email.Trim(); } if (Comment != null) { Comment = Comment.Trim(); } yield return(ValidationResult.Success); }
public override int GetHashCode() { return(Firstname.GetHashCode() & LastName.GetHashCode() & Address.GetHashCode()); }
//Для оптимизации сравнения, сначала сравниваем хешкоды полученного поля из геттера свойства GroupName. //Если они равны, значит объекты одинаковые, если нет продолжаем равнивать bool Equals public override int GetHashCode() { return(FirstName.GetHashCode() * LastName.GetHashCode()); }
public override int GetHashCode() { return(LastName.GetHashCode() + FistName.GetHashCode()); //return FIO.GetHashCode(); //return LastName.GetHashCode(); }
//Func<string, string> selector = (x => string.Format(, )); public Func<string,string> GetFormattedName() { return (x => $"{FirstName.ToUpper()} {LastName.ToUpper()}"); }
public static User Create(UserId id, FirstName firstName, LastName lastName, Email email, Role role) => new User(id, firstName, lastName, email, role);
public bool CheckName(string firstName, LastName lastName) { if (Initializing) throw new InvalidOperationException("still initializing"); if (_caps.CheckName == null) throw new InvalidOperationException("access denied; only approved developers have access to the registration api"); // Create the POST data OSDMap query = new OSDMap(); query.Add("username", OSD.FromString(firstName)); query.Add("last_name_id", OSD.FromInteger(lastName.ID)); CapsClient request = new CapsClient(_caps.CheckName); request.OnComplete += new CapsClient.CompleteCallback(CheckNameResponse); request.BeginGetResponse(REQUEST_TIMEOUT); // FIXME: return false; }
private void GatherLastNamesResponse(object response, HttpRequestState state) { if (response is Dictionary<string, object>) { Dictionary<string, object> respTable = (Dictionary<string, object>)response; _lastNames = new List<LastName>(respTable.Count); for (Dictionary<string, object>.Enumerator it = respTable.GetEnumerator(); it.MoveNext(); ) { LastName ln = new LastName(); ln.ID = int.Parse(it.Current.Key.ToString()); ln.Name = it.Current.Value.ToString(); _lastNames.Add(ln); } _lastNames.Sort(new Comparison<LastName>(delegate(LastName a, LastName b) { return a.Name.CompareTo(b.Name); })); } }