/// <summary>
        /// Gifts the certificate model.
        /// </summary>
        /// <param name="GiftCertificateModel">The gift certificate model.</param>
        /// <returns></returns>
        public static GiftCertificateViewModel GiftCertificateModel(GiftCertificate GiftCertificateModel)
        {
            GiftCertificateViewModel giftCertificateViewModel = new GiftCertificateViewModel();

            giftCertificateViewModel.GiftCertificateID     = GiftCertificateModel.GiftCertificateID;
            giftCertificateViewModel.GiftDate              = GiftCertificateModel.GiftDate;
            giftCertificateViewModel.DonorID               = GiftCertificateModel.DonorID;
            giftCertificateViewModel.ShippingInstructionID = GiftCertificateModel.ShippingInstructionID;
            giftCertificateViewModel.ReferenceNo           = GiftCertificateModel.ReferenceNo;
            giftCertificateViewModel.Vessel           = GiftCertificateModel.Vessel;
            giftCertificateViewModel.ETA              = GiftCertificateModel.ETA;
            giftCertificateViewModel.ProgramID        = GiftCertificateModel.ProgramID;
            giftCertificateViewModel.PortName         = GiftCertificateModel.PortName;
            giftCertificateViewModel.DModeOfTransport = GiftCertificateModel.DModeOfTransport;
            var giftCertificateDetail = GiftCertificateModel.GiftCertificateDetails.FirstOrDefault();

            if (giftCertificateDetail != null)
            {
                giftCertificateViewModel.CommodityTypeID = giftCertificateDetail.Commodity.CommodityTypeID;
            }
            else
            {
                giftCertificateViewModel.CommodityTypeID = 1;//by default 'food'
            }
            giftCertificateViewModel.GiftCertificateDetails =
                GiftCertificateDetailsViewModel.GenerateListOfGiftCertificateDetailsViewModel(
                    GiftCertificateModel.GiftCertificateDetails.ToList());


            return(giftCertificateViewModel);
        }
Example #2
0
        public static GiftCertificateDetailsViewModel GenerateGiftCertificateDetailsViewModel(GiftCertificateDetail giftCertificateDetail)
        {
            GiftCertificateDetailsViewModel model = new GiftCertificateDetailsViewModel();

            model.GiftCertificateID = giftCertificateDetail.GiftCertificateID;
            model.CommodityID       = giftCertificateDetail.CommodityID;
            model.BillOfLoading     = giftCertificateDetail.BillOfLoading;
            model.YearPurchased     = giftCertificateDetail.YearPurchased;
            model.AccountNumber     = giftCertificateDetail.AccountNumber;
            model.WeightInMT        = giftCertificateDetail.WeightInMT;
            model.EstimatedPrice    = giftCertificateDetail.EstimatedPrice;
            model.EstimatedTax      = giftCertificateDetail.EstimatedTax;
            model.DBudgetTypeID     = giftCertificateDetail.DBudgetTypeID;
            model.DFundSourceID     = giftCertificateDetail.DFundSourceID;
            model.DCurrencyID       = giftCertificateDetail.DCurrencyID;
            model.ExpiryDate        = giftCertificateDetail.ExpiryDate;

            return(model);
        }
        public static GiftCertificateDetailsViewModel GenerateGiftCertificateDetailsViewModel(GiftCertificateDetail giftCertificateDetail)
        {
            GiftCertificateDetailsViewModel model = new GiftCertificateDetailsViewModel();

            model.GiftCertificateID = giftCertificateDetail.GiftCertificateID;
            model.CommodityID = giftCertificateDetail.CommodityID;
            model.BillOfLoading = giftCertificateDetail.BillOfLoading;
            model.YearPurchased = giftCertificateDetail.YearPurchased;
            model.AccountNumber = giftCertificateDetail.AccountNumber;
            model.WeightInMT = giftCertificateDetail.WeightInMT;
            model.EstimatedPrice = giftCertificateDetail.EstimatedPrice;
            model.EstimatedTax = giftCertificateDetail.EstimatedTax;
            model.DBudgetTypeID = giftCertificateDetail.DBudgetTypeID;
            model.DFundSourceID = giftCertificateDetail.DFundSourceID;
            model.DCurrencyID = giftCertificateDetail.DCurrencyID;
            model.ExpiryDate = giftCertificateDetail.ExpiryDate;

            return model;
        }