Exemple #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="paymentModes"></param>
        /// <returns></returns>
        public int AddUpdateListingPaymentModes(IListingPaymentModesDTO paymentModes)
        {
            int retVal = 0;
            try
            {
                if (paymentModes != null)
                {
                    using (TransactionScope trans = new TransactionScope())
                    {
                        using (var TMCDbContext = new TMCContext())
                        {
                            foreach (var paymentModeDto in paymentModes.PaymentModes)
                            {
                                long listingPaymentModeId = paymentModeDto.ListingPaymentModeId;
                                if (paymentModeDto.ListingPaymentModeId > 0)
                                {
                                    var listingPaymentModeEntity =
                                        TMCDbContext.ListingPaymentMode.SingleOrDefault(
                                            pmode => pmode.ListingPaymentModeId == listingPaymentModeId);
                                    if (listingPaymentModeEntity != null)
                                    {
                                        TMCDbContext.ListingPaymentMode.DeleteObject(listingPaymentModeEntity);
                                    }

                                }
                                else
                                {
                                    var listingPaymentMode = new ListingPaymentMode();
                                    EntityConverter.FillEntityFromDTO(paymentModeDto, listingPaymentMode);
                                    TMCDbContext.ListingPaymentMode.AddObject(listingPaymentMode);
                                }
                            }

                            if (TMCDbContext.SaveChanges() > 0)
                            {
                                retVal = 1;
                            }
                        }
                        trans.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException(ex);
                throw new DACException("Error while updating listing payment modes.", ex);
            }
            return retVal;
        }
Exemple #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ListingPaymentMode EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToListingPaymentMode(ListingPaymentMode listingPaymentMode)
 {
     base.AddObject("ListingPaymentMode", listingPaymentMode);
 }
Exemple #3
0
 /// <summary>
 /// Create a new ListingPaymentMode object.
 /// </summary>
 /// <param name="listingPaymentModeId">Initial value of the ListingPaymentModeId property.</param>
 /// <param name="listingId">Initial value of the ListingId property.</param>
 /// <param name="paymentModeId">Initial value of the PaymentModeId property.</param>
 public static ListingPaymentMode CreateListingPaymentMode(global::System.Int64 listingPaymentModeId, global::System.Int64 listingId, global::System.Int16 paymentModeId)
 {
     ListingPaymentMode listingPaymentMode = new ListingPaymentMode();
     listingPaymentMode.ListingPaymentModeId = listingPaymentModeId;
     listingPaymentMode.ListingId = listingId;
     listingPaymentMode.PaymentModeId = paymentModeId;
     return listingPaymentMode;
 }