/// <summary> /// Returns true if InlineResponse200 instances are equal /// </summary> /// <param name="other">Instance of InlineResponse200 to be compared</param> /// <returns>Boolean</returns> public bool Equals(InlineResponse200 other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ReferenceNumber == other.ReferenceNumber || ReferenceNumber != null && ReferenceNumber.Equals(other.ReferenceNumber) ) && ( ItemNumber == other.ItemNumber || ItemNumber != null && ItemNumber.Equals(other.ItemNumber) ) && ( LinkedFees == other.LinkedFees || LinkedFees != null && LinkedFees.SequenceEqual(other.LinkedFees) )); }
/// <summary> /// Creates the reference number. /// </summary> /// <param name="requestId">The request identifier.</param> /// <param name="statusId">The status identifier.</param> /// <param name="levelId">The level identifier.</param> public int CreateReferenceNumber(int requestId, int statusId, int levelId) { using (var scope = _dbContext.Database.BeginTransaction()) { // get current year var currentYear = DateTime.Now.Year; // get the record with max id var refRecord = _dbContext.ReferenceNumber.OrderByDescending(a => a.Id).FirstOrDefault(); string refNumber = string.Empty; if (refRecord == null) { // first record refNumber = currentYear + "-1"; } else { // trim refRecord refNumber year and match it with current year int refYear; int refCounter = 0; string[] arrRefString = refRecord.ReferenceString.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries); if (int.TryParse(arrRefString[0], out refYear)) { // if current year is more than refRecord year if (currentYear > refYear) { // reset counter to 1 refNumber = currentYear + "-1"; } else { // increment refRecord counter refCounter = int.Parse(arrRefString[1]) + 1; refNumber = refYear + "-" + refCounter; } } else { // use current year // increment refRecord counter refCounter = int.Parse(arrRefString[1]) + 1; refNumber = refYear + "-" + refCounter; } } var referenceNumber = new ReferenceNumber() { ManpowerRequestId = requestId, StatusId = statusId, DateCreated = DateTime.Now, ReferenceString = refNumber, LevelId = levelId }; _dbContext.ReferenceNumber.Add(referenceNumber); _dbContext.SaveChanges(); _dbContext.Database.CommitTransaction(); return(referenceNumber.Id); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ReferenceNumber != null) { hashCode = hashCode * 59 + ReferenceNumber.GetHashCode(); } if (ItemNumber != null) { hashCode = hashCode * 59 + ItemNumber.GetHashCode(); } if (Quantity != null) { hashCode = hashCode * 59 + Quantity.GetHashCode(); } if (DispositionType != null) { hashCode = hashCode * 59 + DispositionType.GetHashCode(); } if (DispositionInstructions != null) { hashCode = hashCode * 59 + DispositionInstructions.GetHashCode(); } if (Labels != null) { hashCode = hashCode * 59 + Labels.GetHashCode(); } return(hashCode); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ReferenceNumber != null) { hashCode = hashCode * 59 + ReferenceNumber.GetHashCode(); } if (ItemNumber != null) { hashCode = hashCode * 59 + ItemNumber.GetHashCode(); } if (Quantity != null) { hashCode = hashCode * 59 + Quantity.GetHashCode(); } if (ReturnReason != null) { hashCode = hashCode * 59 + ReturnReason.GetHashCode(); } if (ReasonText != null) { hashCode = hashCode * 59 + ReasonText.GetHashCode(); } return(hashCode); } }
public virtual bool IsValidKfs() { int i = 0; var validKfsOrder = OrderType.Id == OrderType.Types.KfsDocument && !string.IsNullOrEmpty(ReferenceNumber) && int.TryParse(ReferenceNumber.Trim(), out i); return(validKfsOrder); }
public override int GetHashCode() { if (ReferenceNumber == null) { return(base.GetHashCode()); } return(ReferenceNumber.GetHashCode()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ReferenceNumber != null) { hashCode = hashCode * 59 + ReferenceNumber.GetHashCode(); } if (ItemNumber != null) { hashCode = hashCode * 59 + ItemNumber.GetHashCode(); } if (Quantity != null) { hashCode = hashCode * 59 + Quantity.GetHashCode(); } if (UnitSellPrice != null) { hashCode = hashCode * 59 + UnitSellPrice.GetHashCode(); } if (UnitItemTaxPrice != null) { hashCode = hashCode * 59 + UnitItemTaxPrice.GetHashCode(); } if (UnitShippingPrice != null) { hashCode = hashCode * 59 + UnitShippingPrice.GetHashCode(); } if (UnitShippingTaxPrice != null) { hashCode = hashCode * 59 + UnitShippingTaxPrice.GetHashCode(); } if (Coupons != null) { hashCode = hashCode * 59 + Coupons.GetHashCode(); } if (LinkedFees != null) { hashCode = hashCode * 59 + LinkedFees.GetHashCode(); } if (DeliveryDetail != null) { hashCode = hashCode * 59 + DeliveryDetail.GetHashCode(); } return(hashCode); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ReferenceNumber != null) { hashCode = hashCode * 59 + ReferenceNumber.GetHashCode(); } if (FirstName != null) { hashCode = hashCode * 59 + FirstName.GetHashCode(); } if (LastName != null) { hashCode = hashCode * 59 + LastName.GetHashCode(); } if (Address1 != null) { hashCode = hashCode * 59 + Address1.GetHashCode(); } if (Address2 != null) { hashCode = hashCode * 59 + Address2.GetHashCode(); } if (City != null) { hashCode = hashCode * 59 + City.GetHashCode(); } if (State != null) { hashCode = hashCode * 59 + State.GetHashCode(); } if (CountryCode != null) { hashCode = hashCode * 59 + CountryCode.GetHashCode(); } if (PostalCode != null) { hashCode = hashCode * 59 + PostalCode.GetHashCode(); } if (PhoneNumber != null) { hashCode = hashCode * 59 + PhoneNumber.GetHashCode(); } return(hashCode); } }
public static IList <string> GetReference(string basepart, int count) { //Create list of sequential reference numbers IList <string> referenceNumbers = new List <string>(); for (int i = 0; i < count; i++) { string sequentialReferenceBody = basepart + referenceIncrement.ToString(); string referenceNumber = ReferenceNumber.CreateReference(sequentialReferenceBody); //Console.WriteLine("ReferenceCreator:GetReference:Reference number: {0}", referenceNumber); referenceNumbers.Add(referenceNumber); referenceIncrement++; } return(referenceNumbers); }
/// <summary> /// Updates the title. /// </summary> /// <param name="entities">The auto-generated <see cref="Microsoft.SharePoint.Linq.DataContext"/> object.</param> public void UpdateTitle(Entities entities) { string _quantity = String.Empty; IEnumerable <Disposal> _dspsls = this.Disposal(entities); if (_dspsls != null && _dspsls.Count() > 0) { _quantity = _dspsls.Sum <Disposal>(x => x.SettledQuantity.Value).ToString("F2"); } else { _quantity = " --- "; } string _ClearanceTitleFormat = Settings.GetParameter(entities, SettingsEntry.ClearanceTitleFormat); Title = String.Format(_ClearanceTitleFormat, this.ProcedureCode, Entities.ToString(ClearenceProcedure.GetValueOrDefault(Linq.ClearenceProcedure.Invalid)), ReferenceNumber.NotAvailable(), _quantity, Id.GetValueOrDefault(-999)); }
/// <summary> /// Updates the title. /// </summary> /// <param name="entities">The auto-generated <see cref="Microsoft.SharePoint.Linq.DataContext"/> object.</param> public void UpdateTitle(Entities entities, NamedTraceLogger.TraceAction traceEvent) { string _quantity = String.Empty; //IQueryable<CustomsWarehouseDisposal> _Dspsls = from _Dspx in entities.CustomsWarehouseDisposal where _Dspx == this.Id select {ssss = _d.s } //if ( this.Disposal.Any() ) // _quantity = this.Disposal.Sum<Disposal>( x => x.SettledQuantity.Value ).ToString( "F2" ); //else // _quantity = " --- "; traceEvent("Starting Clearence.UpdateTitle", 57, TraceSeverity.Verbose); string _ClearanceTitleFormat = Settings.GetParameter(entities, SettingsEntry.ClearanceTitleFormatCW); Title = String.Format(_ClearanceTitleFormat, this.ProcedureCode, //0 ClearenceProcedure.GetValueOrDefault(Linq.ClearenceProcedure.Invalid).Convert2String(), //1 ReferenceNumber.NotAvailable(), //2 Id.GetValueOrDefault(-999)); //3 traceEvent("Finished Clearence.UpdateTitle; new Title: " + Title, 66, TraceSeverity.Verbose); }
/// <summary> /// Returns true if ReturnAuthorizationReturnDispositions instances are equal /// </summary> /// <param name="other">Instance of ReturnAuthorizationReturnDispositions to be compared</param> /// <returns>Boolean</returns> public bool Equals(ReturnAuthorizationReturnDispositions other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ReferenceNumber == other.ReferenceNumber || ReferenceNumber != null && ReferenceNumber.Equals(other.ReferenceNumber) ) && ( ItemNumber == other.ItemNumber || ItemNumber != null && ItemNumber.Equals(other.ItemNumber) ) && ( Quantity == other.Quantity || Quantity != null && Quantity.Equals(other.Quantity) ) && ( DispositionType == other.DispositionType || DispositionType != null && DispositionType.Equals(other.DispositionType) ) && ( DispositionInstructions == other.DispositionInstructions || DispositionInstructions != null && DispositionInstructions.SequenceEqual(other.DispositionInstructions) ) && ( Labels == other.Labels || Labels != null && Labels.SequenceEqual(other.Labels) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ReferenceNumber != null) { hashCode = hashCode * 59 + ReferenceNumber.GetHashCode(); } if (ItemNumber != null) { hashCode = hashCode * 59 + ItemNumber.GetHashCode(); } if (LinkedFees != null) { hashCode = hashCode * 59 + LinkedFees.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if ReturnLineItem instances are equal /// </summary> /// <param name="other">Instance of ReturnLineItem to be compared</param> /// <returns>Boolean</returns> public bool Equals(ReturnLineItem other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ReferenceNumber == other.ReferenceNumber || ReferenceNumber != null && ReferenceNumber.Equals(other.ReferenceNumber) ) && ( ItemNumber == other.ItemNumber || ItemNumber != null && ItemNumber.Equals(other.ItemNumber) ) && ( Quantity == other.Quantity || Quantity != null && Quantity.Equals(other.Quantity) ) && ( ReturnReason == other.ReturnReason || ReturnReason != null && ReturnReason.Equals(other.ReturnReason) ) && ( ReasonText == other.ReasonText || ReasonText != null && ReasonText.Equals(other.ReasonText) )); }
public ReferenceNumber Update(ReferenceNumber model) { var entity = dbContext.ReferenceNumbers.Find(model.ReferenceNumberId); if (entity == null) { entity = new ReferenceNumber { InyardNum = "00000001", PurchaseReceiptNum = "00000001", SaleReceiptNum = "00000001" }; return(Create(entity)); } else { entity.InyardNum = model.InyardNum; entity.PurchaseReceiptNum = model.PurchaseReceiptNum; entity.SaleReceiptNum = model.SaleReceiptNum; dbContext.ReferenceNumbers.Update(entity); dbContext.SaveChanges(); } return(entity); }
public ReferenceNumber Create(ReferenceNumber model) { dbContext.ReferenceNumbers.Add(model); dbContext.SaveChanges(); return(model); }
public static string GetReference(string basepart) { //Create single reference number return(ReferenceNumber.CreateReference(basepart)); }
/// <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 Add(Student student) { lock (student) { if (Count == StudentId.Length) { var newLength = StudentId.Length + 1000; var _StudentId = new string[newLength]; StudentId.CopyTo(_StudentId); StudentId = _StudentId; var _IndexNumber = new string[newLength]; IndexNumber.CopyTo(_IndexNumber); IndexNumber = _IndexNumber; var _ReferenceNumber = new string[newLength]; ReferenceNumber.CopyTo(_ReferenceNumber); ReferenceNumber = _ReferenceNumber; var _Surname = new string[newLength]; Surname.CopyTo(_Surname); Surname = _Surname; var _Othernames = new string[newLength]; Othernames.CopyTo(_Othernames); Othernames = _Othernames; var _Title = new string[newLength]; Title.CopyTo(_Title); Title = _Title; var _Gender = new string[newLength]; Gender.CopyTo(_Gender); Gender = _Gender; var _MaritalStatus = new string[newLength]; MaritalStatus.CopyTo(_MaritalStatus); MaritalStatus = _MaritalStatus; var _DateofBirth = new string[newLength]; DateofBirth.CopyTo(_DateofBirth); DateofBirth = _DateofBirth; var _Disability = new bool[newLength]; Disability.CopyTo(_Disability); Disability = _Disability; var _Country = new string[newLength]; Country.CopyTo(_Country); Country = _Country; var _Region = new string[newLength]; Region.CopyTo(_Region); Region = _Region; var _HomeTown = new string[newLength]; HomeTown.CopyTo(_HomeTown); HomeTown = _HomeTown; var _Address1 = new string[newLength]; Address1.CopyTo(_Address1); Address1 = _Address1; var _Address2 = new string[newLength]; Address2.CopyTo(_Address2); Address2 = _Address2; var _Contact1 = new string[newLength]; Contact1.CopyTo(_Contact1); Contact1 = _Contact1; var _Contact2 = new string[newLength]; Contact2.CopyTo(_Contact2); Contact2 = _Contact2; var _PersonalEmail = new string[newLength]; PersonalEmail.CopyTo(_PersonalEmail); PersonalEmail = _PersonalEmail; var _UniversityEmail = new string[newLength]; UniversityEmail.CopyTo(_UniversityEmail); UniversityEmail = _UniversityEmail; var _ResidentialStatus = new string[newLength]; ResidentialStatus.CopyTo(_ResidentialStatus); ResidentialStatus = _ResidentialStatus; var _ProgramOfStudy = new string[newLength]; ProgramOfStudy.CopyTo(_ProgramOfStudy); ProgramOfStudy = _ProgramOfStudy; var _Specialization = new string[newLength]; Specialization.CopyTo(_Specialization); Specialization = _Specialization; var _ProgramStatus = new string[newLength]; ProgramStatus.CopyTo(_ProgramStatus); ProgramStatus = _ProgramStatus; var _Level = new string[newLength]; Level.CopyTo(_Level); Level = _Level; var _StudentType = new string[newLength]; StudentType.CopyTo(_StudentType); StudentType = _StudentType; var _EnrollmentOption = new string[newLength]; EnrollmentOption.CopyTo(_EnrollmentOption); EnrollmentOption = _EnrollmentOption; var _RegistrationStatus = new string[newLength]; RegistrationStatus.CopyTo(_RegistrationStatus); RegistrationStatus = _RegistrationStatus; var _DateOfEntry = new System.DateTime[newLength]; DateOfEntry.CopyTo(_DateOfEntry); DateOfEntry = _DateOfEntry; var _DateOfCompletion = new System.DateTime[newLength]; DateOfCompletion.CopyTo(_DateOfCompletion); DateOfCompletion = _DateOfCompletion; var _Results = new StudentResultDM[newLength];; Results.CopyTo(_Results); Results = _Results; var _RegisteredCourses = new RegisteredCourseDM[newLength]; RegisteredCourses.CopyTo(_RegisteredCourses); RegisteredCourses = _RegisteredCourses; var _EmergencyContact = new EmergencyContactDM[newLength]; EmergencyContact.CopyTo(_EmergencyContact); EmergencyContact = _EmergencyContact; var _Owning = new bool[newLength]; //Owning.CopyTo(_Owning); //Owning = _Owning; //var _FeesBalance = new string[newLength]; //FeesBalance.CopyTo(_FeesBalance); //FeesBalance = _FeesBalance; var _PamentOption = new string[newLength]; PamentOption.CopyTo(_PamentOption); PamentOption = _PamentOption; var _DepartmentId = new string[newLength]; DepartmentId.CopyTo(_DepartmentId); DepartmentId = _DepartmentId; var _State = new int[newLength]; State.CopyTo(_State); State = _State; } StudentId.Span[Count] = student.StudentId; IndexNumber.Span[Count] = student.IndexNumber; ReferenceNumber.Span[Count] = student.ReferenceNumber; Surname.Span[Count] = student.Surname; Othernames.Span[Count] = student.Othernames; Title.Span[Count] = student.Title; Gender.Span[Count] = student.Gender; MaritalStatus.Span[Count] = student.MaritalStatus; DateofBirth.Span[Count] = student.DateofBirth; Disability.Span[Count] = student.Disability; Country.Span[Count] = student.Country; Region.Span[Count] = student.Region; HomeTown.Span[Count] = student.HomeTown; Address1.Span[Count] = student.Address1; Address2.Span[Count] = student.Address2; Contact1.Span[Count] = student.Contact1; Contact2.Span[Count] = student.Contact2; PersonalEmail.Span[Count] = student.PersonalEmail; UniversityEmail.Span[Count] = student.UniversityEmail; ResidentialStatus.Span[Count] = student.ResidentialStatus; ProgramOfStudy.Span[Count] = student.ProgramOfStudy; Specialization.Span[Count] = student.Specialization; ProgramStatus.Span[Count] = student.ProgramStatus; Level.Span[Count] = student.Level; StudentType.Span[Count] = student.StudentType; EnrollmentOption.Span[Count] = student.EnrollmentOption; RegistrationStatus.Span[Count] = student.RegistrationStatus; DateOfEntry.Span[Count] = student.DateOfEntry; DateOfCompletion.Span[Count] = student.DateOfCompletion; //Owning.Span[Count] = student.Owning; //FeesBalance.Span[Count] = student.FeesBalance; PamentOption.Span[Count] = student.PamentOption; DepartmentId.Span[Count] = student.DepartmentId; State.Span[Count]++; Count++; Results.Span[Count] = new StudentResultDM(length); if (student.Results?.Count > 0) { foreach (var t in student.Results) { Results.Span[Count].Add(t); } } EmergencyContact.Span[Count] = new EmergencyContactDM(length); if (student.EmergencyContact?.Count > 0) { foreach (var t in student.EmergencyContact) { EmergencyContact.Span[Count].Add(t); } } RegisteredCourses.Span[Count] = new RegisteredCourseDM(length); if (student.RegisteredCourses?.Count > 0) { foreach (var t in student.RegisteredCourses) { RegisteredCourses.Span[Count].Add(t); } } } }
static void Main(string[] args) { // ------------------- // Get long value from user // ------------------- string getBigIntValue(string msg, string exitStr, out bool success) { bool validNumber; BigInteger converted; string inputStr; success = true; // Loop until valid number given or input is equal to exit value do { Console.Write("{0} ", msg); inputStr = Console.ReadLine(); if (inputStr.ToUpper() == exitStr) { success = false; return(""); } validNumber = BigInteger.TryParse(inputStr, out converted); } while (!validNumber); return(inputStr); } // -------- // Show "menu", ask user input, loop until "X" given // -------- bool exitMain = false; bool valid; do { Console.WriteLine("1 = Check reference number"); Console.WriteLine("2 = Create reference number(s)"); Console.WriteLine("X = Exit"); Console.Write("Select: "); string menuChoice = Console.ReadLine(); if (menuChoice.ToUpper() == "X") { exitMain = true; } if (!exitMain) { switch (menuChoice) { case "1": string refNumberInput = getBigIntValue("Enter reference number (X=Back): ", "X", out valid); Console.WriteLine(); if (valid) { // Try to construct a reference number object with given value try { ReferenceNumber refNum = new ReferenceNumber(refNumberInput); Console.WriteLine("{0} - OK", refNum.RefNumberFI); } catch (InvalidRefNumberException e) { Console.WriteLine("{0} - {1}", refNumberInput, e.Message); } } break; case "2": string basePart = getBigIntValue("Enter basepart (X=Back): ", "X", out valid); if (valid) { string refNumberCount = getBigIntValue("Enter count (X=Back): ", "X", out valid); if (valid) { int counter = int.Parse(refNumberCount); ReferenceNumber refNum = new ReferenceNumber(); Console.WriteLine(); Console.WriteLine("Generated reference numbers:"); for (int i = 1; i <= counter; i++) { try { string refNumStr = refNum.GenerateRefNumber(basePart + i.ToString()); Console.WriteLine("{0}. {1}", i.ToString(), refNumStr); } catch (InvalidRefNumberException e) { Console.WriteLine(e.Message); } } } } break; default: break; } Console.WriteLine(); } } while (!exitMain); }
/// <summary> /// Returns true if LineItem instances are equal /// </summary> /// <param name="other">Instance of LineItem to be compared</param> /// <returns>Boolean</returns> public bool Equals(LineItem other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ReferenceNumber == other.ReferenceNumber || ReferenceNumber != null && ReferenceNumber.Equals(other.ReferenceNumber) ) && ( ItemNumber == other.ItemNumber || ItemNumber != null && ItemNumber.Equals(other.ItemNumber) ) && ( Quantity == other.Quantity || Quantity != null && Quantity.Equals(other.Quantity) ) && ( UnitSellPrice == other.UnitSellPrice || UnitSellPrice != null && UnitSellPrice.Equals(other.UnitSellPrice) ) && ( UnitItemTaxPrice == other.UnitItemTaxPrice || UnitItemTaxPrice != null && UnitItemTaxPrice.Equals(other.UnitItemTaxPrice) ) && ( UnitShippingPrice == other.UnitShippingPrice || UnitShippingPrice != null && UnitShippingPrice.Equals(other.UnitShippingPrice) ) && ( UnitShippingTaxPrice == other.UnitShippingTaxPrice || UnitShippingTaxPrice != null && UnitShippingTaxPrice.Equals(other.UnitShippingTaxPrice) ) && ( Coupons == other.Coupons || Coupons != null && Coupons.SequenceEqual(other.Coupons) ) && ( LinkedFees == other.LinkedFees || LinkedFees != null && LinkedFees.SequenceEqual(other.LinkedFees) ) && ( DeliveryDetail == other.DeliveryDetail || DeliveryDetail != null && DeliveryDetail.Equals(other.DeliveryDetail) )); }
static void Main(string[] args) { // ------------------- // Get long value from user // ------------------- string getRefNumber(string msg, string exitStr, out bool success) { bool validNumber; BigInteger converted; string inputStr; success = true; // Loop until valid number given or input is equal to exit value do { Console.Write("{0} ", msg); inputStr = Console.ReadLine(); if (inputStr.ToUpper() == exitStr) { success = false; return(""); } // If RF-style reference number, parse starting from index 2 if (inputStr.Substring(0, 2).ToUpper() == "RF") { validNumber = BigInteger.TryParse(inputStr.Substring(2), out converted); } else { validNumber = BigInteger.TryParse(inputStr, out converted); } } while (!validNumber); return(inputStr.ToUpper()); } // ------------------- // Get decimal value from user // ------------------- string getDoubleValue(string msg, string exitStr, out bool success, double lowLimit, double highLimit) { bool validNumber; double converted; string inputStr; success = true; // Loop until valid number given or input is equal to exit value do { Console.Write("{0} ", msg); inputStr = Console.ReadLine(); if (inputStr.ToUpper() == exitStr) { success = false; return(""); } validNumber = double.TryParse(inputStr, out converted); // Zero allowed if (converted == 0) { return("0,00"); } // Too big value, return "00000000" if (converted > highLimit) { return("00000000"); } if (inputStr.Substring(inputStr.IndexOf(",") + 1).Length > 2) { Console.WriteLine("Too many decimals"); validNumber = false; } // Negatives not allowed if (converted < lowLimit) { Console.WriteLine("Value cannot be negative"); validNumber = false; } } while (!validNumber); return(inputStr); } // ------------------- // Get date value from user // ------------------- string getDateValue(string msg, string exitStr, out bool success) { DateTime dateValue; string inputStr; success = true; int year, month, day; // Loop until valid date given or input is equal to exit value // Empty date is allowed do { Console.Write("{0} ", msg); inputStr = Console.ReadLine(); if (inputStr.ToUpper() == exitStr) { success = false; return(""); } if (inputStr.Length == 0) { success = true; return("00.00.0000"); } try { success = int.TryParse(inputStr.Substring(6, 4), out year); success = int.TryParse(inputStr.Substring(3, 2), out month); success = int.TryParse(inputStr.Substring(0, 2), out day); dateValue = new DateTime(year, month, day); } catch (ArgumentOutOfRangeException) { Console.WriteLine("Incorrect date format"); success = false; } } while (!success); return(inputStr); } // -------- // Show "menu", ask user input, loop until "X" given // -------- bool exitMain = false; bool valid; do { string bankAccountInput, refNumberInput, dueDateInput, amountInput; // Ask user values for creating virtual bar code // IBAN number, loop until valid value or exit do { Console.Write("Enter Finnish IBAN bank account number (X=Exit): "); bankAccountInput = Console.ReadLine(); if (bankAccountInput.ToUpper() == "X") { return; } try { BankAccount myAccount = new BankAccount(bankAccountInput); valid = true; bankAccountInput = myAccount.IbanFormatStr.Replace(" ", ""); } catch (InvalidAccountNumberException e) { Console.WriteLine(e.Message); valid = false; } } while (!valid); // Reference number, loop until valid value or exit do { refNumberInput = getRefNumber("Enter reference number (X=Exit): ", "X", out valid); if (!valid) { return; } try { // Depending on input type, construct correct object if (refNumberInput.Substring(0, 2) == "RF") { IntReferenceNumber myRefNumber = new IntReferenceNumber(refNumberInput); } else { ReferenceNumber myRefNumber = new ReferenceNumber(refNumberInput); } } catch (InvalidRefNumberException e) { Console.WriteLine(e.Message); valid = false; } } while (!valid); // Amount amountInput = getDoubleValue("Enter amount (X=Exit): ", "X", out valid, 0, 999999.99); if (!valid) { return; } // Due date dueDateInput = getDateValue("Enter due date (PP.KK.VVVV): ", "X", out valid); if (!valid) { return; } // Try to create virtual bar code based on user input try { VirtualBarCode virtBarCode = new VirtualBarCode(bankAccountInput, refNumberInput, amountInput, dueDateInput); Console.WriteLine(); Console.WriteLine("Virtual barcode is: {0}", virtBarCode.virtualBarCodeStr); Console.WriteLine(); } catch (InvalidVirtualBarCodeException e) { } } while (!exitMain); }
public bool ValidateCode(ReferenceNumber model) { throw new NotImplementedException(); }
public IQueryable <ReferenceNumber> Get(ReferenceNumber model = null) { return(dbContext.ReferenceNumbers.AsNoTracking().AsQueryable()); }
public SqlRawParameter GetSqlRawParameter(ReferenceNumber parameters) { throw new NotImplementedException(); }
public bool Delete(ReferenceNumber model) { dbContext.ReferenceNumbers.Remove(model); dbContext.SaveChanges(); return(true); }
public List <SqlParameter> CreateSQLParameters(ReferenceNumber parameters) { throw new NotImplementedException(); }
public string CreateSelecteQuery(ReferenceNumber parameters) { throw new NotImplementedException(); }
public bool ValidateInyardNum(ReferenceNumber model) { return(dbContext.Inyards.AsNoTracking().Count(a => a.InyardNum == model.InyardNum).Equals(0)); }
public bool ValidateSalesReceiptNum(ReferenceNumber model) { throw new NotImplementedException(); }