コード例 #1
0
        /// <summary>
        /// Get the child discount for
        /// </summary>
        /// <param name="AAge">age of the person</param>
        /// <param name="AConferenceKey">conference key</param>
        /// <param name="ACostType">Defines the type of discount (e.g. ACCOMMODATION or CONFERENCE)</param>
        /// <param name="ADiscount">discount the person gets</param>
        /// <param name="AInPercent">Type of discaount: True - discount is in percent. False - discount is the amount</param>
        /// <param name="ASituation">The current report situation</param>
        /// <returns></returns>
        public static bool GetChildDiscount(int AAge, long AConferenceKey, String ACostType,
                                            out decimal ADiscount, out bool AInPercent, ref TRptSituation ASituation)
        {
            ADiscount  = 0.0M;
            AInPercent = false;

            PcDiscountTable DiscountTable;

            PcDiscountTable TmpTable    = new PcDiscountTable();
            PcDiscountRow   TemplateRow = TmpTable.NewRowTyped(false);

            TemplateRow.ConferenceKey        = AConferenceKey;
            TemplateRow.CostTypeCode         = ACostType;
            TemplateRow.DiscountCriteriaCode = "CHILD";
            TemplateRow.Validity             = "ALWAYS";

            StringCollection OrderList = new StringCollection();

            OrderList.Add(" ORDER BY " + PcDiscountTable.GetUpToAgeDBName() + " ASC");

            DiscountTable = PcDiscountAccess.LoadUsingTemplate(TemplateRow, null, null,
                                                               ASituation.GetDatabaseConnection().Transaction, OrderList, 0, 0);

            foreach (PcDiscountRow DiscountRow in DiscountTable.Rows)
            {
                if ((!DiscountRow.IsUpToAgeNull()) &&
                    (DiscountRow.UpToAge >= AAge))
                {
                    ADiscount  = DiscountRow.Discount;
                    AInPercent = DiscountRow.Percentage;

                    return(true);
                }
            }

            return(false);
        }
コード例 #2
0
 public DiscountRowChangeEvent(DiscountRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }