Ejemplo n.º 1
0
        private bool ValidateFloatingLicense(string publicKeyOfFloatingLicense)
        {
            if (DisableFloatingLicenses)
            {
                Logger.Warn("Floating licenses have been disabled");
                return(false);
            }
            if (licenseServerUrl == null)
            {
                Logger.Warn("Could not find license server url");
                throw new InvalidOperationException("Floating license encountered, but licenseServerUrl was not set");
            }

            var success          = false;
            var licensingService = ChannelFactory <ILicensingService> .CreateChannel(new WSHttpBinding(), new EndpointAddress(licenseServerUrl));

            try
            {
                var leasedLicense = licensingService.LeaseLicense(
                    Environment.MachineName,
                    Environment.UserName,
                    clientId);
                ((ICommunicationObject)licensingService).Close();
                success = true;
                if (leasedLicense == null)
                {
                    Logger.Warn("Null response from license server: {0}", licenseServerUrl);
                    throw new FloatingLicenseNotAvailableException();
                }

                var doc = new XmlDocument();
                doc.LoadXml(leasedLicense);

                if (TryGetValidDocument(publicKeyOfFloatingLicense, doc) == false)
                {
                    Logger.Warn("Could not get valid license from floating license server {0}", licenseServerUrl);
                    throw new FloatingLicenseNotAvailableException();
                }

                var validLicense = ValidateXmlDocumentLicense(doc);
                if (validLicense)
                {
                    //setup next lease
                    var time = (ExpirationDate.AddMinutes(-5) - SystemTime.UtcNow);
                    Logger.Debug("Will lease license again at {0}", time);
                    if (disableFutureChecks == false && nextLeaseTimer != null)
                    {
                        nextLeaseTimer.Change(time, time);
                    }
                }
                return(validLicense);
            }
            finally
            {
                if (success == false)
                {
                    ((ICommunicationObject)licensingService).Abort();
                }
            }
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ExpirationDate tmp = (ExpirationDate)value;

            if (tmp != null)
            {
                if (tmp.Collected)
                {
                    return(Color.FromHex("#dd444444"));
                }

                int days = (int)(tmp.EndDate - DateTime.Now).TotalDays;

                if (days > 30)
                {
                    return(Color.FromHex("#dd00cc66"));
                }
                else if (days > 7)
                {
                    return(Color.FromHex("#ddffb366"));
                }
                else
                {
                    return(Color.FromHex("#ddff6666"));
                }
            }
            else
            {
                return(Color.White);
            }
        }
Ejemplo n.º 3
0
        private async Task ExecuteRelistCommand(int id)
        {
            DonationCapture capture = new DonationCapture()
            {
                Title      = DonationTitle,
                Type       = DonationType,
                Amount     = Quantity,
                Expiration = ExpirationDate.Add(ExpirationTime)
            };
            var okToProceed = await CheckRemoveRecipient();

            if (okToProceed)
            {
                IsBusy = true;
                EnterCommand.ChangeCanExecute();
                var res = await donationRep.RelistDonationAsync(capture, donation.Id, mediaFile);

                IsBusy = false;
                EnterCommand.ChangeCanExecute();

                if (!res)
                {
                    ShowFailureDialog("Unable to Relist");
                }
                else
                {
                    await Page.Navigation.PopToRootAsync();
                }
            }
        }
Ejemplo n.º 4
0
        public DiscountCampaignDTO GenerateGrpcDtoFromDiscountCampaign()
        {
            var discountCampaignDto = new DiscountCampaignDTO
            {
                Id = Id.ToString(), Name = Name,
            };

            var discountValue = DiscountValue;

            if (CodePrefix != null)
            {
                discountCampaignDto.CodePrefix = CodePrefix;
            }
            if (discountValue != null)
            {
                discountCampaignDto.DiscountValue = DecimalValue.FromDecimal(discountValue.Value);
            }
            discountCampaignDto.StartDate               = StartDate.ToString();
            discountCampaignDto.ExpirationDate          = ExpirationDate.ToString();
            discountCampaignDto.ApplyOnId               = ApplyOnId.ToString();
            discountCampaignDto.DiscountCampaignType    = (uint)DiscountCampaignType.GetHashCode();
            discountCampaignDto.DiscountUnitId          = DiscountUnitId.ToString();
            discountCampaignDto.DiscountCampaignApplyOn = (uint)DiscountCampaignApplyOn.GetHashCode();

            foreach (var discountValidation in DiscountValidations)
            {
                var discountValidationDto = discountValidation.GenerateGrpcDtoFromProductValidation();
                discountCampaignDto.DiscountValidations.Add(discountValidationDto);
            }

            return(discountCampaignDto);
        }
        private void DatagridDetailsMenuItem_Click(object sender, RoutedEventArgs e)
        {
            ExpirationDate expirationDate = expirationDatesDataGrid.SelectedItem as ExpirationDate;

            if (expirationDate == null)
            {
                Debug.Fail("Selected Expiration date cannot be retrieved.");
                // ReSharper disable once HeuristicUnreachableCode
                return;
            }

            ProductDetailsWindow productDetailsWindow = new ProductDetailsWindow(expirationDate.Product)
            {
                Owner = Parent as Window
            };

            if (productDetailsWindow.ShowDialog() == true)
            {
                // Get the incoming expiration dates agai since the user may have modified them from
                // the product details window.
                DateTime oneMonthLater = DateTime.Today + new TimeSpan(365, 0, 0, 0);
                IncomingExpirationDates.Clear();
                var coll = ObjectCtx.Context.ExpirationDates.Where(
                    x => x.NumItems > 0 && oneMonthLater >= x.ExDate).OrderBy(x => x.ExDate);
                foreach (ExpirationDate expDate in coll)
                {
                    IncomingExpirationDates.Add(expDate);
                }
            }
        }
Ejemplo n.º 6
0
        private void PlusCount(ExpirationDate expD)
        {
            int idx = ExpirationDates.IndexOf(expD);

            expD.Count++;
            ExpirationDates[idx] = expD;
        }
Ejemplo n.º 7
0
        public XElement getCarEntry()
        {
            XElement eCarEntry =
                new XElement("OwnedCarTrans",
                             new XElement("CustomCar",
                                          new XElement("BaseCar", BaseCarId),
                                          new XElement("CarClassHash", (Int32)RaceClass),
                                          new XElement("Id", Id),
                                          Paints,
                                          PerformanceParts,
                                          new XElement("PhysicsProfileHash", PhysicsProfileHash),
                                          new XElement("ResalePrice", ResalePrice),
                                          SkillModParts,
                                          new XElement("SkillModSlotCount", 6),
                                          Vinyls,
                                          VisualParts
                                          ),
                             new XElement("Durability", Durability),
                             (ExpirationDate == new DateTime(1, 1, 1) ?
                              new XElement("ExpirationDate", new XAttribute(ServerAttributes.nilNS + "nil", "true")) :
                              new XElement("ExpirationDate", ExpirationDate.ToString("o"))
                             ),
                             new XElement("Heat", HeatLevel),
                             new XElement("Id", CarId),
                             new XElement("OwnershipType", "CustomizedCar")
                             );

            return(eCarEntry);
        }
Ejemplo n.º 8
0
        public async Task ProcessPayment()
        {
            try
            {
                var exp = ExpirationDate.Split('/');

                var token = _repository.CreateToken(CreditCardNumber, exp[0], "20" + exp[1], SecurityCode);

                // TODO: Store Stripe token in SQLite for future payments

                await _api.ChargeCard(token, ServicePrice);

                ExceptionModel.ExceptionModelInstance.PaymentError = "";
            }
            catch (Exception ex)
            {
                HockeyApp.MetricsManager.TrackEvent("OnProcessPayment",
                                                    new Dictionary <string, string>
                {
                    { "Time", DateTime.UtcNow.ToString() },
                    { "Error", ex.Message }
                },
                                                    new Dictionary <string, double>
                {
                    { "Value", 2.5 }
                });

                ExceptionModel.ExceptionModelInstance.PaymentError = ex.Message;
                await Application.Current.MainPage.DisplayAlert("Error", "An error ocurred while processing payment. Please try again.", "OK");
            }
        }
Ejemplo n.º 9
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (ExpirationDate.CompareTo(StartDate) <= 0)
     {
         yield return(new ValidationResult("Data wygaśnięcia nie może być wcześniejsza niż data rozpoczęcia."));
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Extends the expiration date the specified timespan, extending an existing
        /// expiration or setting a new one as appropriate.  E.g., if you are just earning
        /// a 1-year gratuity, sets it for 1 year from today.  If it is June 5 and your existing
        /// gratuity expires on Aug 12, you get until Aug 12 one year beyond.
        /// </summary>
        /// <param name="p">The payment that extends the date</param>
        /// <param name="fUpdateReminderCount">Reset the reminder regime?</param>
        /// <returns>True if the object was modified</returns>
        protected virtual bool ExtendExpiration(Payment p, Boolean fUpdateReminderCount)
        {
            if (p == null)
            {
                throw new ArgumentNullException("p");
            }

            DateTime dtFromPayment            = p.Timestamp.Add(GratuityEarned.Window);
            DateTime dtFromExistingExpiration = ExpirationDate.Add(GratuityEarned.Window);

            // Our business rule here is that if the payment is LESS than the amount required for the gratuity, we will extend from the date of the payment
            // (Assumes that this is a top-off.  E.g., $10/month will extend month by month).
            // BUT if the payment triggers a new gratuity match, we will extend.  E.g., pay $25 in April gets you to the following April.  But pay another $25
            // in June and we'll extend you to the april after that.
            DateTime dtNew = (p.Amount >= GratuityEarned.Threshold) ? dtFromPayment.LaterDate(dtFromExistingExpiration) : dtFromPayment;

            if ((ExpirationDate.CompareTo(dtNew) != 0))
            {
                ExpirationDate = dtNew;
                if (fUpdateReminderCount)
                {
                    ReminderCount    = 0;
                    LastReminderDate = DateTime.MinValue;
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 11
0
        public override string ToString()
        {
            StringBuilder output = new StringBuilder();

            output.Append(String.Format("{0}, weight: {1}, belongs to the category of products: {2}", Name, Weight, this.Category.ToString()));
            output.Append(String.Format("\n was made by {0} on {1}", Producer, ProductionDate.ToLongDateString()));

            if (IsSafeToUse())
            {
                if (this.category != ProductCategory.Beverages)
                {
                    output.Append(String.Format("\n can be used another {0} days", ExpireIn()));
                }
                else
                {
                    int expire = ExpireIn();
                    if (expire > 0)
                    {
                        output.Append(String.Format("\n can be used another {0} months", expire));
                    }
                    else
                    {
                        DateTime now = DateTime.Now;
                        output.Append(String.Format("\n can be used another {0} days", this.ExpirationDate.Subtract(now).Days));
                    }
                }
            }
            else
            {
                output.Append(String.Format("\n it expired on {0} ", ExpirationDate.ToLongDateString()));
            }

            return(output.ToString());
        }
        /// <summary>
        /// CellEditEnding event handler of the datagrid. Commits the change and updates the total price textbox.
        /// Manual change committing is required to update the saleitem price if the user presses for ex. tab button
        /// instead of return.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ProductSaleDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            if (_isManualEditCommit)
            {
                return;
            }
            _isManualEditCommit = true;
            productSaleDataGrid.CommitEdit(DataGridEditingUnit.Row, true);
            SaleItem currItem = e.Row.Item as SaleItem;

            Debug.Assert(currItem != null, "Associated sale item cannot be retrieved.");
            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (currItem != null && currItem.PrevNumSold != currItem.NumSold)
            {
                // User has changed the number of items cell.

                int diff = currItem.NumSold - currItem.PrevNumSold;

                currItem.Product.NumItems -= diff;
                ExpirationDate selectedExpDate = currItem.Product.ExpirationDates.FirstOrDefault(
                    x => x.ExDate == currItem.ExDate);
                if (selectedExpDate != null)
                {
                    selectedExpDate.NumItems -= diff;
                    if (selectedExpDate.NumItems < 0)
                    {
                        MessageBox.Show("Ürünün geçerli son kullanma tarihine sahip stok miktarı sıfırın altına indi. " +
                                        "Lütfen stok bilgilerini tekrar kontrol edin.", "Stok uyarısı",
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
                else
                {
                    // User has modified the product's expiration date after selling it
                    // We don't track expiration date modifications, so create a new expirationDate object with
                    // the original date and notify the user.

                    MessageBox.Show("Ürünü sisteme girdikten sonra son kullanma tarihlerini değiştirmişsiniz.\n" +
                                    "Eklenen/çıkarılan ürünler yine de orijinal son kullanma tarihini kullanacaklardır.\n" +
                                    "Bu penceredeki işinizin bitiminden sonra ürün detaylarına girip son kullanma tarihlerini " +
                                    "kontrol etmeniz faydalı olabilir.", "Ürün son kullanma tarihi uyarısı", MessageBoxButton.OK);
                    ExpirationDate orgExpirationDate = new ExpirationDate
                    {
                        Id       = Guid.NewGuid(),
                        ExDate   = currItem.ExDate,
                        NumItems = -diff,
                        Product  = currItem.Product
                    };
                    currItem.Product.ExpirationDates.Add(orgExpirationDate);
                }
                currItem.PrevNumSold = currItem.NumSold;
            }

            // Set the flag to false for future edits
            _isManualEditCommit = false;
            UpdateTotalPrice();

            OnCurrentProductSaleChanged();
        }
Ejemplo n.º 13
0
 public override string RetrieveInformation()
 {
     return(base.RetrieveInformation() + "\n" +
            "Expiration Date: " + ExpirationDate.ToShortDateString() + "\n" +
            "Spending Limit: " + SpendingLimit + "\n" +
            "Monthly Limit: " + MonthlyLimit + "\n" +
            "Credit Limit: " + CreditLimit + "\n");
 }
Ejemplo n.º 14
0
 public PurchasedMovie(Movie movie, Customer customer, Dollar price, ExpirationDate expirationDate)
 {
     Movie          = movie;
     Customer       = customer;
     Price          = price;
     ExpirationDate = expirationDate;
     PurchasedDate  = DateTime.UtcNow;
 }
Ejemplo n.º 15
0
 public bool Equals(TicketChargeCode other)
 {
     return(other.ChargeCode == ChargeCode &&
            other.ChargeCodeId == ChargeCodeId &&
            other.Description == Description &&
            other.ExpirationDate.ToShortDateString() == ExpirationDate.ToShortDateString() &&
            other.IsActive == IsActive);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Suppress given rule
        /// </summary>
        /// <param name="issueId">Rule Id to suppress (null for all)</param>
        /// <param name="date">Date of suppression expiration (DateTime.MaxValue for no expiration)</param>
        /// <returns>Line of code with suppression set</returns>
        public string SuppressIssue(string issueId, DateTime date)
        {
            // Get `rules list` or `all` keyword
            string ruleList = string.Empty;

            if (string.IsNullOrEmpty(issueId))
            {
                ruleList = KeywordAll;
            }
            // Create the rules list
            else
            {
                if (!_issues.Contains(issueId))
                {
                    _issues.Add(issueId);
                }

                ruleList = string.Join(",", _issues.ToArray());
            }

            // Prepare basic ignore command
            string command    = string.Format("{0} {1} {2}", KeywordPrefix, KeywordIgnore, ruleList);
            string expiration = string.Empty;

            // Prepare expiration date if it is set
            if (ExpirationDate != DateTime.MaxValue)
            {
                expiration = string.Format(" {0} {1}", KeywordUntil, ExpirationDate.ToString("yyyy-MM-dd"));
            }

            // Set expiration to the closer date
            if (date < DateTime.MaxValue && date < ExpirationDate)
            {
                expiration = string.Format(" {0} {1}", KeywordUntil, date.ToString("yyyy-MM-dd"));
            }

            command = string.Concat(command, expiration);

            // If we are dealing with existing suppress we are going to refresh it
            // othewrise add completely new comment with suppressor
            string result = _text;

            if (this.Index > 0)
            {
                result = result.Remove(Index, Length);
                result = result.Insert(Index, command);
            }
            else
            {
                result = string.Format("{0} {1}{2}{3}",
                                       result,
                                       Language.GetCommentPrefix(_language),
                                       command,
                                       Language.GetCommentSuffix(_language));
            }

            return(result);
        }
        public void Constructor()
        {
            var            now     = DateTime.Now;
            ExpirationDate expDate = new(now);

            Assert.AreEqual(now, expDate.AbsoluteExpiration);
            expDate = new ExpirationDate(TimeSpan.FromMinutes(1));
            Assert.AreEqual(TimeSpan.FromMinutes(1), expDate.SlidingExpiration);
        }
Ejemplo n.º 18
0
 private void MinusCount(ExpirationDate expD)
 {
     if (expD.Count > 0)
     {
         int idx = ExpirationDates.IndexOf(expD);
         expD.Count--;
         ExpirationDates[idx] = expD;
     }
 }
 public void Validate()
 {
     PlanName.ValidateRequired("PlanName");
     CoverageType.ValidateOptional("CoverageType");
     SubscriberDob.ValidateOptional("SubscriberDob");
     IsPrimary.ValidateOptional("IsPrimary");
     ExpirationDate.ValidateOptional("ExpirationDate");
     Contact.ValidateOptional("Contact");
 }
Ejemplo n.º 20
0
 internal QuoteExtended(IQuote quote)
 {
     Id                  = quote.Id;
     Symbol              = quote.Symbol;
     Price               = quote.Price;
     AvailableVolume     = quote.AvailableVolume;
     ExpirationDate      = quote.ExpirationDate;
     ExpirationTimestamp = ExpirationDate.ToUnixTimestamp();
 }
Ejemplo n.º 21
0
        private void DeleteSelectedProductSale()
        {
            ProductSale selectedSale = productSalesDataGrid.SelectedItem as ProductSale;

            if (selectedSale == null)
            {
                return;
            }
            MessageBoxResult result = MessageBox.Show("Seçili satışı silmek istediğinizden emin misiniz?",
                                                      "Satış silme onayı", MessageBoxButton.YesNo);

            if (result != MessageBoxResult.Yes)
            {
                return;
            }

            // Add the Sale Items to the stock again.
            foreach (SaleItem saleItem in new List <SaleItem>(selectedSale.SaleItems))
            {
                saleItem.Product.NumItems += saleItem.NumSold;
                SaleItem       item      = saleItem;
                ExpirationDate exDateObj = saleItem.Product.ExpirationDates.FirstOrDefault(
                    x => x.ExDate == item.ExDate);
                if (exDateObj != null)
                {
                    exDateObj.NumItems += saleItem.NumSold;
                }
                else
                {
                    // User has modified the product's expiration date after selling it
                    // We don't track expiration date modifications, so create a new expirationDate object with
                    // the original date and notify the user.

                    MessageBox.Show(this, item.Product.Name + " ürününü sattıktan sonra son kullanma tarihlerini " +
                                    "değiştirmişsiniz.\n" +
                                    "Eklenen/çıkarılan ürünler yine de orijinal son kullanma tarihini kullanacaklardır.\n" +
                                    "Bu penceredeki işinizin bitiminden sonra ürün detaylarına girip son kullanma tarihlerini " +
                                    "kontrol etmeniz faydalı olabilir.", "Ürün son kullanma tarihi uyarısı", MessageBoxButton.OK);
                    ExpirationDate orgExpirationDate = new ExpirationDate
                    {
                        Id       = Guid.NewGuid(),
                        ExDate   = item.ExDate,
                        NumItems = item.NumSold,
                        Product  = item.Product
                    };
                    item.Product.ExpirationDates.Add(orgExpirationDate);
                }

                ObjectCtx.Context.SaleItems.Remove(saleItem);
            }

            // Delete the product sale
            _productSaleColl.Remove(selectedSale);
            ObjectCtx.Context.ProductSales.Remove(selectedSale);

            applyButton.IsEnabled = true;
        }
 public void Validate()
 {
     Name.ValidateRequired("Name");
     AdministrationDate.ValidateOptional("AdministrationDate");
     Administrator.ValidateOptional("Administrator");
     Manufacturer.ValidateOptional("Manufacturer");
     Route.ValidateOptional("Route");
     ExpirationDate.ValidateOptional("ExpirationDate");
     AnatomicSurface.ValidateOptional("AnatomicSurface");
 }
 public string ToCsv()
 {
     return($"F,{Symbol},{ExchangeId},{PE.ToInvariantString()},{AverageVolume.ToInvariantString()},{FiftyTwoWeekHigh.ToInvariantString()},{FiftyTwoWeekLow.ToInvariantString()},{CalendarYearHigh.ToInvariantString()},{CalendarYearLow.ToInvariantString()},{DividendYield.ToInvariantString()}," +
            $"{DividendAmount.ToInvariantString()},{DividendRate.ToInvariantString()},{PayDate.ToInvariantString(FundamentalDateTimeFormat)},{ExDividendDate.ToInvariantString(FundamentalDateTimeFormat)},{string.Empty},{string.Empty},{string.Empty},{ShortInterest},{string.Empty}," +
            $"{CurrentYearEarningsPerShare.ToInvariantString()},{NextYearEarningsPerShare.ToInvariantString()},{FiveYearGrowthPercentage.ToInvariantString()},{FiscalYearEnd.ToInvariantString()},{string.Empty},{CompanyName},{RootOptionSymbol},{PercentHeldByInstitutions.ToInvariantString()}," +
            $"{Beta.ToInvariantString()},{Leaps},{CurrentAssets.ToInvariantString()},{CurrentLiabilities.ToInvariantString()},{BalanceSheetDate.ToInvariantString(FundamentalDateTimeFormat)},{LongTermDebt.ToInvariantString()},{CommonSharesOutstanding.ToInvariantString()}," +
            $"{string.Empty},{SplitFactor1},{SplitFactor2},{string.Empty},{string.Empty},{FormatCode},{Precision.ToInvariantString()},{SIC.ToInvariantString()},{HistoricalVolatility.ToInvariantString()},{SecurityType},{ListedMarket},{FiftyTwoWeekHighDate.ToInvariantString(FundamentalDateTimeFormat)}," +
            $"{FiftyTwoWeekLowDate.ToInvariantString(FundamentalDateTimeFormat)},{CalendarYearHighDate.ToInvariantString(FundamentalDateTimeFormat)},{CalendarYearLowDate.ToInvariantString(FundamentalDateTimeFormat)},{YearEndClose.ToInvariantString()},{MaturityDate.ToInvariantString(FundamentalDateTimeFormat)}," +
            $"{CouponRate.ToInvariantString()},{ExpirationDate.ToInvariantString(FundamentalDateTimeFormat)},{StrikePrice.ToInvariantString()},{NAICS.ToInvariantString()},{ExchangeRoot},{OptionsPremiumMultiplier.ToInvariantString()},{OptionsMultipleDeliverables.ToInvariantString()},");
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Represent as NotificationObject.
 /// </summary>
 /// <returns>NotificationObject contains properties values.</returns>
 public virtual Dictionary <string, string> ToObjectProperties()
 {
     return(new Dictionary <string, string>()
     {
         ["Name"] = Name,
         ["ExpirationDate"] = ExpirationDate.ToString(CultureInfo.InvariantCulture),
         ["Type"] = Enum.GetName(typeof(WareType), Type),
         // Instead of manual filling may using reflection
     });
 }
Ejemplo n.º 25
0
        protected override StringBuilder ToBuilder()
        {
            var builder = base.ToBuilder();

            builder.AppendProperty(nameof(AccessToken), AccessToken);
            builder.AppendProperty(nameof(Region), Region.ToString());
            builder.AppendProperty(nameof(Localization), Localization.ToString());
            builder.AppendProperty(nameof(ExpirationDate), ExpirationDate.ToString(CultureInfo.CurrentCulture));
            return(builder);
        }
Ejemplo n.º 26
0
        public override int GetHashCode()
        {
            var hashCode = Int32.MaxValue;

            hashCode = hashCode * Int32.MinValue + base.GetHashCode();
            hashCode = hashCode * Int32.MinValue + ExpirationDate.GetHashCode();
            hashCode = hashCode * Int32.MinValue + EqualityComparer <string> .Default.GetHashCode(Typology);

            return(hashCode);
        }
Ejemplo n.º 27
0
 internal bool IsChanged(PaymentCard card)
 {
     if (card is null)
     {
         return(Name.Length > 0 || !StartDate.Equals(DateTime.MinValue) || !ExpirationDate.Equals(DateTime.MinValue) ||
                NameOnCard.Length > 0 || CardType.Length > 0 || CardNumber.Length > 0 || SecurityCode.Length > 0 || Notes.Length > 0);
     }
     return(card.Name != Name || card.StartDate != StartDate || card.ExpirationDate != ExpirationDate || card.NameOnCard != NameOnCard ||
            card.CardType != CardType || card.CardNumber != CardNumber || card.SecurityCode != SecurityCode || card.Notes != Notes);
 }
        public AddPurchaseWindow(Product product)
        {
            InitializeComponent();
            CurrentProduct = product;

            _currExpirationDate = new ExpirationDate {
                Product = CurrentProduct
            };
            expirationDateDatePicker.DataContext = _currExpirationDate;
        }
Ejemplo n.º 29
0
 private void WriteLicenseProperties(StringBuilder sb)
 {
     sb.AppendLine(HardwareIdentifier);
     sb.AppendLine(SerialNumber);
     sb.AppendLine(IssueDate.ToString(CultureInfo.InvariantCulture));
     sb.AppendLine(ExpirationDate.ToString(CultureInfo.InvariantCulture));
     foreach (var property in Properties)
     {
         sb.AppendLine(property.Key + ":" + property.Value);
     }
 }
Ejemplo n.º 30
0
        private void DatagridDeleteExpirationDateMenuItem_Click(object sender, RoutedEventArgs e)
        {
            ExpirationDate expirationDate = expirationDatesDataGrid.SelectedItem as ExpirationDate;

            if (expirationDate == null)
            {
                return;
            }

            _expirationDates.Remove(expirationDate);
        }
Ejemplo n.º 31
0
 private void HandleDeleteExpirationDateCommand(ExpirationDate expirationDate)
 {
     this.Product.ExpirationDates.Remove(expirationDate);
 }